Connecting 2 Arduino Cards with Serial ports ?

Hi,

I have a question about connecting two Arduino cards. I know it is possible to connect two Arduino cards with I2C technology and I know there is a library called Wire which helps in that case. But I am wondering in case of using an Arduino Mega which does have 3 Serial ports, is it possible to communicate with other Arduino cards(as it is possible to do with devices) ? Lets say we have a Mega connected to PC(serial1) and two other Arduino cards which are connected to the Mega through Serial2 and Serial3 ... Lets say we can use the Arduino two and three to control Robot arms and sensors ... Is it possible and if yes, what are the disadvantages of this model infront of I2C ?

I Googled and found alot about I2C, but almost nothing suggesting that Arduinos can be networked using Serial ... But it is all over that you can interface other Serial hardwares to Arduino through these ports/pins ...

Thx alot in advance,

Shahab.

KE7GKP:
Certainly you can connect the serial output of one Arduino to the serial input of another (and vice-versa). That is the simplest and most straightforward way to connect two Arduinos to talk to each other. And if you have a Mega as the "central authority", then yes, connecting one dedicated serial port to each "slave" Arduino is the most simple and easy way.

Your subject line and most of your question are about 1:1 communication between two Arduinos. However you also mentioned "networking" and that is a different issue. Simple serial communication are 1:1, and not "multi-drop" as you would need for "networking". Indeed I2C can be used to form a simple local network of micro-controllers. But I2C is more difficult to use (software) than simple serial communication. There are also methods like RS-485 that can be used to convert simple serial to a multi-drop network configuration.

Hi,
Thx for the fast reply about Serial communication. I wanted to make sure it is possible as I didn't find something on Internet suggesting that was possible. As you mentioned and it is 100% right, I am working on different methods to make a network of Arduino cards/Micro-Controllers in one system(like a robot with many Arduino cards). I have already read a lot about I2C and know that with I2C, I kind of can have a one Master/Several Slaves communication over SDA(data line). I didn't get what you meant with RS-485. Do you have a link explaining how that works ? I Googled it but didn't catch much out of it.

I am also thinking of Ethernet shields with Arduino cards to connect several cards in a star model. Meaning with a router which assigns permanent addresses for each MAC address of the Ethernet shield. Resulting the address of each Arduino card to stay permanent and unique(Arduino 1, 192.168.0.1, Arduino2, 192,168.0.2 , etc). I am not sure how wise it is, neither how fast does it work, but I think it is worth a try as it allows inter communication of different cards directly, and if there is a need to contact the PC, it can either go through the LAN or the Arduino Mega which is connected to a PC through USB cable. Let me know what you think about this idea ? :slight_smile:

I am also going to write about the wireless methods.
WiFi : Devices like WiFi shield, or Wixel which gives both networking and Programming features. Can they be used in the exact same as I was thinking about Ethernet, being able to connect several Arduinos through a WLAN ?
Bluetooth/Xbee : As these two are based on Serial Communication protocol, is it possible to connect Arduino cards together with them ? Are both technologies just limited to two cards ?

Thanks alot in advance for your help :slight_smile:

Shahab.

I guess we're not sure what your project is?

I am working on my master thesis about Integrated Operation of robots and other intelligent systems for platforms on the sea or any type of structure/system that contains harsh environment for the human workers to operate. This goes mostly on onshore-offshore communication and control, although I am discussing autonom robots, but still being able to control them remotely in sensitive cases is very critical.

Is it a single-piece robot with several Arduinos? If it is all one piece, and presumably not as big as a house, then I just don't see the point of Ethernet or any kind of Wireless scheme?

As a prototype I am working on one climbing robot with 4 Arduino boards on it, which is not big. But As the area of application, the whole area can be as big as a platform, or even communication between offshore - onshore systems. So that's why I am trying to think a little bit out of box(Not sure if i am on the right path now). So this LAN/WLAN thing, is to reach not just intercommunication between arduino boards(which also is the case in my prototype), but even bringing robot control system of every board online(giving me lots of opportunities for trouble shooting, Passive joint investigation, logging moves , etc) ...

Ethernet is A LOT more overhead. It is necessary overhead if you want to talk to others on the Ethernet. But for communicating just between your own Arduino boards, it is VAST overkill, IMHO, an a lot of extra work for no benefit. I wouldn't seriously consider it. But then I am rather lazy.

The various wireless methods are capable of different things: point-to-point, "mesh network" depending on what you buy and how you configure it. But, again, wireless has certain disadvantages, and disadvantages, to be sure.

Well I know I am going to go through a hassle to get this done, but I am thinking about the advantages that such system can give over control of such systems. Meaning remote control systems, monitoring systems and the detailed control in case of emergency.

If you have two networks, consider using two protocols.

That is, don't necessarily use ethernet to control the workings of your robot because the bot has to talk ethernet to the outside world.
You could use serial to talk amongst your arduinos that control your robot and have a central 'brain' that talks ethernet to the rest of the world and then issues commands.

I am working on networking several arduinos through an rs485 layer and some kind of serial protocol. I'm trying to traverse distances over 100' and I don't know how well it will work.

If you want to collaborate or discuss this further, I'm open to brainstorming.
You can email me. My email should be in my profile.

-Mike

If you want to collaborate or discuss this further, I'm open to brainstorming.
You can email me. My email should be in my profile.

I do, and have done.


Rob

Graynomad:

If you want to collaborate or discuss this further, I'm open to brainstorming.
You can email me. My email should be in my profile.

I do, and have done.


Rob

Hey, I'll be glad to cooperate with both of you :slight_smile: