NOTE: The Zerynth Ecosystem has been updated to Zerynth 2.1.0. The update removes the distinction between “Zerynth Studio” and “Zerynth Studio PRO”. You can read more about it here.

This article follows the tutorial about how to create a LoRa/LoraWAN network programmed in Python using Zerynth and connected to The Things Network.

Starting with the same setup of the previous project, we’ll see how to get and visualize sensor data of LoRa nodes using Zerynth, The Things Network and Matplotlib, a very popular Python plotting library.

You will see how to:

program a LoRa node in Python using Zerynth to get temperature and humidity data;

node in using to get and data; send data to The Things Network, going through a LoRa Gateway;

going through a LoRa Gateway; get data from The Things Network console via MQTT ;

; plot sensor data using Matplotlib.

Required Material

Essentially, we need the same configuration used for the previous project, plus a temperature and humidity sensor:

LoRa Gateway . In this tutorial we’ve used a Link Labs BS-8, an industrial-grade IoT/M2M gateway for use with LoRa networks. It’s capable of supporting thousands of endpoints with 8 simultaneous receive channels.



. In this tutorial we’ve used a Link Labs BS-8, an industrial-grade IoT/M2M gateway for use with LoRa networks. It’s capable of supporting thousands of endpoints with 8 simultaneous receive channels. LoRa end-node . In this tutorial we’ve used we’ve used Flip&Click as MCU board, a LoRa Click and a Temp&Hum Click, that carries ST’s HTS221 temperature and relative humidity sensor.

. In this tutorial we’ve used we’ve used Flip&Click as MCU board, a LoRa Click and a Temp&Hum Click, that carries ST’s HTS221 temperature and relative humidity sensor. Zerynth Studio : our professional IDE that provides a platform for developing your Python or hybrid C/Python code and managing your boards. It includes a compiler, debugger and an editor, alongside tutorials and example projects for an easy learning experience.

: our professional IDE that provides a platform for developing your Python or hybrid C/Python code and managing your boards. It includes a compiler, debugger and an editor, alongside tutorials and example projects for an easy learning experience. TTN (The Things Network) Console: you need to create/register an account entering a username and an email address.

Programming the LoRa Node in Python to get sensor data

After the LoRa Gateway configuration and the LoRa node configuration steps are performed (see the previous project), we’ll be able to program the device to get data from the Temp&Hum Click and to send these values to The Things Network console.

In particular, we have to create a new project on Zerynth Studio and paste this code: