LoRaWAN: The Things Network Setup: Difference between revisions

From Elvis Wiki
No edit summary
mNo edit summary
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Summary ==
== Summary ==
 
[[File:TTN2.png|600px|right|thumb|Topology from a LoRaWAN implementation.]]
This documentation focuses on the setup and implementation of the EUIs in the makefile
This documentation focuses on the setup and implementation of the EUIs in the makefile.


== Overview ==
== 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.
[[File:TTN1.png|thumb|Figure 13: Select the left option.]]


== The Things Network Setup ==
== The Things Network Setup ==


To connect the board with TTN, we first need to create an account on TTN:
To connect the board with TTN, we first need to create an account on TTN:
 
=== Registration ===
# Navigate to: https://www.thethingsnetwork.org/
# Navigate to: https://www.thethingsnetwork.org/
# Click on Sign Up or Get Started
# Click on Sign Up or Get Started.
# Select the things network and sandbox option as seen in Figure 13
# Select the things network and sandbox option: [[File:TTN1.png|600px|none|thumb|Select the left option.]]
 
[[File:page-1-figure-13.png|thumb|Figure 13: Select the left option.]]
 
# Create an account and log in.
# Create an account and log in.
# Navigate to the console (Figure 14)
# Navigate to the console: [[File:TTN3.png|600px|none|thumb|Navigate to the console.]]
# Choose the Europe network cluster
# Choose the Europe network cluster.


[[File:page-2-figure-14.png|thumb|Figure 14: Navigate to the console.]]


=== Application Setup ===
Next, we need to set up the application:
Next, we need to set up the application:


# Click on “Create application” (Figure 15)
# Click on “Create application”: [[File:TTN4.png|600px|none|thumb|Create a new application.]]
 
# Choose a unique application ID for the application. Application name, description and Label are optional.
[[File:page-2-figure-15.png|thumb|Figure 15: Create a new application.]]
# Click on "Register end device”.
 
# Select Enter end device specifics manually and select the Frequency plan, LoRaWAN version, and Regional Parameters version: [[File:TTN6.png|600px|none|thumb|Select the correct frequency plan and versions and enter all 0s to the JoinEUI.]]
# Choose a unique application ID for the application. Application name, description and Label are optional (Figure 16)
 
[[File:page-3-figure-16.png|thumb|Figure 16: Create a new application.]]
 
# Click on "Register end device”
# Select Enter end device specifics manually and select the Frequency plan, LoRaWAN version, and Regional Parameters version as seen in Figure 17.
# For the JoinEUI enter all 0s and confirm the settings.
# 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 (Figure 18).
# Now you can generate a DevEUI and AppKey and give the device an End device ID: [[File:TTN7.png|600px|none|thumb|Generate DevEUI, AppKey, and assign an End device ID.]]
# Click on "Register end device”, which should bring you back to the end device overview (Figure 19).
# Click on "Register end device”, which should bring you back to the end device overview: [[File:TTN8.png|600px|none|thumb|Overview of the device.]]
 
[[File:page-4-figure-17.png|thumb|Figure 17: Select the correct frequency plan and versions and enter all 0s to the JoinEUI.]]
 
[[File:page-5-figure-18.png|thumb|Figure 18: Generate DevEUI, AppKey, and assign an End device ID.]]
 
[[File:page-6-figure-19.png|thumb|Figure 19: Overview of the device.]]


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 (Figure 20) and in the application settings (Figure 21) - make sure to set them for Uplink and Downlink.
=== 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.


[[File:page-6-figure-20.png|thumb|Figure 20: Formatter type set to CayenneLPP on the device.]]
[[File:TTN9.png|600px|none|thumb|Formatter type set to CayenneLPP on the device.]]


[[File:page-7-figure-21.png|thumb|Figure 21: Formatter type set to CayenneLPP in the app.]]
[[File:TTN10.png|600px|none|thumb|Formatter type set to CayenneLPP in the app.]]


== Implementation in Makefile ==
== Implementation in Makefile ==
Line 57: Line 42:


# Navigate to <code>/myRIOT/examples/misc/lorawan</code>
# Navigate to <code>/myRIOT/examples/misc/lorawan</code>
# This folder contains a LoRaWAN program
# 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:
# Create a copy of the lorawan directory and rename it to the desired program name using the following command:


Line 64: Line 49:
</syntaxhighlight>
</syntaxhighlight>


In the Makefile, add the lines of code marked in Figure 22. Change the application name on line 2. Next, add the DEVEUI (JoinEUI in TTN), APPEUI, and APPKEY, which we generated in TTN.
In the Makefile, change the application name, and add the DEVEUI (JoinEUI in TTN), APPEUI, and APPKEY, which we generated in TTN.


[[File:page-7-figure-22.png|thumb|Figure 22: The makefile for the project.]]
[[File:TTN11.png|600px|none|thumb|The makefile for the project.]]


== Used Hardware ==
== Used Hardware ==

Latest revision as of 15:26, 17 June 2025

Summary

Topology from a LoRaWAN implementation.

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

  1. Navigate to: https://www.thethingsnetwork.org/
  2. Click on Sign Up or Get Started.
  3. Select the things network and sandbox option:
    Select the left option.
  4. Create an account and log in.
  5. Navigate to the console:
    Navigate to the console.
  6. Choose the Europe network cluster.


Application Setup

Next, we need to set up the application:

  1. Click on “Create application”:
    Create a new application.
  2. Choose a unique application ID for the application. Application name, description and Label are optional.
  3. Click on "Register end device”.
  4. 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.
  5. For the JoinEUI enter all 0s and confirm the settings.
  6. 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.
  7. 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.

Formatter type set to CayenneLPP on the device.
Formatter type set to CayenneLPP in the app.

Implementation in Makefile

Now we can use the program where we read the temperature and humidity, and send the data to TTN.

  1. Navigate to /myRIOT/examples/misc/lorawan
  2. This folder contains a LoRaWAN program.
  3. 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.

The makefile for the project.

Used Hardware

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

References