Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Multi Controller Communication question

Status
Not open for further replies.

jbarnaby2000

New Member
I have been thinking on designing a multi-controller system for my aquarium controller. The basic jist of the project will be a central controller that will control remote units. The remote units will be of varying types, from sensors (Temp, flow, water levels, and others possibly) to AC control of pumps, as well as control of heaters, coolers, fans, and lights. I would like the controllers to be PIC's, probably the 18F series, but I am open to others as well. Since this is just in the thinking stage right now, cost of microcontrollers is not an issue, I am just looking for the functionality.

I would like to have a central hub that all these moduls feed into and then this central hub will have hopefully some type of TCP\IP connectivity for either telnet or FTP or even a Mini-WEB, I have not really decided that part yet.

The main question I have is what should I use to inter-connect the controllers? I know there is CAN bus, and SPI, I2C, as well as UART as well, I am just wondering what would be the best for this type of situation. I do not plan on transferring high amounts of data over these lines so I would think whatever a standard speed for each of these protocols would be fine.

I would like to make it so that everything plugs into the main hub via a simple network cat5 patch cable (4 twisted pair) due the fact these are readily available. So I was thinking either SPI, using the main controller as the master, and then using all the others as slaves, and then using like the Slave Select lines to select which slave I want the main controller to talk to.

Any Ideas??

Thx
 
Depending on your approach, only two microcontrollers would be needed. At a bare minimum, only two 16f's with a UART would be required.

The assumption is that a pair of wireless zigbee modules would be used in "transparent serial" mode for communication. And that a serial to ethernet module would be used for the web interface.

If a hard wire solution is possible/desired, than maybe a device with the EUSART would be the way to go?
 
Actually I was thinking of making it more modular than just two controllers though. So I really want maybe 4 slaves at a minimum possibly up to 10. And wired is the way I really want to go too. Wireless possibly for the TCP\IP part but that will be an add-in later I think.

And I do agree teh EUSART maybe a better solution for the multiple controllers...Just trying to get all points of view at this point.

If I were to use the EUSART then how would I do 3 or more controllers?? Would I have to use separate EUSART channels to the main controller like in a hub and spoke type of configuration or is there a way of daisy chaining the controllers and using some type of addressing.... just a couple more thoughts...

Thx a bunch...
 
I think the selection might well be based on a couple of different factors. One being the distance involved between the main controller and the slave microcontrollers/modules. And two, what bus standard are you comfortable in programing?

Have not personally dealt with addressable UART's. Have dealt with I2C stuff, and like the addressing functionality, and the many different devices like slave controller, temperature, RTC, EEPROM etc. Of course the same can be said about the SPI stuff.

Either way, a PIC with MSSP should a requirement of the master controller. The MSSP would allow you the master-multiple slave controller relationship that you are looking for? This of course is dependent on a fairly local distance requirement.

For long distance sensors, the Dallas one-wire bus might make sense. I think a mix of bus types is inevitable, because they all have their pros and cons.
 
nickelflippr said:
Either way, a PIC with MSSP should a requirement of the master controller. The MSSP would allow you the master-multiple slave controller relationship that you are looking for? This of course is dependent on a fairly local distance requirement.

Do you know that distance requirement?? is it 1 inch or 10 foot or 100 meters?? The local of the controllers from one another I am thinking will not be more than 10 to 15 feet. Do you think MSSP would be a good protocol to use?

In terms of programming, I will have to learn any protocol I use, so that really isn't the issue either.

nickelflippr said:
For long distance sensors, the Dallas one-wire bus might make sense. I think a mix of bus types is inevitable, because they all have their pros and cons.

Well for the sensors you are right, I was thinking the one or two wire bus solutions there. But that is not the communication I was talking about. I will have those sensors talking to thier slave controllers and then the slave controllers will relay that information back to the main hub controller. Does that make sense in what I am trying to do??

Thx for all the help so far...
 
Do you know that distance requirement?? is it 1 inch or 10 foot or 100 meters?? The local of the controllers from one another I am thinking will not be more than 10 to 15 feet. Do you think MSSP would be a good protocol to use?

The distance for the I2C bus is dependent on the pullup resistors and the capicitance of the wire used. Best to visit the I2C protocol by Philips and check past posts on this forum. Using the built in hardware (as opposed to software) of a PIC is always a good thing if available.

I will have those sensors talking to thier slave controllers and then the slave controllers will relay that information back to the main hub controller. Does that make sense in what I am trying to do??

Doesn't make sense to use all the slave controllers, when one master controller could do the whole job easily.
 
nickelflippr said:
The distance for the I2C bus is dependent on the pullup resistors and the capicitance of the wire used. Best to visit the I2C protocol by Philips and check past posts on this forum. Using the built in hardware (as opposed to software) of a PIC is always a good thing if available.

Will do there, and I was thinking on using the built-in functionality of the PIC I choose as well. I have checked a bit and I really couldn't find anything like waht I want to do...so I will check on teh Philips site and see what they have to offer.


nickelflippr said:
Doesn't make sense to use all the slave controllers, when one master controller could do the whole job easily.

