Send Data from one Arduino to Another

Hello,

I would like to send data from arduino A to another arduino B. The arduino A has to send about 5 float values to the arduino B. What would be the most efficient way to do that?

I was thinking about using I2C bus, but I have to mention that each arduino is already connected to a screen using analog A4 and A5 pins with I2C bus. Their loop frequency is around 1Hz because screens use much ressource.

Thank you in advance
Freeman

So that makes I2C not the most obvious option.

I'd say Serial would be the next logical choice.

1 Like

C program is already writing to the Serial Port of Arduino A and bluetooth is used for Arduino B

SoftwareSerial (or one of the better alternatives).
SPI can be another one.

SPI perhaps?

I'm feeling that this is going to be a guessing game where we give options, and you tick them off by saying "doesn't work because..."

So let's do it differently: what's your project about, what is the underlying reason for needing to exchange float values between Arduino's and what kind of circuit is this actually (please show a schematic)?

So ?

Most Arduinos have more than one serial port.

1 Like

I would like to say "a few Arduinos"....

How far apart are the two devices?
Is the data flow unidirectional? That is, A only sends to B.

C program is already writing to the Serial Port of Arduino A and bluetooth is used for Arduino B

Serial would still be my preference.

Arduino A should be able to Tx to both the monitor and Arduino B at the same time over hardware serial.

Arduino B can either receive from A with software serial, or the BT can be changed to software serial, B can receive with hardware serial.

OOPS, forgot about that. @gmfreeman did not mention which Arduino so I assumend ( :frowning: ) Unos

sorry I forgot to mention, it's two Arduino Nano. I didn't know that Arduinos have more than one serial port.
Yes, data flow is unidirectional, from A to B

The Mega has 4 uarts of which one is used for USB. Leonardo, Micro and Nano Every (and there are more) have one serial port but it's not used for the USB so can be used without interfering with the PC communication.

SERIAL!
For the amount of data you want to send serial is an excellent choice!
Plus if you want to debug it you can always use a PC serial port as a sniffer using something uniterm of putty.

PLUS is you want to have more than TWO arduino's (uC) you can loop daisy chain them such:
Atx->Brx->Btx->Crx->Ctx-Arx etc blah.
What you do then is add a device ID to the header of the message eg:
FromA ToC thus when B rx's the message it just ignores it and passes in through.
Then when C Rx's the message it tags an ACK on the end and sends it back to A.
I am planning a multi uC robot and i will use a protocol like this, also if uC are co-located you can run Serial at high speed or like a meteo device i have the Arduino is a back of house 18m meters from PC running it Half Duplex at 9600 Bits Per Second faultlessly.
Opss forgot to mention when you serial this way be mindful of the signal wiring to avoid crosstalk.
I use ribbon { 0V, Tx, Vcc (or 0V), Rx } that way the every other GND SIGNAL avoid getting Tx data back into your Rx.

Have fun imk

Whilst some Arduinos may have only one hardware serial port, you can normally add software serial ports to use GPSs, communicate with other Arduinos etc.

damn guys, that makes a lot of answers! I will try out your suggestions, especially the SoftwareSerial library and will come back afterwards. Thank you a lot :slight_smile:

This sounds really stupid but I think the easiest way would be a wireless connection, regardless of how close together they are.

That said I don't know if delay would be a problem, and I also know the pain of having to buy new parts over and over again.

Room::Elephant - just why would you be using two Arduinos in close proximity? just why? :roll_eyes:

#5

#16

We call it "progress"

:wink:

Though I'm a beginner, I can suggest you to get two 433Mhz RF Modules or the nRF24L01+

I think the nRF modules can give you from upto 1Km Range (duck antenna) or 300m (pcb antenna).

But it all depends on the project you are making and ur budget.

I saw the tutorial on using these modules from here:
https://lastminuteengineers.com/433mhz-rf-wireless-arduino-tutorial/
https://lastminuteengineers.com/nrf24l01-arduino-wireless-communication/

Note: If this links don't open, you can find many tutorials on the web.

"Pro" or "Re"?

Maybe in his project he does require two Arduino to communicate.

For e.g. He might be making a drone and wants to send data from the Transmitter remote to the Reciever drone.