I have read a few posts on using the serial port to send a value from one Arduino to another. I am working on a project in which I would like to have a arduino nano send a value to an arduino uno, rather than have the arduino uno be responsible for obtaining that value. the number would be a decimal number from 0 to 31. I am thinking of a way it would work if I were to just convert the number to a binary on the arduino nano and write high or low to 5 of the arduino uno pins and then read those pins and convert them back to a decimal number on the arduino uno.
My question is, in order to read the pins as high or low, it sounds like they would have to be running off the same power so that they would have common ground in order to complete the circuit and read high.
Is that correct, and if so would it just be a matter of wiring them to the same power supply in series or is there something I am not thinking about that would make this not work.
Using Software Serial only uses 2 pins.
Different power supplies is no problem if the have the same voltage and their GNDs connected.
Your method will work, but it does require a common ground. You will need an extra pin to tell the receiving Arduino that a new value has arrived, so six I/O plus ground.
If using serial, you need just one I/O pin and common ground.
What would be a practical way to get both units to have a common ground. It wouldn't be as easy as placing a jumper between each boards ground pin would it?
Jumper or cable is the same good for those microampere signals.
It wouldn't be as easy as placing a jumper between each boards ground pin would it?
It actually would be that simple.
Rather than use Serial you may wish to consider using I2C - it may actually be easier.
Arduino to Arduino I2C Tutorial
...R
Being the master of I2C is no problem but being the slave, on the bus.... Is that easily achieved? (Not reading the tutorial You linked).
You can also transfer data via I2C automatically (without having to write the functions yourself or copy and paste from a tutorial) using SerialTransfer.h. It's installable via the Arduino IDE's Libraries Manager and comes with many examples
Railroader:
(Not reading the tutorial You linked).
That's some homework in front of you, then.
...R
I'd simply use Serial for a single value, because it's dead simple.
Two wires between the decivices - one to connect the GND Pins, one for sender Tx to receiver Rx. 9600 bps will be fast enough. Receiver can simply do a Serial.write() call to write the value as binary; the receiver picks it up with a Serial.read() call. As it's a value 0-31 it's a single byte, so no worries about start/stop bytes: every single byte is that one value.
mauiman808:
I am working on a project in which I would like to have a Arduino Nano send a value to an Arduino uno, rather than have the Arduino uno be responsible for obtaining that value.
This always begs the question and implies an"XY Problem"; Why not just use the Nano - a more practical device overall - to perform the entire task?
Why two processors...
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.