LoRA multiple devices communication scheme

I have a project where multiple UART LoRA devices are going to be communicating with each other to relay data.

Does this idea for communications make sense?

  1. All devices have a serial number that is known to every other device. Let's have 3 devices, A/B/C. Device A is connected to a computer, B and C are remote.

  2. When an input is entered on device A (i.e. when a touchscreen button is pushed, or a code is entered into serial monitor) the serial number of device B is broadcast repeatedly with a small delay in between.

  3. If device B receives its own serial number over LoRA, then it writes a single set of sensor data to the serial port to send via LoRA without any serial numbers.

  4. Device A receives a set of sensor data, knows it to be from device A because no other devices are transmitting, and writes to USB serial.

  5. On another input, device A broadcasts the serial number of device C, and the same thing happens.

  6. On yet another input, device A broadcasts the serial numbers of both B and C with a small delay in between. It then writes them to serial with a tab in between data frm B and C, then new line after data from C.

Device B is pre-programmed with the serial numbers of A and C, device C is pre-programmed with the serial numbers of A and B.

My question is: 1. Does this work and 2. Is there a better way of doing this?

If I understand correctly then yes it can work but is complex to update or add devices to as you would need to reprogram all the devices to add/remove more devices.
As your example seems to us A as a gateway device to request and collect results from all other (child) devices then maybe the way to go is to give each child a unique name/number that it responds to and include that name/number in the results being sent back so there is no ambiguity of what device replied with the results.

I use a similar setup with a gateway and several child devices but the children are mostly sleeping and wake to send data every 30 minutes (to save battery life) so the gateway cannot request results and having the unique child name in the data sent to the gateway means I know who sent it.
Your system could work in a similar way but if the children are always powered then they would sit listening for a request specific to them and then reply else ignore the received data.

Thanks for the help. The rigidity of hard coded serial numbers is indeed a major weakness: adding a new device requires reprogramming all devices.

Maybe one way is to have serial numbers be numerical, broadcast the first serial number, then increment the serial number by N. So if you have 3 devices with increment of 1, the gateway broadcasts the serial numbers in sequence i.e. 10000, 10001, 10002 then repeat the loop. If you have 4 devices, it's 10000, 10001, 10002, 10003.

That seems like it's a bit more flexible: I can have an menu on a touchscreen to enter the initial number (10000), increment (1) and total number of devices (N) for the communication unit, and a touchscreen to enter initial number and increment (10000+1, 10000+2, etc) for individual sensors.

Your sleep option is interesting due to the extreme power savings. What limitations do you find with having only 1 way communications?

xyz_summer:
Your sleep option is interesting due to the extreme power savings. What limitations do you find with having only 1 way communications?

I would do the same, I see no particular reason for needing to have two way comms for a sensor application, but you have not really explained why you think this is necessary.

If the sensors just broadcast their reading say every 30mins, then with power savings at the sensor, a set of AA batteries can last 20 years or more.

Your sleep option is interesting due to the extreme power savings. What limitations do you find with having only 1 way communications?

As my devices just report weather data - Temperature, Pressure, Humidity, LUX, Battery level, Packet number & Sensor Name - I have no problems with periodic data reception.
In the early days some of the indoor modules were mains powered (via USB charger) and I used to request readings from them but when I switched to battery modules I made them all behave the same way of sleeping and sending periodic data. Makes life easier as I can put the sensors exactly where they are needed without the need to supply external power. A single 18650 cell lasts about 1 year but as I transmit the VCC of the battery I know when they need charging.

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