Multiple Microcontrollers daisy chained

Hi Arduino Forum;

I am new on this forum and new to the Arduino products. I have been reading on many sites and forums ad it appears that the Arduino is one of the most inexpensive and versatile micro controllers on the market to help in prototyping products. I have a project where I need to daisy chain a series of micro controllers together and control them via a larger controller or computer system. Each micro controller would need to receive commands from the main controller and report status on the devices it controls. For the project, I want to have 3 rotary IC Encoders for rotational position and rate sensing, inputs for 3 Wheatstone bridge circuits, 4 to 8 inputs for proximity sensors, 1 rpm sensor. There will be a need to control 3 solenoids and 3 DC motors, and 3 precision stepper motors. Each micro controller in command of these devices will need to be able to connect to the main controller on the fly and identify itself within the daisy chained micro controllers.

What is the best type of micro controller to use? I was looking at the Mega 2560, but I am not sure if I can link them together like that. Also, based upon my desired I/O requirements, will the 2560 suffice? Any guidance would be greatly appreciated. Thanks

well I don't think you'd be able to do it with regular TX/RX communication between several unos (they only have 1 each) but with megas it shoudl be too hard, they've got 4 of them so 1 mega top of the tree, has 3 megas below it which each have 3 below them. At the end you could have unos or other boards accomplsihing all your final math and everything. but the speed of that connection is only 9600baud so you might not be able to send info fast enough for your project. Theres probably a guide to make a few unos or megas talk to eachother over the I2C or SPI interfaces.

How far apart do they need to be?
Would I2C do the trick?

but the speed of that connection is only 9600baud so you might not be able to send info fast enough for your project.

What makes you think that serial is limited to 9600 baud? Heck even a Uno uploads sketches at 115200 baud.


retrolefty: What makes you think that serial is limited to 9600 baud? Heck even a Uno uploads sketches at 115200 baud.


not having gotten to messing around with getting arduinos to communicate with eachother yet probably. Everything else I said was a wild guess based on looking at a mega board with its 4 tx/rx pairs. So there, learned something new again.

You could probably do everything you need with a single Mega, depending on your code requirements (you may need a few extra parts, like SPI port expanders or ADC chips - and if your code requirements aren’t too large, even an UNO could be made to work with your hardware set). Is there a particular reason why you want such a configuration (not trying to dissuade you; you may have a perfectly valid reason/need)?

If you really want to “daisy-chain”, I would think even a regular Arduino ATmega328 would
work, but it probably won’t have enough pins or PWM channels to handle all of the motor
stuff in your requirement.

I would think you could daisy-chain ok on ATmega328 by using pins 0,1 for upstream
connections using the hardware UART, and pins 2,3 for downstream connections, using
a software UART. Then, each node can simply pass signals up and down the daisy-chain.
With MEGA boards, you can use all hardware UARTS.

Each node will have its own address, so it can pick off messages intended for itself, and
not pass them along. The problem with a daisy-chain, of course, is if there is too much
traffic, the upstream nodes will spend a lot of their time just passing signals along.

Also, the other potential problem I can see relates to the distance between nodes. If
it is more than maybe 20-feet or so, you will have to goto something more robust than
0-5V signals, and such as RS232 [+/-12V], or RS485, etc. Standard industrial controller
comm busses.

Look into something that uses an open-collector communications bus.

If you "own" the entire product, you can change the TX pin from an "output" to an "input" whenever it isn't in use. The RX pins all remain "inputs" so they can listen to whatever is on the communications bus. If you stick with 5 volts, and avoid RS-232 drivers, it should be pretty simple and you may even be able to use the standard UART support in the Arduino.

(Which begs the question -- if I issue a pinMode(TX, INPUT), does the Arduino freak out or make it an OUTPUT pin again?)

Thank you for all the replies on this. I appreciate everyone's input. It sounds like the Mega can do the job. The controller will be located within 12 inches of the next in line controller. Depending on the configuration of the device, the total number of controllers needed could go up to 20 in a row at a distance of 20 feet (maybe more) from the first to the last. A more robust communication bus may be required. The reason for this type of configuration where I need to daisy chain the micro controllers is that each link is a stand alone device and all will connect together to form larger system that is controlled by a laptop or a larger more powerful controller.

Again, Thank you for your input. Great food for thought!!