WIO SX-1262 & Xiao ESP32S3 Kit (test demo)
Here is a test code snip to check your Hardware and get the basics Handled, Runs a test on the parts, Blinks the LED , checks the PushButton and after it passes becomes a LORA beacon , The other Part is an OPEN LORA Receiver.
Same rules apply as above…
Returns RSSI and SNR of beacon and if you press the Button on the transmitter it will change the power level of the beacon. Here are some screen shots of the two units about 18 inches to 2’ apart.
It prints the values(updates) if they change more than .25 dB or .25 dBm the period mean it still matched but RSSI & SNR are the same. You can send any Beacon message and the first one will be passed the rest if matched will be a DOT (.)
Red Arrows are when I pressed the button(power level change)
Sx1262 _Diags & Beacon_Sender;
// REV 5.4a - SX1262 Beacon Sender with TX Power Toggle
// Board: ESP32-S3 with SX1262 LoRa Module
// Sends "Seeed Studio" beacon every 3 seconds
// Button on GPIO 21 toggles power (10 <-> 22 dBm)
// LED on GPIO 48 blinks on each send
#include <RadioLib.h>
SX1262 radio = new Module(41, 39, 42, 40); // NSS, DIO1, RST, BUSY
const char* message = "Seeed Studio"; // just change this to whatever...Beacon message you want //
const int ledPin = 48;
const int buttonPin = 21;
int currentPower = 22;
bool lastButton = HIGH;
void setup() {
Serial.begin(115200);
delay(1000);
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT_PULLUP);
Serial.println(F("// REV 5.4a - SX1262 Beacon Sender with TX Power Toggle"));
Serial.println(F("// Board: ESP32-S3 with SX1262 LoRa Module"));
Serial.print("Initializing SX1262 LoRa radio... ");
if (radio.begin() != RADIOLIB_ERR_NONE) {
Serial.println("FAILED!");
while (true);
}
Serial.println("SUCCESS!");
// Apply standard LoRa settings
radio.setSpreadingFactor(7);
radio.setBandwidth(125.0); // ✅ correct for newer versions
radio.setCodingRate(5);
radio.setOutputPower(currentPower);
Serial.print("TX Power set to ");
Serial.print(currentPower);
Serial.println(" dBm");
}
void loop() {
bool button = digitalRead(buttonPin);
if (button == LOW && lastButton == HIGH) {
// Toggle between 10 and 22 dBm
currentPower = (currentPower == 22) ? 10 : 22;
radio.setOutputPower(currentPower);
Serial.print("TX Power changed to ");
Serial.print(currentPower);
Serial.println(" dBm");
delay(250); // debounce delay
}
lastButton = button;
digitalWrite(ledPin, HIGH);
radio.transmit(message);
digitalWrite(ledPin, LOW);
Serial.print(".");
static int dotCount = 0;
dotCount++;
if (dotCount >= 80) {
Serial.println();
dotCount = 0;
}
delay(3000);
}
Open Receiver; No specific UID/PING checks just prints whats sent.
// REV 5.4e - SX1262 Open Receiver for Beacon Monitoring
// Board: ESP32-S3 with SX1262 LoRa Module
// LED on GPIO 48 blinks on reception
// Prints the beacon message once, then '.' for repeated messages
// Only prints RSSI/SNR if they change by > 0.25 dB
#include <RadioLib.h>
SX1262 radio = new Module(41, 39, 42, 40); // NSS, DIO1, RST, BUSY
const int ledPin = 48;
float lastRSSI = 0;
float lastSNR = 0;
int dotCount = 0;
String lastMessage = "";
void setup() {
Serial.begin(115200);
delay(1000);
pinMode(ledPin, OUTPUT);
Serial.println();
Serial.println(F("// REV 5.4e - SX1262 Open Receiver for Beacon Monitoring"));
Serial.println(F("// Board: ESP32-S3 with SX1262 LoRa Module"));
Serial.print("Initializing SX1262 LoRa radio... ");
if (radio.begin() != RADIOLIB_ERR_NONE) {
Serial.println("FAILED!");
while (true);
}
Serial.println("SUCCESS!");
Serial.println("Listening for LoRa messages...");
radio.setSpreadingFactor(7);
radio.setBandwidth(125.0); // Corrected API
radio.setCodingRate(5);
}
void loop() {
String msg;
int state = radio.receive(msg);
if (state == RADIOLIB_ERR_NONE) {
digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin, LOW);
if (msg != lastMessage) {
Serial.print("\nReceived: ");
Serial.println(msg);
lastMessage = msg;
dotCount = 0; // reset for clean line
} else {
Serial.print(".");
dotCount++;
if (dotCount >= 80) {
Serial.println();
dotCount = 0;
}
}
float rssi = radio.getRSSI();
float snr = radio.getSNR();
if (abs(rssi - lastRSSI) > 0.25 || abs(snr - lastSNR) > 0.25) {
Serial.print(" RSSI: ");
Serial.print(rssi, 2);
Serial.print(" dBm\tSNR: ");
Serial.print(snr, 2);
Serial.println(" dB");
lastRSSI = rssi;
lastSNR = snr;
}
} else if (state == RADIOLIB_ERR_RX_TIMEOUT) {
// no output on timeout
} else {
Serial.print("Receive failed! Code: ");
Serial.println(state);
}
}
The trick with this Module is the DIO1
DIO1 = GPIO 39
— this is the interrupt line from the SX1262 for RX done events in this case You have several conditions, the main ones being Transmit, Receive & timeout, there’s more.
same things apply , keep the ISR’s short and sweet Set flags and return (no Printing) wait for that in other places.
If you want more granular control, you can use:
radio.setPacketReceivedAction(callback); // older versions or custom logic
But the standard setDio1Action()
is sufficient for 95% of cases, especially for PING/PONG, beacon, or open receiver logic.
AMA,
HTH
GL
PJ 
Here is the serial output for clearer view;
// REV 5.4e - SX1262 Open Receiver for Beacon Monitoring
// Board: ESP32-S3 with SX1262 LoRa Module
Initializing SX1262 LoRa radio... SUCCESS!
Listening for LoRa messages...
Received: Seeed Studio
RSSI: -110.00 dBm SNR: 5.25 dB
. RSSI: -110.00 dBm SNR: 6.00 dB
........ RSSI: -109.00 dBm SNR: 6.50 dB
. RSSI: -110.00 dBm SNR: 6.00 dB
... RSSI: -109.00 dBm SNR: 6.00 dB
..... RSSI: -110.00 dBm SNR: 6.00 dB
. RSSI: -109.00 dBm SNR: 6.50 dB
.. RSSI: -107.00 dBm SNR: 7.50 dB
.. RSSI: -109.00 dBm SNR: 6.75 dB
. RSSI: -106.00 dBm SNR: 8.50 dB
................ RSSI: -106.00 dBm SNR: 8.00 dB
. RSSI: -106.00 dBm SNR: 8.50 dB
..... RSSI: -106.00 dBm SNR: 8.00 dB
..... RSSI: -106.00 dBm SNR: 8.50 dB
.............................
.......... RSSI: -107.00 dBm SNR: 7.75 dB
. RSSI: -117.00 dBm SNR: -0.75 dB
. RSSI: -115.00 dBm SNR: 1.00 dB
. RSSI: -115.00 dBm SNR: 1.50 dB
... RSSI: -114.00 dBm SNR: 2.25 dB
. RSSI: -115.00 dBm SNR: 1.25 dB
... RSSI: -114.00 dBm SNR: 1.50 dB
. RSSI: -115.00 dBm SNR: 1.25 dB
........... RSSI: -115.00 dBm SNR: 1.75 dB
.. RSSI: -114.00 dBm SNR: 1.75 dB
. RSSI: -115.00 dBm SNR: 1.50 dB
.............. RSSI: -115.00 dBm SNR: 1.00 dB
... RSSI: -117.00 dBm SNR: -0.75 dB
. RSSI: -117.00 dBm SNR: -1.25 dB
. RSSI: -119.00 dBm SNR: -2.50 dB
. RSSI: -118.00 dBm SNR: -2.25 dB
. RSSI: -118.00 dBm SNR: -1.75 dB
. RSSI: -110.00 dBm SNR: 5.50 dB
. RSSI: -106.00 dBm SNR: 8.50 dB
........... RSSI: -108.00 dBm SNR: 6.75 dB
Beacon Sender;
// REV 5.4a - SX1262 Beacon Sender with TX Power Toggle
// Board: ESP32-S3 with SX1262 LoRa Module
Initializing SX1262 LoRa radio... SUCCESS!
TX Power set to 22 dBm
................................................................................
.............TX Power changed to 10 dBm
..............................................TX Power changed to 22 dBm
.............
If you were to count all the dots it lines up with the Power level changes… Very Cool 
Latest run with stable setup, 10dB 
// REV 5.4e - SX1262 Open Receiver for Beacon Monitoring
// Board: ESP32-S3 with SX1262 LoRa Module
Initializing SX1262 LoRa radio... SUCCESS!
Listening for LoRa messages...
Received: Seeed Studio
RSSI: -106.00 dBm SNR: 8.50 dB
. RSSI: -102.00 dBm SNR: 10.25 dB
........ RSSI: -103.00 dBm SNR: 10.25 dB
. RSSI: -102.00 dBm SNR: 10.25 dB
.. RSSI: -103.00 dBm SNR: 10.50 dB
. RSSI: -103.00 dBm SNR: 10.00 dB
. RSSI: -102.00 dBm SNR: 10.25 dB
. RSSI: -103.00 dBm SNR: 10.25 dB
... RSSI: -102.00 dBm SNR: 10.25 dB
. RSSI: -103.00 dBm SNR: 10.25 dB
.. RSSI: -102.00 dBm SNR: 10.25 dB
. RSSI: -103.00 dBm SNR: 10.25 dB
. RSSI: -102.00 dBm SNR: 10.25 dB
You can always add stuff like 
- Log the data to SD or Serial plotter
- Expand the receiver for multiple beacons
- Trigger events based on signal quality
- Add encryption/auth checks
- Or build a GUI on PC or display!
