Overview: Hands-On Guide to Setting Up a LoRaWAN470 Gateway and Nodes with M5Stack Devices

This tutorial will show you how to set up a LoRaWAN470 gateway and nodes using the M5 BASIC core and Module LoRa (433MHz) , and communicate with TTN . The firmware is available on Burner , and users can set parameters through Burner.

Hardware Assembly

1.1 Hardware Preparation

Hardware list:
BASIC Host: 3 units (1 gateway, 2 nodes)
Module LoRa (433MHz): 3 units (1 gateway, 2 nodes)
ENV-II Unit: 2 units

Assemble the 433 module, ENV-II Unit, and core host, with two acting as LoRaWAN terminals and one as a LoRaWAN gateway.

  • After assembly:

Note: The Module LoRa (433MHz) needs to connect DIO1 to GPIO34

Firmware Burning and Configuration

2.1 Gateway

2.1.1 Gateway Firmware Burning and Configuration

  1. Open the M5burner application and burn the gateway firmware.

Note: The first time you burn it, you will be prompted to enter M5BurnerNVS for settings.

This will take us to the BurnerNVS setting program by clicking button B.

  1. Open M5Burner to enter the BurnerNVS setting interface for configuration.

Essential parameters to set:
1. WIFI_SSID: WIFI SSID
2. WIFI_PASS: WIFI password
3. Keep other parameters as default.
4. After completing the settings, click the B button on the host to restart the host, completing the gateway firmware configuration.

2.1.2 Registering the Gateway on TTN

  1. First, open TTN ’s official website and register an account.

  2. Note: For illustrations, see our tutorial TTN(The Things Network) .

  3. The gateway's default server is nam1.cloud.thethings.network.

  4. Essential parameters to set:

  5. Gateway ID: human-readable string.

  6. Gateway EUI: The "GW EUI" on the host screen, generated based on the MAC address, ensuring global uniqueness.

  7. Schedule downlink late: Checked for downlink functionality.

  8. Frequency plan: Select China 470-510MHz, FSB11.

  9. Keep other parameters as default, successfully registering the gateway on TTN.

2.2 Nodes

2.2.1 Creating Nodes on TTN

  1. Create an application.

  2. In this application, create two nodes with the network entry type OTAA, obtaining DEVEUI, APPEUI, and APPKEY for each device.

  3. Note: For illustrations, see our tutorial TTN(The Things Network) .

  4. Essential parameters to set:

    1. Frequency plan: Select China 470-510MHz, FSB11.

    2. LoRaWAN version: LoRaWAN Specification 1.0.2.

    3. Regional Parameters version: Choose revision B.

  5. Keep other parameters as default, successfully creating the nodes on TTN.

2.2.2 Node Firmware Burning and Configuration

  • Open the M5burner application and burn the node firmware.

  • Click "info"->"burner setup" to enter the BurnerNVS setting program.

  • Open M5Burner to enter the BurnerNVS setting interface for configuration.

Essential parameters to set:
1. APPEUI: Generated by TTN, can be queried on TTN.
2. DEVEUI: Generated by TTN, can be queried on TTN.
3. APPKEY: Generated by TTN, can be queried on TTN.
4. Keep other parameters as default, completing the node firmware configuration.

Node Communication with TTN

  1. We used the CayeneLPP library to encapsulate information, and the decoding type in TTN needs to be changed to CayeneLPP to see the data uploaded by the nodes.

  2. After completing the above steps, the nodes will collect environmental information through the ENV-II Unit and upload it to TTN every

20 seconds, consistent with the temperature and humidity data displayed on the nodes.

We can add downlink information to the downlink queue on TTN's website, so the node will receive a downlink message after the next Uplink upload, and the data displayed on the node will be consistent with the set data.

Interface and BurnerNVS Parameter Explanation

4.1 Gateway

4.1.1 Gateway Interface

Start page:

