New: the AI firewall watches the whole platform and explains each incident in plain words. See how it works

ESP32 driving a RAK3172 over UART: no reply to AT commands, then how to join

ESP32 driving a RAK3172 over UART: no reply to AT commands, then how to join

Solved 4 4

Back again with a new project. The pool plant room is too far from the building Wi-Fi, so I’m trying LoRaWAN. I have a RAK3172 breakout (EU868 version) and an ESP32 DevKit. The plan is the ESP32 reads the sensors and tells the RAK module what to send with AT commands.

Wiring: ESP32 GPIO17 to RAK TX, GPIO16 to RAK RX, 3.3 V and GND shared. Code:

Serial2.begin(9600, SERIAL_8N1, 16, 17);
Serial2.print("AT");
delay(500);
while (Serial2.available()) Serial.write(Serial2.read());

Nothing comes back. Not an error, nothing. I don’t know if the module is dead or I’m doing it wrong. There is a LoRaWAN gateway on our roof that a colleague added to our Hermetry organisation last month, so that side should be ready.

♥ 0

Following, I want to do the same for our kitchen fridges.

QoS 1 and a lot of patience.
♥ 1

I fought the exact same module for our trailers, three things were wrong in my first try and you have all three I think.

The RAK3172 talks 115200 by default, not 9600. AT commands need rn at the end, print("AT") sends nothing the module acts on. And your TX/RX are the right way round in the wiring but swapped in begin(): the third argument is the ESP32’s RX pin, so it must be the pin wired to the module’s TX.

Serial2.begin(115200, SERIAL_8N1, 17, 16);   // RX=17 (to RAK TX), TX=16
Serial2.print("ATrn");                      // expect OK

Then for joining I send this once at startup:

AT+NWM=1                 // LoRaWAN mode
AT+NJM=1                 // OTAA
AT+BAND=4                // EU868
AT+CLASS=A
AT+DEVEUI=AC1F09FFFE0A1B2C
AT+APPEUI=0000000000000000
AT+APPKEY=<32 hex digits>
AT+JOIN=1:0:10:8         // wait for +EVT:JOINED
AT+SEND=2:0B5A01         // port 2, payload as hex

In Hermetry, Devices, New device, LoRaWAN device, OTAA, and put in the same DevEUI, JoinEUI (all zeros is fine) and AppKey, version 1.0.3, class A. The join badge on the device’s LoRaWAN tab goes to Joined when it works. Steps are on Add an OTAA device.

Still waiting for the gateway to reconnect.
Accepted solution♥ 6

Once it joins you’ll see your bytes but no values until you give the profile a codec. Plan your payload layout before you write the firmware.

Timestamps in UTC or it didn't happen.
♥ 1

115200 and the rn were it, I got OK on the first try after changing both. Joined on the second attempt (first one I’d typed the AppKey with a space in it on the module side). Bytes are showing in the frames log. Now reading up on codecs like Owen said.

♥ 1
Viewing 5 posts – 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Join the conversation

Sign in to ask and answer, like helpful posts and mark the reply that solved your problem. Every contribution earns points and levels.

Share