Connecting multiple boards

Would anybody know how to connect multiple boards to each other? What I want to do is have one board that controls the other boards and tells them which codes to use.
So if I had one board for say an arm for a robot, I want the master board to be able to tell the arm board to move the fingers without having the extra code on the master board. Instead the coding for the arm would be on the arm board, but yet the master board would be able to access it and tell the board what to make the arm do.
Is the even possible?

Hi, Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum". OR http://forum.arduino.cc/index.php/topic,148850.0.html.

What you are asking about is possible and a classic example of what you describe is in modern automobiles that run a common comms CANBUS system with ALL the slaves in your case connected to the same pair of wires communicating with your Master controller.

There are a number of Canbus shields and tutorials on using it to link many controllers.

Google arduino canbus

This will produce many examples and tutorials showing how it works.

Can you tell us your electronics, programming, arduino, hardware experience?

Tom.... :)

Master board sends a message via a serial link
“<openAllFingers,20>” meaning open all of the fingers to 20 degrees
Sub board reads the serial message, parses the command, and controls the arm

See this topic for ideas about receiving and parsing the data on the sub board

EDIT : Whoops, failed to paste the link to Robin’s topic - see below

Have a look at the examples in Serial Input Basics - simple reliable non-blocking ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.

The technique in the 3rd example will be the most reliable. It is what I use for Arduino to Arduino and Arduino to PC communication.

You can send data in a compatible format with code like this (or the equivalent in any other programming language)

Serial.print('<'); // start marker
Serial.print(value1);
Serial.print(','); // comma separator
Serial.print(value2);
Serial.println('>'); // end marker

With a few external components it is possible to arrange 2-way communication between a master and several slave boards using a single serial connection.

…R

jayvin: Would anybody know how to connect multiple boards to each other?

jayvin: Is the even possible?

Yes, this is possible. I use a CAN Buss to connect the Brain to the Bodies.

Thank you all so much for the insight.

You should be able to connect the boards together just using the board's tx/rx/gnd on the boards to common tx/rx/gnd wires. In my tinkering in the past I used a diode with the band side on the board tx pins to limit their effect on the common tx wire.

zoomkat: You should be able to connect the boards together just using the board's tx/rx/gnd on the boards to common tx/rx/gnd wires. In my tinkering in the past I used a diode with the band side on the board tx pins to limit their effect on the common tx wire.

The common Tx wire must go to the Rx of the master and there also needs to be a pullup resistor (5k6 perhaps) between the master Rx and 5v. The idea is that the diodes allow the slaves to pull the common Tx line low but they cannot make it HIGH. Then the resistor provides the necessary HIGH for the master's Rx.

...R

jayvin: Would anybody know how to connect multiple boards to each other? What I want to do is have one board that controls the other boards and tells them which codes to use. So if I had one board for say an arm for a robot, I want the master board to be able to tell the arm board to move the fingers without having the extra code on the master board. Instead the coding for the arm would be on the arm board, but yet the master board would be able to access it and tell the board what to make the arm do. Is the even possible?

It would be very good for you to learn the do many things at once lesson very well so that you can know how much to expect from a controller, can one control a hand? Then that one handles details and reflexes, commands from higher can be more general/abstract allowing simpler command logic.

You can have a master controller with many slave controllers on SPI bus, 512KB/s speed, one slave selected at a time can send data back quickly. Those slaves might be able to master their own SPI buses run on their UARTS.

"The common Tx wire must go to the Rx of the master and there also needs to be a pullup resistor (5k6 perhaps) between the master Rx and 5v."

The mater rx is already held high by its internal pull up resistor (4.88v on my board), so it may be enough to keep the master rx high without an additional resistor.

zoomkat: The mater rx is already held high by its internal pull up resistor (4.88v on my board), so it may be enough to keep the master rx high without an additional resistor.

I have a system with some boards with Atmega 328s and a Mega as the master. When testing with a different Mega I forgot about the need for the external pullup resistor and the system did not work.

...R

"I have a system with some boards with Atmega 328s and a Mega as the master. When testing with a different Mega I forgot about the need for the external pullup resistor and the system did not work."

When I tested I used a uno as the master and a mega as the slave and the setup seemed to work ok. My main concern was if the master rx would still see the input as low with probably ~.7v still on the line. Bottom line probably is that one needs to check the resting state/voltage of the common lines and do some experimenting/trouble shooting if they are not as expected or something does not work.

How many pulled up RX pins can be brought low by a single TX pin?

GoForSmoke: How many pulled up RX pins can be brought low by a single TX pin?

In my design there is only one pulled-up Rx pin - on the Master.

I forgot to mention earlier that it is, of course, essential to arrange things so only one slave tries to talk at any one time. In my system a slave only responds if it receives a message from the master that contains the slave's ID

...R

"How many pulled up RX pins can be brought low by a single TX pin?"

Without actual boards to test with, one might need to know the resistance values (or other mechanisms) that keep the tx/rx pins high and low. I'd suspect that there is a small limit without other gizmos being added. If internal resistors are being used to control the pin high/low status, they may be some what of a voltage divider setup when they are connected. Some experimenting with maybe a pot and a multimeter might find what it takes to bring a pin to a low state. Knowing the particular voltages a pin is determined to be high and low might be also be a clue as to the number of rx pins can be pulled low by a tx pin.