Well I want to make it modular and also if I do this then some of the modules can be stand alone and wont really need a master. The object is to make it as configurable as possible.....also to get some experience in connecting multiple controllers too...lol..
 
I was also thinking of implementing a Controller Area Network maybe as well. Since this controller will be around AC voltages, maybe a resilent network and network protcol like a CAN would work...

I was thinking on using PIC18F's for this, and the 18F2585\2680\4585\4680's seem to have CAN trancievers built into the controller, are there any dsPIC's anyone would suggest??
 
These days nearly all my fish live in ponds but I used to keep a fishroom.

As you know a single failure can cause death in a few hours. Floods happen even faster. With this in mind it is best to be as redundant as possible. Both with sensors and units such as heaters and pumps.

For heating use at least 2 heaters per tank and temperature sensors from at least 2 different controllers in each tank. For filtration uses at least 2 filters per tank. Use multiple power sources with GFI so that if one GFI trips all tanks will still have a least one filter and heater running.

Are we talking one or several tanks? For 1 or 2 tanks I would use 2 redundant controllers watching both.

A multi tank setup in more interesting.

If you were only operating in a damp fishroom static would not be much of a problem. But if you are like me you will in time extend the network outside the fishroom and you will not have the humidity to protect you.

Maxim makes a nice RS484 driver that has ESD protection and allows you to hot plug devices into the network. Maybe overkill but it is not that expensive and if your are going to do it, do it right sort of thing. The hot plug feature is nice in any case.

The network is low traffic. There are several protocols that will work. I feel that KISS holds here. Whatever you pick it is good to be able to monitor the network without much trouble. Maybe XMIT packets is uncompress clear ASCII chars.

If I were doing a fishroom I would have a master and a backup master connected to the internet.

Bill (BlueroomElectronics) is working on a PIC internet board with R484. These should make good masters.

This can get way complex and there are huge gaps in what I have talked about.

I started work on a control network a while back but all the boards were point to point wired. The plan is to start over using DIY PCBs for most of the controllers.
 
Last edited:
I agree on keeping it simple...and right now this is to monitor one tank...with the option of monitoring more. But the main thing I want to do is make it as modular as possible.

And yes I know, you can go really crazy/overboard with this type of system, and I would really like to make it redundant...or at least make it an option, so I will look at putting that into the design...

As for the RS484 networks though.... Does that pretty much work like RS232 but with a further distance capability?? or can they be connected in parallel, or series, and have some kind of addressing scheme to determine who is talking?

I am looking at have the slave modules hook to a master module sort of in a hub/spoke type design like a star network. The main controllers will most definitely have some ethernet connectivity like you suggest though, wether it will be wired or wireless I have not decided that yet.
 
jbarnaby2000 said:
I agree on keeping it simple...and right now this is to monitor one tank...with the option of monitoring more. But the main thing I want to do is make it as modular as possible.

And yes I know, you can go really crazy/overboard with this type of system, and I would really like to make it redundant...or at least make it an option, so I will look at putting that into the design...

As for the RS484 networks though.... Does that pretty much work like RS232 but with a further distance capability?? or can they be connected in parallel, or series, and have some kind of addressing scheme to determine who is talking?

It's a master / slave type setup and I think everybody has an address, master sends commands and slave responds. I believe it's a balanced line type cabling with 2 wires for tx and 2 for rx, should have a ground also.

I at one time wanted to do an auto tank top-off, still may try it after I get comfortable with pic's (waiting to order a junebug).

You might want to check this out: **broken link removed** check ADN004

I am looking at have the slave modules hook to a master module sort of in a hub/spoke type design like a star network. The main controllers will most definitely have some ethernet connectivity like you suggest though, wether it will be wired or wireless I have not decided that yet.
 
Last edited:
binzer said:
You might want to check this out: **broken link removed** check ADN004

I was thinking that exact thing today...maybe a CAN bus...it seems to fit the bill. I was just wondering if it is pretty easy to implement... I did find those processors that already have the CAN interfaces already in the controllers as well.

By the way...I just bought a junebug as well...what a great kit...now I just have to find the time to play with it...
 
binzer said:
It's a master / slave type setup and I think everybody has an address, master sends commands and slave responds. I believe it's a balanced line type cabling with 2 wires for tx and 2 for rx, should have a ground also.
You are thinking of RS422. RS485 is half duplex and only requires 2 wires and ground. It is a physical standard and does not indicate what protocol is used.

The choice of protocol is important. The wrong one will use up all your uC flash memory on features you do not need or want.
 
Where to start

Is this fresh or salt?

Even without automation two of everything on 2 separate circuits is a good idea. That is the place to start.

Size the heater so if one fails to shut off it will not cook the fish. If one fails to come on the other it enough to keep the fish alive if not happy. When you have the controllers installed I would turn the heaters up to where they do not turn off and use the uC to switch them.

