“ESP32 + LoRa” Preparation & Config Parameters

简体中文

Preparation


Installing Library


We provided a ESP32 LoRaWAN library, which migration from the LoRaMac-node library:

https://github.com/HelTecAutomation/ESP32_LoRaWAN

Choose one of the following method to install this library:

  1. download a zip file from GitHub using the “Download ZIP” button and install it using the IDE (“Sketch” -> “Include Library” -> “Add .ZIP Library…”

  2. clone this git repository into your sketchbook/libraries folder.

For more information, see https://www.arduino.cc/en/Guide/Libraries.

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 -- ESP32_LoRaWAN -- OTAA.

../../_images/0118.png

The LoRaWAN relevant parameters are in the .ino file, fix it in the code directly.

../../_images/0213.png

Choose Frequency Band

There are some options in the Arduino Tools menu:

../../_images/0310.png

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.

Note

Print too much messages may cause the system unstable.