Go Down

Topic: Communication between arduinos over 4 interchangeable pins (Read 1 time) previous topic - next topic

granmicky

Here is what I need to do:
I need to connect 2 arduinos using 4 wires. Easy, right? The tricky part is that they need to communicate despite the way these 4 wires are connected. Let me explain:
4 I/O pins on one arduino will be connected to 4 I/O pins on the other arduino, but the communication MUST be possible even if we interchange the connections.
Is this possible? I could add a 5th wire for common ground but it would actually be best if one of the wires could act as ground (even though it is not known which one). Does it make sense? Do you guys think it can be done?

astrofrostbyte

#1
Mar 15, 2013, 06:18 pm Last Edit: Mar 15, 2013, 06:25 pm by astrofrostbyte Reason: 1
Do you have a "Master-Slave" setup ?, Half or Full-duplex ?,   what is you desired throughput ?
Gear: Arduino- Uno,Due,Ethernet,  OLS, Buspirate, J-Link, TDS1002, Rigol DG1022

Erdin

It all depends on the start condition.
If one Arduino is the master and always switched on as the first one, it is not so hard.
But even if both can be master and switched on and off at any moment, it would still be possible (I think).

Suppose you have RX and TX with SoftwareSerial, http://arduino.cc/en/Reference/SoftwareSerial
The TX can be recognized if some kind of "synchronisation byte" is sent for example 10 times a second.
The RX could be default high (with a weak pull-up) to distinguish it from the ground.
You would need only three wires. After recognition, the SoftwareSerial can set a serial port on those pins.
The ground could be an output pin set to LOW to be some kind of simulated ground. It would need some protection for ground currents, but I think it is possible.

With I2C, I can't figure it out, how to do it.

With SPI should be possible, but harder to implement than the SoftwareSerial.

OneWire protocol. This would be possible. I don't know a lot of it, but it's a single wire and data can travel in both directions.

In the end, I would prefer a real ground (not a simulated ground with a pin) to both Arduinos. And 2 wires for TX and RX.


retrolefty


Here is what I need to do:
I need to connect 2 arduinos using 4 wires. Easy, right? The tricky part is that they need to communicate despite the way these 4 wires are connected. Let me explain:
4 I/O pins on one arduino will be connected to 4 I/O pins on the other arduino, but the communication MUST be possible even if we interchange the connections.
Is this possible? I could add a 5th wire for common ground but it would actually be best if one of the wires could act as ground (even though it is not known which one). Does it make sense? Do you guys think it can be done?


This sounds basically unworkable. The two arduinos must know for sure what pins to use as output pins and which to use as input pins. If they are randomly mixed up then you are likely to have two output pins wired to together effectively causing a short circuit and pin damage.

Can you tell us what you are trying to accomplish rather then how you think it might be accomplished?

Lefty

pylon

Quote
but the communication MUST be possible even if we interchange the connections.


Does that mean any pin can be connected to any pin? If that's true, is it a must that both Arduinos run the same sketch, so they are interchangeable too?

Go Up