Size the filtration so that either one can handle the entire load. In normal operation each will have about half the bacteria needed. If one fails the other will rapidly grow enough bacteria to handle the additional load. In addition to the filtration I suggest you keep an airstone in the tank to keep the water moving should both filters fail. The tank walls are covered with bacteria and as long as the water is moving it will do some biological filtration. Also with 2 filters you can alternate filter cleaning.

A battery operated air pump to keep the water moving when power fails is a good idea. Next best thing to using battery backup on the filters.

All of this will help keep the aquarium alive with or witout monitoring.

EDIT:
Everything need to be on a GFI
 
3v0 said:
Is this fresh or salt?
It will be a Salt tank

3v0 said:
Even without automation two of everything on 2 separate circuits is a good idea. That is the place to start.
I was thinking the same Idea here... My power control modules I am thinking will be able to be dual sourced (House and UPS power) and then I will be able to hopefully monitor if pumps/Heaters/Lights fail and be able to have backups online...at least that is the plan :D

Boy a project like this can really grow fast too...so many things to control, and monitor....

Then add in the multiple tank idea...or a tank with a sump, a refugium, a water storage tank....that really is why I want to make it modular so I can just add, already designed modules to expand the system.

so 3v0, so you think RS422 would be a good way of interconnecting these modules?? You mentioned about protocols too...is there a particular one I should look for in terms of excessive memory usage?? I really am looking for ease of implementation really...I can hopefully find a PIC that will fit the bill...at least I hope I can...

Thx
 
For more then two units talking you want to go with RS485 (half duplex). RS422 (full duplex) is most often for two units talking to each other as with RS232.

For now I would work on the backup power and redundant systems. The PS and redundant systems will provide more protection then monitoring because they work even if you are not there or ignore them.

Then add a single Ethernet connected controler with RS485 to talk with other controlers when they are added.

If you do that there is no need to figure out the protocol at this time.

I started a control system over two years ago. I was using 16F877A's and had code for 1 wire sensors, and device control in place. Even without the existing code some/many of the protocols were too large and complicated.

I can not tell you which protocol to pick because I had not made up my mind. The following is from memory.

For reasons I can not reacall I did not choose the CAN protocol. It was intended for automotive use.

There are building control protocols. On for the US and another for the rest of the world. I think these were large/overkill.

There are a number of home control protocols that may be a better fit.

There is at least one protocol avialable as a subset for use in micro controllers.

EDIT: Since then inexpensive uC's with larger memories and more speed have shown up. Size is less of an issue. At this point I would look at what tools (network monitor etc) and maybe a good support group.
 
Last edited:
See I dont even think the redundant power is such a big thing though. Since I can just run the entire system on one or many UPS's and have the UPS do the power monitoring thing though.

But monitoring the tank I think is pretty important, since I would really like to monitor temps, and other water quality characteristics like PH and ORP and NH2 and NH3 would be really wonderful to monitor and track on a regular basis.

Heck at this point I may just make all the modules ethernet capable...that way I can use very common wiring standards and protocols too...

Thx for all the great ideas...
 
jbarnaby2000 said:
See I dont even think the redundant power is such a big thing though. Since I can just run the entire system on one or many UPS's and have the UPS do the power monitoring thing though.

But monitoring the tank I think is pretty important, since I would really like to monitor temps, and other water quality characteristics like PH and ORP and NH2 and NH3 would be really wonderful to monitor and track on a regular basis.

Heck at this point I may just make all the modules ethernet capable...that way I can use very common wiring standards and protocols too...

Thx for all the great ideas...

Redundant circuits is important with or without UPS. Should anything develop a short the UPS can not power its circuit. A 2nd circuit with duplicate equipment is the only thing that will save the fish.

I did not mean to say monitoring was unimportant. But less so with redundant systems. A monitoring system will tell you when then system failed. The redundant system will keep the fish alive in spite of the failure.

Microchip now has a 1 chip ethernet solution. Maybe a subnet just for the control system.
 
3v0 said:
Redundant circuits is important with or without UPS. Should anything develop a short the UPS can not power its circuit. A 2nd circuit with duplicate equipment is the only thing that will save the fish.

I see where you are going with the redundancy...and yes I totally agree there.

3v0 said:
Microchip now has a 1 chip ethernet solution. Maybe a subnet just for the control system.

Aren't there even a couple of PIC18's that have ethernet on the CPU?? At this point that maybe the way to go...as for its own subnet....great idea...that way it would keep that traffic localized to that system. Great Idea...Thx...

I guess you have thought of they type of system a lot too huh.....:D
 
jbarnaby2000 said:
I see where you are going with the redundancy...and yes I totally agree there.
Aren't there even a couple of PIC18's that have ethernet on the CPU?? At this point that maybe the way to go...as for its own subnet....great idea...that way it would keep that traffic localized to that system. Great Idea...Thx...

I guess you have thought of they type of system a lot too huh.....:D

Lets just say I have killed enough fish to know what works. :rolleyes:

Up to a short while ago you needed 2 chips. A PIC18F66J60 ethernet interface and a PIC to go with it. Microchip has released a chip with both. Do not have the number. Bill is building a kit around it that may be of interest to you. It has a general purpose IO area that can be populated several different ways.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top