“ESP32 + LoRa” Preparation & Config Parameters
Preparation
Arduino IDE. How to install please click here.
This library must work with Heltec WiFi_Kit_series Arduino development framework. Installation manual please refer to here.
A gateway already connected a LoRa server.
An ESP32 + LoRa (WiFi LoRa 32, Wireless Stick, etc.) node and a high quality USB cable.
In this example, we use HT-M01 Gateway and drive it through Windows® via USB, and use WiFi LoRa 32 (V2) Board to quickly connect to TTN.
Configure Parameters
No matter what LoRa management platform is used, DevEui, AppKey, etc. parameters are must needed. And ensure that it is consistent with the relevant settings on the server.
The following parameters are essential for OTAA mode:
DevEui – Mote device IEEE EUI (big endian), 8 bytes;
AppEui – Application IEEE EUI (big endian), 8 bytes;
AppKey – AES encryption/decryption cipher application key, 16 bytes;
The following parameters are essential for ABP mode:
NwkSKey – AES encryption/decryption cipher network session key, 16 bytes;
AppSKey – AES encryption/decryption cipher application session key, 16 bytes;
DevAddr – Device address on the network (big endian), uint32_t;
Choose an example from menu File -- Examples -- Heltec-Example -- LoRaWAN -- LoRaWAN
.
The LoRaWAN relevant parameters are in the .ino
file, fix it in the code directly.
Choose Frequency Band
There are some options in the Arduino Tools menu:
Board, Upload Speed, CPU Frequency, Core Debug Level, PSRAM
are ESP32 chip’s normal option, just keep default. Special notice the LoRaWan Region
and LoRaWan Debug Level
:
LoRaWan Region – LoRaWAN protocol region definition, strictly follow LoRaWAN™ 1.0.2 Regional Parameters rB;
LoRaWan Debug Level – Messages printed via serial.
None – Default;
Freq – Uplink/downlink frequency;
Freq && DIO – Uplink/downlink frequency and DIO interrupt information;
Freq && DIO && PW – Uplink/downlink frequency, DIO interrupt information and low power status.
LORAWAN_DEVEUI – LoRaWAN Device EUI generate method
CUSTOM – Defined by the user in the DevEui array of the code, 8 bytes;
Generate By ChipID – Generated according to the Chip ID of the chip. Selecting this option will override the setting in the DevEui array in the code.
备注
Print too much messages may cause the system unstable.