# UART Communication multiple devices

**URL:** <https://forum.xod.io/t/uart-communication-multiple-devices/5943>\
**Category:** XOD Programming Questions\
**Created:** [March 5, 2022, 7:30pm UTC](https://forum.xod.io/t/uart-communication-multiple-devices/5943 "2022-03-05T19:30:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sc-v](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@sc-v](https://forum.xod.io/u/sc-v)\
**Post date:** [March 5, 2022, 7:30pm UTC](https://forum.xod.io/t/uart-communication-multiple-devices/5943/1 "2022-03-05T19:30:12Z")

</div>

Hi there,  
I have 3 arduino nanos at different locations and want them to communicate to each other via UART. (Soft UART)

I wrote the programs for each comunication between two of them; everything is fine.  
But when I trie put it all thogether, everything compiles, but the communication stops.

Some pics:  
NANO 1:

 ![grafik](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/8/89ce6087dbf3224295942bd949825a442c5f8a18.png)

NANO 2 (middle) with wired up to the other 2:

 ![grafik](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/6/61eca7a27621dd380df8a32d62b0f1e270cc9d21.png)  
 ![grafik](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/2/216f23235560b86c395ea7bd03f6e205ca545e00.png)

NANO 3:

 ![grafik](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/d/d27accc7063c63d876d59c637184ef56ae8e9888.png)

Example with just communication between two:

 ![grafik](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/2/2d051224bc9ce500bda4b49ef64227652711f6c3.png)  
and when add the second soft uart: (with other Ports)  
 ![grafik](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/d/d9cbb0d899d5688b1258179816689c0f77b24123.png)

Thanks to everyone who help 😛

---

<div class="post-metadata">

**Author:** ![xodballxod](https://avatars.discourse-cdn.com/v4/letter/x/f475e1/32.png) [@xodballxod](https://forum.xod.io/u/xodballxod)\
**Post date:** [March 19, 2022, 5:27pm UTC](https://forum.xod.io/t/uart-communication-multiple-devices/5943/2 "2022-03-19T17:27:48Z")

</div>

This forum entry might help

> **[Multiple instances of Softwareserial library](https://forum.arduino.cc/t/multiple-instances-of-softwareserial-library/691218/22)**
>
> @moderator: can you please close and possibly delete this topic? Not helpful at all, unfortunately. Thanks

It is likely a timing issue if using 2 SoftSerials… So, you have to control the program flow with mutex or flip-flop, etc… And maybe stager the 2nd SoftSerial Init by 1 second Delay?

If you need to send the same data to two boards, then you may need to use two SoftSerial nodes from the master… When data is read from Serial, it is generally removed from the physical buss that holds the message. so, 2 boards getting the same message my not work with Serial, ever… You have to send two independent messages, to each board… Unless the message is one byte, then it may work… The issue is where the electrons are stored physically, and how they are cleared from the bus…

I would try first to send two messages from 2 SoftSerial on Nano 1 (going to nothing), see if it can compile, and see if you can capture the message from each one. Though, it looks like you can only send one SoftSerial at a time… Though, you could design a chipSelect type system, and send the message twoice, if it’s the same message… The chipSelect would decide which reciever would respond to the message.

We may need a .listen() node in XOD for SoftSerial

> **[Software serial on nano fails to work with a 2nd software serial port is added?](https://forum.arduino.cc/t/software-serial-on-nano-fails-to-work-with-a-2nd-software-serial-port-is-added/396487/8)**
>
> There's also AltSoftSerial if pins 8 & 9 are free. Ian.

---

<div class="post-metadata">

**Author:** ![sc-v](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@sc-v](https://forum.xod.io/u/sc-v)\
**Post date:** [March 20, 2022, 1:26pm UTC](https://forum.xod.io/t/uart-communication-multiple-devices/5943/3 "2022-03-20T13:26:16Z")

</div>

Hey,  
thanks for your ideas 🙂  
Yes, I’ve to send different messages to different boards.  
With the Delay it didn’t work either… Still same problem.  
It’s just like the second SoftwareSerial Node kind of overwrites the first. Because one of the connections works fine. I checked it like you said. I can recieve the message, but only at one of the connections.

Sadly for the chipSelect type system I’ve no clue how to do that.  
I’m now going around the problem by using one software and one hardware Serial… Not so elegant, but works.

 ![1](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/9/9740b0bf00501e4d7a54704f49457c7bc37fd61b.jpeg)

 ![2](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/8/8e6723035f87dc1ce23b643d2541c0a2c7dc0397.jpeg)

Have a nice day everyone 😃

---

<div class="post-metadata">

**Author:** ![peterli](https://avatars.discourse-cdn.com/v4/letter/p/7feea3/32.png) [@peterli](https://forum.xod.io/u/peterli)\
**Post date:** [March 31, 2022, 3:35pm UTC](https://forum.xod.io/t/uart-communication-multiple-devices/5943/4 "2022-03-31T15:35:23Z")

</div>

Hello, I’m sorry I can’t help you. However, I am very interested in your problem. I will reply in time when I find a solution.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/eb7348baa04192c2ef932d1db54d44f09f8a7888.png) [@system](https://forum.xod.io/u/system)\
**Post date:** [April 30, 2022, 3:36pm UTC](https://forum.xod.io/t/uart-communication-multiple-devices/5943/5 "2022-04-30T15:36:21Z")

</div>

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