Connecting 2 (or more) Arduinos via serial

Hi guys,

I'm trying to figure out if this is possible:

I want to use a Mega as the brain for a robot and connect 2(or 3) Duemilanove boards via serial.

Basically hook up the Mega's serial ports (0-1, 14-15, 16-17, 18-19) to other Duemilanove's pins 0-1 and talk to them that way.

Before I go out and buy them I'm wondering if this is at all possible?

Thanks,

This is indeed possible. :)

Yes that is possible, just remember that the boards also need to have their grounds connected together.

Why do the grounds need to be connected together?

Why do the grounds need to be connected together?

(I think it is because) This way current can flow between them.

I think of it this way: It is so they have a common reference. It ensures that both nodes know what a digital LOW, and a digital HIGH is, relative to each other.

I'm sure someone will have a greater insight in this. I'm really a software guy.

So essentially I'll need 3 wires going to each Duemilanove (well 4 if i share the 5V)

RX TX GND 5V

Would it work to do that? can I share the 5V between all of them?

I've been working on a similar project where I used 2 arduino's to control different RGB-led circuits and in the end I found it was easier to use I2C. This way you can address the arduino's individually and still just chain them with two wires(A4 and A5) (and ground). Some easy examples can be found in the helppatches for the I2C lib.

K

You could also look into a multi-drop solution like RS485. You could implement MODBUS, SNAP or even your own protocol.

http://gdallaire.net/blog/?p=39

If the “slave” Arduinos aren’t going to use shields, consider using an RBBB or a Mini to save space and a little money. If they are, a Pro or a serial-based board in kit form makes it easy to hook up the TTL-level serial I/O, and saves the cost of the FTDI chip and USB connector.

You may need to buy a gadget to connect some of those boards to a serial or USB port, but, if you’re going to be using several Arduinos that aren’t connected to a PC all the time, the savings of buying only one “PC interface” can be substantial.

Ran