LoRaWAN: The Things Network Setup
Summary

This documentation focuses on the setup and implementation of the EUIs in the makefile.
Overview
In this task, we want to connect the STM32 board with The Things Network (TTN). The connection to the TTN happens through a gateway as seen.
The Things Network Setup
To connect the board with TTN, we first need to create an account on TTN:
Registration
- Navigate to: https://www.thethingsnetwork.org/
- Click on Sign Up or Get Started.
- Select the things network and sandbox option:

Select the left option. - Create an account and log in.
- Navigate to the console:

Navigate to the console. - Choose the Europe network cluster.
Application Setup
Next, we need to set up the application:
- Click on “Create application”:

Create a new application. - Choose a unique application ID for the application. Application name, description and Label are optional.
- Click on "Register end device”.
- Select Enter end device specifics manually and select the Frequency plan, LoRaWAN version, and Regional Parameters version:

Select the correct frequency plan and versions and enter all 0s to the JoinEUI. - For the JoinEUI enter all 0s and confirm the settings.
- Now you can generate a DevEUI and AppKey and give the device an End device ID:

Generate DevEUI, AppKey, and assign an End device ID. - Click on "Register end device”, which should bring you back to the end device overview:

Overview of the device.
Payload Formatter
Before we can build the application that is sending the data, we now need to change the payload we want to receive to CayenneLPP so the message is formatted and read correctly. These settings need to be changed in the device settings and in the application settings - make sure to set them for Uplink and Downlink.


Implementation in Makefile
Now we can use the program where we read the temperature and humidity, and send the data to TTN.
- Navigate to
/myRIOT/examples/misc/lorawan - This folder contains a LoRaWAN program.
- Create a copy of the lorawan directory and rename it to the desired program name using the following command:
it-security@host14: cp /myRIOT/examples/misc/lorawan /myRIOT/examples/misc/lorawan-hts221
In the Makefile, change the application name, and add the DEVEUI (JoinEUI in TTN), APPEUI, and APPKEY, which we generated in TTN.

Used Hardware
STM32 LoRa and Sigfox Discovery kit + X-NUCLEO IKSO1A2 expansion board