This post is also available in: Català (Catalan) Español (Spanish)
Arenys de Munt will have an Internet of Things network promoted by the Town Council after seven sensors were installed on 8 November. Specifically, five indoor CO2 sensors, one outdoor CO2 sensor and one outdoor particle sensor were installed. This municipality has a previously installed antenna to provide coverage for all these new devices.
This will allow the whole population to consult the status of the installed sensors, seeing how pollution levels change in different parts of the municipality. They will be able to see the data from the website of the Sensor and Actuator Platform and, as the gateway is public and open, the whole population will be able to use it for their own devices that work with LoRaWAN.
The XOIC team of femProcomuns has participated in the implementation and in the accompaniment and recommendations for a correct installation. Below we explain the steps we have followed, from the configuration of the sensor to the reception of data and its subsequent visualisation.
What does the start-up consist of?
The start-up consists of several steps:
1. The start-up of each sensor
In the case of CO2 sensors, they are activated by holding down the yellow button for more than three seconds, the LED will flash green five times, it is not necessary to open the box.
For the outdoor CO2 sensors and the particle sensor, first open the sensor with a screwdriver, carefully remove the pcb, then press and hold the black button for 3 seconds.
2. Register the sensor in The Things Stack version 3.
How do we register the sensors in The Tings Stack version 3?
Go to the following link and create a user or login (if you have one).
We create an application as we did in TTN v2, as we can see in the image an ID must be given to the application; optionally, a name and a description can be added.
Next, we register the devices by entering the data that appear on the label of each sensor instead of the 0 that initially exist.
Finally, we create the API key for MQTT to work so that we can retrieve the data from Node-RED. Node-RED is a free software tool developed by IBM that allows physical devices to be connected to the Internet of Things. It provides a browser-based editor that facilitates the connection of flows through the wide range of nodes in the palette that can be deployed at runtime with a single click.
To do this, access the side menu, drop down “Integrations”, click on MQTT and then click on “Generate new API key”.
After this step, a password (JWT) will be generated, it is necessary to save this password before exiting, as a new one will be generated each time, but we want to use the same one.
3. Receive the data from Node-Red and send it to Sentilo.
To retrieve the data from Node-Network it is necessary to follow the following steps.
First, create a mqtt-in with and put the username and the JWT that has been generated when doing the MQTT integration. Next, it is necessary to set v3/[nameMQTTUser]/devices/[device id]/up to be able to subscribe to the uplinks. We connect it to a JSON node “Convert between JSON String & Object”, add a function to get the data and pass it also through base64 and the decoder to get the decrypted data. Finally, we add the nodes to send the data to Sentilo.
4. Retrieve the data from Sentilo.
Sentilo (“Sensor” in Esperanto) is an open source sensor and actuator platform. It allows to locate sensors and actuators by entering coordinates, retrieve the data and display them on a map where they will appear with the location entered.
The last step is to retrieve the data from Sentilo by creating each sensor. The data will be shown on the map with its location and values as we can see in the image.
5. Having this data in Sentilo.
What does it allow us to do?
Well, it allows the local council to take action, if necessary, to improve the quality of the air that the population breathes. In addition, it allows the population to be aware of how is the CO2 they breathe if they have to attend an event in any of the monitored points.
With this initiative, Arenys de Munt Town Council joins the municipalities that have LoRa coverage and organisations, educational centres and companies will also be able to connect their sensors and actuators, as is already being done in other municipalities.