ESP32 controlando un RAK3172 por UART: sin respuesta a los comandos AT, y cómo unirse
Traducido del English por IA ·
De nuevo con un proyecto nuevo. La sala de la planta de la piscina está demasiado lejos del Wi-Fi del edificio, así que estoy probando LoRaWAN. Tengo una placa breakout RAK3172 (versión EU868) y un ESP32 DevKit. El plan es que el ESP32 lea los sensores y le indique al módulo RAK qué enviar mediante comandos AT.Cableado: ESP32 GPIO17 a RAK TX, GPIO16 a RAK RX, 3.3 V y GND compartidos. Código:
Serial2.begin(9600, SERIAL_8N1, 16, 17);
Serial2.print("AT");
delay(500);
while (Serial2.available()) Serial.write(Serial2.read());
No vuelve nada. Ni un error, nada. No sé si el módulo está muerto o si lo estoy haciendo mal. Hay una pasarela LoRaWAN en nuestro tejado que un compañero añadió a nuestra organización Hermetry el mes pasado, así que esa parte debería estar lista.
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.
Traducido del English por IA ·
A continuación, quiero hacer lo mismo para los frigoríficos de nuestra cocina.
Following, I want to do the same for our kitchen fridges.
Traducido del English por IA ·
Tuve exactamente el mismo módulo para nuestros remolques, tres cosas estaban mal en mi primer intento y creo que ustedes tienen las tres.El RAK3172 usa 115200 por defecto, no 9600. Los comandos AT necesitan rn al final, print("AT") no envía nada que el módulo pueda procesar. Y el cableado de TX/RX está bien, pero están intercambiados en begin(): el tercer argumento es el pin RX del ESP32, así que debe ser el pin conectado al TX del módulo.
Serial2.begin(115200, SERIAL_8N1, 17, 16); // RX=17 (to RAK TX), TX=16
Serial2.print("ATrn"); // expect OK
Para unirse, envío esto una vez al arrancar:
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
En Hermetry, vaya a Devices, New device, LoRaWAN device, OTAA e introduzca el mismo DevEUI, JoinEUI (todo ceros está bien) y AppKey, versión 1.0.3, clase A. La insignia de unión en la pestaña LoRaWAN del dispositivo cambia a Joined cuando funciona. Los pasos están en Añadir un dispositivo OTAA.
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.
Traducido del English por IA ·
Una vez que se una, verá sus bytes pero no valores hasta que asigne un códec al perfil. Planifique la estructura de su payload antes de escribir el firmware.
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.
Traducido del English por IA ·
115200 y el rn eran el problema; tras cambiar ambos, recibí OK al primer intento. Me uní en el segundo intento (en el primero había escrito el AppKey en el módulo con un espacio). Los bytes aparecen en el registro de tramas. Ahora estoy leyendo sobre codecs, como dijo Owen.
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.
- Debes estar registrado para responder a este debate.
Únete a la conversación
Inicia sesión para preguntar y responder, dar me gusta a las publicaciones útiles y marcar la respuesta que resolvió tu problema. Cada aportación suma puntos y niveles.