From top to bottom:
1. Title bar: LoRaWan470 GW
2. Status light: green flashing during normal operation, yellow during initialization
3. GW EUI: Unique ID for each gateway, generated from the MAC address
4. Freq: Listening frequency and spread factor
5. Uplink: Number of LoRa data packets uploaded by the gateway
6. Downlink: Number of LoRa data packets downloaded by the gateway
7. Recently Node: Most recent communication node address and RSSI
8. Buttons:
1. info: Access information page.
Information page:

4.1.2 Gateway BurnerNVS Parameters

  1. WIFI_SSID: WIFI SSID
  2. WIFI_PASS: WIFI password
  3. Frequency: Gateway's listening frequency, must comply with LoRaWAN protocol, with a spectrum range of 470MHz to 510MHz for LoRaWAN 470.
  4. SF: Spread factor, ranging from 5-0, corresponding to SF7 to SF12.
  5. TTN_SERVER: LoRaWAN server address.
  6. TTN_PORT: LoRaWAN server port.
  7. NTP_SERVER: NTP server address.
  8. TIMEZONE: Time zone.

4.2 Nodes

4.2.1 Node Interface

From top to bottom:

  1. Title bar: LoRaWan470 Node
  2. Status light: green flashing during normal operation, yellow during initialization
  3. CH Nums: Channels and their frequencies
  4. TX Interval: Uplink transmission interval
  5. ENV-II Unit: Status of the ENV-II Unit, green for normal operation, otherwise red, with temperature and humidity displayed on the right.
  6. Buttons:
    1. beep disable indicates the buzzer is off; pressing this button switches to beep enable, where the buzzer will beep once upon receiving a Downlink message.
    2. info: Access information page.
    3. uplink enable indicates Uplink is enabled, with the node uploading messages to TTN every 20 seconds; pressing this button switches to uplink disable.

4.2.2 Node BurnerNVS Parameters

  1. APPEUI & DEVEUI & APPKEY: OTAA networking parameters, generated by TTN.
  2. TX_INTERVAL: Uplink interval time.
  3. CHANNEL0 ~ CHANNEL8: Frequencies for each channel, must comply with LoRaWAN protocol, with a spectrum range of 470MHz to 510MHz for LoRaWAN 470.
  4. SF: Spread factor, ranging from 5-0, corresponding to SF7 to SF12.
  5. POWER: Transmit power, ranging from 0-20, the higher the value, the greater the power.
  6. ABP_ENABLE: ABP networking mode enable. 1 to enable, 0 to disable.
  7. NWKSKEY & APPSKEY & DEVADDR: ABP networking parameters, generated by TTN.
  8. ADR_ENABLE: ADR enable. 1 to enable, 0 to disable.
  9. APP_PORT: Application port, ranging from 1-255.
  10. CONFIRM_MSG: Confirmation message enable. 1 to enable, 0 to disable. If enabled, an ACK will be received after every uplink.

Other Applications

5.1 Entering BurnerNVS Program During Operation

Click "info" -> "burner setup",

5.2 Connecting Nodes to Other Gateways

When needing to connect to other gateways, just modify the frequencies of CHANNEL0 - CHANNEL8.

5.3 Nodes Using ABP Mode for Networking

If needing to use ABP mode for networking, just enable ABP_ENABLE,

Note: On the TTN ABP node management page under General settings -> Network layer -> Advanced MAC settings, change Rx1 delay to 5s, and check the Resets frame counters option.

5.3 Node Registration Using ABP Mode

If we need to use ABP mode for network entry, we simply need to enable ABP_ENABLE,

Note: On the TTN ABP node management page under General settings -> Network layer -> Advanced MAC settings, change Rx1 delay to 5s, and check the Resets frame counters option.

By following these steps, the node can be configured for ABP mode entry, enabling direct communication with the network without the need for OTAA's join procedure. This simplifies the process for devices in static environments or when quick network re-connection is needed without going through the join procedure again.

On This Page