Quantcast
Channel: Arduino Forum - Latest topics
Viewing all articles
Browse latest Browse all 15374

Serial communication between 2+ arduinos

$
0
0

Hi, I'm currently making a project which involves an Arduino NANO as a remote, and variable number of Arduino megas. I would like to use the built in serial communication (I will not be printing to the serial monitor) to communicate between them. I only want each mega to be connected to at max 2 other megas, and not have every device joined using the same wires such as in I2C communication, so that there is separation between each communication cable.

Here's a simplified schematic of just the communication, using RJ45 keystone jacks

The only data transfer will be a single byte of data at a time, which will be either 1-255 sent from the nano, or 0 sent from any device using Serial and Serial1(except the nano which will only use Serial obviously). If the nano writes a number 1-255 then the first mega will receive it and read it on Serial and send the same number on Serial1, and this repeats until the final mega. If a device receives a 0 on Serial, then it will write 0 on Serial1 and vice versa, except for the nano which will write 0 back to Serial, and the final mega (determined with a switch) which will do the same as the nano. The purpose of sending 0 is to check that every mega is working and connected, as a single disconnected mega will prevent the chain from completing, it's a bit like a pulse being sent in both directions and getting 'bounced' at the ends of the chain.

My question is if using an ethernet cable (unshielded cat6)between each of the megas (or between the nano and first mega) what is the maximum length of ethernet cable I can use? Also, should I put RX and TX on the same twisted pair as in the diagram or different pairs, I was assuming same pair would be better?

7 posts - 5 participants

Read full topic


Viewing all articles
Browse latest Browse all 15374

Trending Articles