Example for LoRa Communication-One-to-Many Communication
Last revision 2026/01/24
This article provides a detailed example of implementing LoRa's 'Single Transmit, Multiple Receive' communication mode, including hardware and software setup, wiring diagrams, and sample code for successful data transmission.
There are two types of one-to-many communication modes for nodes:
- Single Transmit, Multiple Receive Mode: One node sends data, and multiple nodes receive simultaneously.
- Single Receive, Multiple Transmit Mode: One node receives data, and multiple nodes transmit simultaneously.
This example demonstrates the first type, Single Transmit, Multiple Receive Mode: Node with address 1 is set as the transmitter, and nodes with address 2 and 3 are set as receivers, realizing the "one-to-many" communication scenario.
Hardware Preparation
- FireBeetle 2 ESP32-E (SKU: DFR0654) ×2
- Gravity: LoRaWAN Node Module(US915)(DFR1115-915) ×2
- Gravity: DHT11 Temperature and Humidity Sensor (SKU: DFR0067) ×1
- PH2.0-4P Cable ×2
- PH2.0-3P Cable ×1
- USB Data Cable ×2
Software Preparation
- Download Arduino IDE: Click to Download Arduino IDE
- Install SDK: Visit the FireBeetle 2 ESP32-E WIKI page for SDK installation instructions
- Download and install the DFRobot_DHT11
- Download Arduino Library: Click to download DFRobot_LWNode Library and refer to the guide: How to Install a Library?
Wiring Diagram
Here, UART communication is used.
- Transmitter:

- Receiver (The connection method for both the first and second groups is as follows):

Sample Code
Transmitter Program: Set node address to 1, send temperature and humidity sensor data to node with address 2.
#include <DFRobot_LWNode.h>
#include <dht11.h>
dht11 DHT;
#define DHT11_PIN 4
#define FREQ 914900000
DFRobot_LWNode_UART node(1); // Set node address to 1
void setup( void ) {
Serial.begin(115200);
Serial1.begin(9600, SERIAL_8N1, /*rx =*/D6, /*tx =*/D7);
delay(5000);
node.begin(/*communication UART*/&Serial1,/*debug UART*/&Serial);
const uint32_t config[] = {FREQ, DBM22, 125000, 12}; // Configure LoRa communication parameters
while(!node.setFreq(config[0]) ||
!node.setEIRP(config[1]) ||
!node.setBW(config[2]) ||
!node.setSF(config[3]) ||
!node.start()) {
Serial.println("LoRa init failed, retrying...");
delay(2000);
}
}
void loop( void ){
DHT.read(DHT11_PIN); // Get data from DHT11 temperature and humidity sensor
Serial.print(DHT.humidity,1);
Serial.print(",\t");
Serial.println(DHT.temperature,1);
String DHT11_DATE=String(DHT.humidity)+"%"+" "+String(DHT.temperature) + "℃";
delay(2000);
node.sendPacket(2, DHT11_DATE); // Send temperature and humidity data to node with address 2
node.sleep(5000);
}
The first and second groups of receivers both use the following program (note: set different serial ports): set the node address to 2 to receive data from the node with address 1.
#include <DFRobot_LWNode.h>
#define FREQ 914900000
DFRobot_LWNode_UART node(2); // Set node address to 2
void rxCBFunc(uint8_t from, void *buffer, uint16_t size, int8_t rssi, int8_t snr){
char *p = (char *)buffer;
Serial.print("recv from: ");
Serial.println(from, HEX);
Serial.print("recv data: ");
for(uint8_t i = 0; i < size; i++){
Serial.print(p[i]);
}
Serial.println();
Serial.print("rssi=");Serial.println(rssi);
Serial.print("snr=");Serial.println(snr);
}
void setup( void ){
Serial.begin(115200);
Serial1.begin(9600, SERIAL_8N1, /*rx =*/D6, /*tx =*/D7);
delay(5000);
node.begin(/*communication UART*/&Serial1,/*debug UART*/&Serial);
const uint32_t config[] = {FREQ, DBM22, 125000, 12}; // Configure LoRa communication parameters
while(!node.setFreq(config[0]) ||
!node.setEIRP(config[1]) ||
!node.setBW(config[2]) ||
!node.setSF(config[3]) ||
!node.start()) {
Serial.println("LoRa init failed, retrying...");
delay(2000);
}
node.setRxCB(rxCBFunc);
}
void loop( void ){
node.sleep(5000);
}
Results
Serial output from the transmitter:

Serial output from the first group of receivers:

Serial output from the second group of receivers:

Was this article helpful?
