Hi, i am a student doing a first time project with LoRaWAN.
I have a LoRaWAN Network Server(LNS) running in docker, a gateway module (WM1302) with a Pi-hat on a rpi-3b and a Wio Grove-e5 Module connected to an Arduino Uno R3.
For a project i’m doing i would like to queue a message in the LNS and receive/read the message on the Arduino end node. I read online that this should be possible to do.
- I have setup the network and connected the devices to it.
- I can send an AT+MSGHEX=“payload” to the LNS and see it in the LoRaWAN frames tab.
- The Arduino end node in configures to Class C and both the RXWIN1 and RXWIN2 are compliant with the EU region.
but when i try to queue a message to the Arduino i don’t read it there in the serial monitor.
for example:
- I queue “48656C6C6F”, confirmed on FPORT 8
- A new TXACK event appears in the event tab with downlinkId:2319993945
- I check the logs on the gateway to see if it is received:
root@chirpstack:~# logread | grep "2319993945"
Tue Feb 4 14:01:38 2025 user.info chirpstack-mqtt-forwarder[3137]: Received downlink command, downlink_id: 2319993945, topic: eu868/gateway/0016c001f1050e73/command/down
Tue Feb 4 14:01:38 2025 user.info chirpstack-mqtt-forwarder[3137]: Sending downlink frame, downlink_id: 2319993945
Tue Feb 4 14:01:38 2025 user.info chirpstack-concentratord-sx1302[2091]: Enqueueing immediate packet, downlink_id: 2319993945, current_counter_us: 3996888924
Tue Feb 4 14:01:38 2025 user.info chirpstack-mqtt-forwarder[3137]: Received ack, items: ["OK"], downlink_id: 2319993945
Tue Feb 4 14:01:38 2025 user.info chirpstack-mqtt-forwarder[3137]: Sending ack event, downlink_id: 2319993945, topic: eu868/gateway/0016c001f1050e73/event/ack
Tue Feb 4 14:01:39 2025 user.info chirpstack-concentratord-sx1302[2091]: Scheduled packet for TX, downlink_id: 2319993945, count_us: 3997888924, freq: 869525000, bw: 125000, mod: LoRa, dr: SF12
i am using this sketch on the Arduino
#include <SoftwareSerial.h>
// Setup SoftwareSerial for the Wio-E5 module.
SoftwareSerial wioSerial(11, 10); // RX, TX
// Timeouts and delays (adjust as needed)
const unsigned long joinTimeout = 15000; // Maximum time (in ms) to wait for join messages
const unsigned long postDoneDelay = 1000; // Delay after "Done" to ensure join confirmation
const unsigned long retryDelay = 2000; // Delay between join attempts
// Forward declarations
String sendATCommandAndWait(String command, unsigned long timeoutMS = 300);
void joinNetwork();
void flushSerial();
void setup() {
Serial.begin(9600); // Monitor Serial
wioSerial.begin(9600); // Wio‑E5 baud rate
delay(1000);
Serial.println("Initializing Wio‑E5...");
// Set log to quiet (optional) and switch to Class C mode.
flushSerial();
sendATCommandAndWait("AT+LOG=LOG", 300);
delay(100);
sendATCommandAndWait("AT+CLASS=C, SAVE", 500);
delay(100);
// Join the network (for OTAA, if needed).
joinNetwork();
delay(1000);
sendATCommandAndWait("AT+CMSGHEX=\"48656C6C6F\"", 1000);
while (wioSerial.available()) {
char c = wioSerial.read();
Serial.write(c); // Directly output the character to the Serial Monitor.
}
//delay(2500);
//Serial.println("Configuration complete. Now listening for downlink messages...");
}
void loop() {
// Instead of reading by line, read character-by-character:
while (wioSerial.available()) {
char c = wioSerial.read();
Serial.write(c); // Directly output the character to the Serial Monitor.
}
// A short delay can help avoid overwhelming the loop.
//delay(5);
}
I’m not sure what i am doing wrong. Feel free to reply if i left out any important information. Hopefully my peers can point me in the right direction. Thanks a lot in advance.