In this tutorial section, we will utilize the sensor node designs provided to collect distance data using the connected ultrasonic sensor. We will also record battery voltage data to track the battery voltage level. In Project Muringato, the battery voltage data aided in the scheduling of maintenance sessions by indicating the amount of power available for the sensor node. It also aided in discovering the effectiveness of the solar panel. The data collection exercise will included the following steps:
To establish the network, we will power up a programmed LoRa gateway/concentrator. We will also connect it to the internet and check its activity status on the things network. The gateway to be utilized is a Multitech Conduit LoRa gateway. The Conduit® is the industry’s most configurable, manageable, and scalable LoRa® gateway for industrial IoT applications. Network connectivity choices to your preferred data management platform include carrier approved 4G-LTE, 3G and Ethernet. The Conduit LoRa gateway also include a LoRaWAN® mCard capable of supporting thousands of LoRaWAN certified end nodes. Figure 1 shows the Multitech Conduit Gateway.
Figure 1: Multitech Conduit Gateway
An IoT (Internet of Things) system can be broadly divided into 3 main layers. The first layer is the perception layer which includes sensors and actuators involved in data collection. The second layer is the network layer which is responsible for communication between devices in the system. The network layer includes elements such as gateways and network servers. The last layer is the application layer, where an end user gets to interact with data output.
The network server under the network layer is a crucial component in a deployment scenario. The network server is a central element and is in charge of management of gateways, the authorization of end nodes and the exchange of data (uplink and downlink) between the sensor node and the user application.
The Things Network is a free LoRaWAN network server that is open to all. It has popularized the LoRaWAN technology by offering free services to IoT enthusiasts especially during initial tests before professional deployments.
To register the sensor nodes provided on TTN we are going to follow the simples steps provided below:
The Things Network on the search bar. The first search result you get is thethingsnetwork.org.Figure 2: TTN homepage
Sign Up button (top right) to create a TTN account. Join the Things Network.Figure 3: Sign up options
The Things ID page as shown on Figure 4. If you do not have an ID click on Sign Up for Free Figure 4: Signing up for a TTN ID
Sign Up for Free<, you will be directed to the registration page for you to access all the products on TTNUSERNAME, VALID EMAIL, PASSWORD, and also agree to the Terms and Conditions and Policies by checking the box.Sign up to The Things ID.Figure 5: TTN account created successfully
Back to Login Screen to log into your TTN account, log into your Gmail account and activate the TTN account you have just created using the no-reply email sent to you by TTN.Figure 6: TTN console window after login
To register the sensor nodes on TTN we will start by creating an application. An application on TTN houses the end nodes. To create the africon2023 application follow the short procedure below.
create an applicationcreate application page.application ID. Use the ID provided above (africon2023). The same can apply to application name and descriptioncreate application.Figure 7: TTN application terminal
To register an end device, follow the steps provided below.
africon-2023 application page, click on End Devices on the left side bar.Register end device blue button on the far right.End device Type:
enter end device manuallyEUROPE 863-870MHz (SF9 for RX2 recommended)LoRaWAN specification 1.0.2RP001 Regional Parameters 1.0.2show advanced activation, LoRaWAN class and cluster setting and do the following:
Activation by personalization (ABP)None (Class A only) – defaultuse network’s default MAC settings – defaultskip registration on Join server – defaultProvisioning Information:
DevEUIDevice AddressAppSkeyNwkSKeyEnd –Device ID (africon-water)After registration:
View registered end deviceFigure 8: Registered device terminal
General SettingsBasic LayerNetwork layer: LoRaWAN network-layer settings, behavior and sessionAdvanced MAC Settings panelreset frame counters boxPayload Formatters.formatter type drop down, select CayenneLLP and save the changes.overview pagearduino_code folder Figure 9: Arduino IDE interface
file then Open (Figure 9). Navigate to the downloaded unzipped file and click on the firmware under the arduino_code folder arduino-libraries. Install the CH341SER and the CDM21228 under arduino_hardware_drivers Tools (shown on Figure 9). Under boards select Arduino Nano and under port select the activated port. sketch – included library – Add .ZIP library. You will be prompted to add the zip libraries needed. Navigate to the arduino-libraries folder and select the zip libraries under LoRa-arduino-libraries and add. Repeat this procedure for all the librariesFigure 10: TTN Session keys
sketch and then upload on the Arduino IDE to upload the firmware on the Arduino Nano.Figure 11: Battery connection to the breadboard
live data terminal for the data as shown on Figure 12. analog_in_1 represents the distance measured by the ultrasonic sensor whereas analog_in_2 represents the battery voltage Figure 12: Data on TTN