Arduino to Arduino Communication without using RX/TX

I have two Arduinos Mega, connected as shown below:

An arduino uses two digital ports to signal low or high states, and the other also uses two digital ports, one to trigger the interrupt that reads the remaining port, at raising edge, at frequencies near to 20kHz.

The program works fine, but for instance, when i send ABCDEFGH (the bits were sent), it is received correctly during a period, but after, it starts to show different values, and starts repeating it.

Already tried pull up and down resistors.

ABCDEFGH
ABCDEFGH
ABCDEFGH
ABCDEFGH
ABCDEFGH
ABCDEFGH
⸮⸮⸮Սх⸮⸮⸮ͅ⸮⸮$⸮
⸮⸮⸮Սх⸮⸮⸮ͅ⸮⸮$⸮
⸮⸮⸮Սх⸮⸮⸮ͅ⸮⸮$⸮
⸮⸮⸮Սх⸮⸮⸮ͅ⸮⸮$⸮
⸮⸮⸮Սх⸮⸮⸮ͅ⸮⸮$⸮
⸮⸮⸮Սх⸮⸮⸮ͅ⸮⸮$⸮
⸮⸮⸮Սх⸮⸮⸮ͅ⸮⸮$⸮
⸮⸮⸮Սх⸮⸮⸮ͅ⸮⸮$⸮
⸮⸮⸮Սх⸮⸮⸮ͅ⸮⸮$⸮
⸮⸮⸮⸮⸮ c+⸮ Ir
⸮⸮⸮⸮e⸮ c+⸮ Ir
⸮⸮⸮⸮e⸮ c+⸮ Ir
⸮⸮⸮⸮e⸮ c+⸮ Ir
⸮⸮⸮⸮e⸮ c+⸮ Ir
⸮⸮⸮⸮e⸮ c+⸮ Ir
⸮⸮⸮⸮e⸮ c+⸮ Ir
⸮⸮⸮⸮e⸮ c+⸮ Ir
⸮⸮⸮⸮e⸮ c+⸮ Ir
⸮⸮⸮⸮e⸮ c+⸮ Ir
⸮⸮⸮⸮e⸮ c+⸮ Ir
⸮⸮⸮⸮e⸮ c+⸮ Ir
⸮⸮⸮⸮e⸮ c+⸮ Ir
⸮⸮⸮⸮e⸮ c+⸮ Ir
⸮⸮⸮⸮e⸮ c+⸮ Ir
⸮⸮⸮⸮e⸮ c+⸮ Ir
⸮⸮⸮⸮e⸮ cU6⸮⸮
6G'W7F&⸮V6⸮⸮
6G'W7F&⸮V6⸮⸮
6G'W7F&⸮V6⸮⸮
6G'W7F&⸮V6⸮⸮

I believe that the problem is related to the hardware (noise?), rather than the software, if necessary i can post some code

You will get "noise" if the input pins are floating. Do you have pullup resistors or have the input pins as input-pullup?
Paul

Your Fritzie does not show the boards ground pins are connected together. Should be.

Paul_KD7HB:
You will get "noise" if the input pins are floating. Do you have pullup resistors or have the input pins as input-pullup?
Paul

Your Fritzie does not show the boards ground pins are connected together. Should be.

Thanks for the answer, yes, i tried, it appears to be that the solution would be connect the ground of both arduino together, but would like to know if there is an alternative to it.

No. The grounds must be connected.

There is this funny thing about digital devices they have a specified voltage range but they do not give the reference point. Unless it is given it is assumed to be ground. Example: uni1 A sends a 5V (measured to its ground), unit B gets the signal and references it to his ground, what does it get, they are different reference points. What if its ground B is 4 volts above unit A or even worse it is constantly changing because of noise. That should help you understand why the grounds must be connected. If they cannot, then you have to provide an appropriate isolation device or circuit.

"would like to know if there is an alternative"

Bluetooth?

What's the hang-up with not wanting to connect the GNDs anyway?

Actually there is an alternative that allows not connecting the grounds. Optoisolators. But that does complicate the circuit.

Whenever one of the pins happens to be at zero, it acts as "ground" for the other when it's high. And the opposite whenever that occurs.
Paul

Whenever one of the pins happens to be at zero, it acts as "ground" for the other when it's high. And the opposite whenever that occurs.

RS232 PINOUTS

RS232 cables include GND in the minimum wire configuration, (TX,RX,GND)
We haven't seen any code yet.
I would suggest adding the common ground and posting the code.

Actually there is an alternative that allows not connecting the grounds. Optoisolators. But that does complicate the circuit.

I can't see anything about a circuit with two MCUs wired directly like that that would suggest there is any desire
or need for isolation.
More than likely, they just didn't know they need the ground.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.