I am looking for a way to exchange a few bytes of data from one Arduino to two or more additional Arduinos. It's a one way communication and speed is not a problem. 10Hz is fast enough.

Data Collector Arduino: I have one Arduino with SPI and I2C shields which collects and analyzes data from a CAN-BUS in a motorcycle. The CAN-BUS supplies lots of information but I filter it down to few info like which lights are on, intake temperature, motor RPM, which gear.

Light Control Arduino: This Arduino should know which lights are on. Depending on low beam, high beam, indicators, etc. it will control additional lights which are not part of the original bike.

Motor Control Arduino: This Arduino should know the current RPM, gear, etc. and work with that data.

The question is how do I "transfer" the data from the data collector to the other Arduinos? If it would be a little simpler I would connect some digital pins which the data collector would write and the others would read. But there are not enough pins for my needs and why use 10 pins when maybe 2 are enough.

All the Arduinos use SPI and I2C connected devices so I don't think it's a good idea to use SPI or I2C for communication between the Arduios.

I guess Serial communication would work with 2 Arduinos but not with 3 or even more. Maybe I could use multiplexing or something like that?

Maybe I could let the data collector Arduino write data into some kind of shared memory and the other Arduinos could read it?

What do you suggest? I am sure there are simple solutions out there but I didn't find anything. I don't mind any extra ICs.

Before someone suggest to do all in one Arduino: Maybe it would be possible. But I really like to keep the modules (Arduinos) separate and I want to be able to add others later if I want to. Then I only want to change the software of the collector Arduino and don't touch the others.

  • why not do everything with one Arduino? – Juraj May 7 '19 at 3:45

It is possible to send out data from one Arduino to multiple others at once via serial (UART). You simply connect the TX of your master Arduino to the RX of all the slave Arduinos. All receiving Arduinos will get the same data with that. You only need 1 pin (for the connection sender TX to the multiple RX). This is a bit limited to the number of slaves and the speed, but that doesn't seem to be an issue here (since you only have a few).

This is a 1-way communication, since at any line there must not be more than 1 TX (sender). If you have more than 1 TX on a line, you will burn your hardware as soon as both TX send out data simultaneously.

I remember some sites that stated it to be possible to also do multiple sender UART, when you adhere to a protocol and put in some safety hardware (I think they used diodes and current limiting resistors). But that is somewhat out of scope here. If you really need a 2-way communication, you maybe should rethink the whole structure of your solution. As Juraj suggested in his comment, it might then be easier to unite the functions to less Arduinos.

Be sure, that the Arduinos share the same ground. This is needed for any communication, when you don't utilize extra hardware (like an optocoupler).

| improve this answer | |

You can do it simply by addition of extra RX and TX pins by use of library like Software Serial Library. For reference you can go here https://www.arduino.cc/en/Tutorial/TwoPortReceive . By using this library you can increase number of ports in master arduino and you probably can give command to other slave arduino commands through master arduino. In this way each arduino can communicate with each other.

| improve this answer | |
  • That also imposes problems, since you can only listen to 1 SoftwareSerial interface at any time. But for one way communication that is no problem. – chrisl May 7 '19 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.