pollution measurement header

Dust Measurement Network: Building an IoT Sensor Network

How do you get from a great idea which you believe could have a significant impact to a tangible product? In a recent community project at ERNI, we put ourselves to this task. This is the second article out of a series of four, in which we explain how we built the IoT sensor network. Have a look at article one. The topic was presented at the Google Developers DevFest Switzerland 2018 conference. Watch the talk online.

by Wicher Visser and Dieter Niklaus

In our first article we wrote about the idea of a community of technology experts at ERNI building a dust measurement network. We shaped the idea into a product vision, came up with a minimum viable product (MVP) and organised ourselves into teams in a holacratic structure.

Application Architecture

One of our first goals was to come up with a rough architecture for our dust measurement network. The design needed to support modularity and be broad enough to allow easy extensibility, yet remain minimal enough to fit in the MVP scope and budget.

The architecture had to be as broad as necessary, yet as narrow as possible.

As before, during the product vision workshop, we first went through a discovery phase in which we looked at the full product vision and identified the components and aspects that would be necessary to fulfil the whole scope. These were reduced to their essence during the design phase. We analysed the core architecture of our design and identified those elements that were necessary to fit the scope and budget of the MVP. The architecture had to be as broad as necessary, yet as narrow as possible. We followed the SOLID open/closed principle: the architecture should be open to extension, whilst we should not need to change components when we increase the product scope.

the things network

The dust measurement network consists of an IoT device that measures particulate matter. The device is connected to a cloud service through The Things Network (TTN). The raw measurements are aggregated on our backend with weather data. A prediction service using a model created with Machine Learning generates pollution forecasts. The actual and predicted pollution levels are rendered on a map in the browser.

Hack & Hike Community Event

Each year the ERNI community meets at a Hack & Hike event on a Swiss mountain to work together on a project. Naturally the theme for this year was the dust measurement network. Our colleagues from Slovakia joined the event. A cable car took some of us up the mountain while others enjoyed the challenge of the hike uphill.

hack and hike switzerland 2018

Like any proper ‘hacking’ event, a lot of designing, modelling and programming happened. The days were fun; the nights were short. The weekend was kicked off with a recap and goal definition by the project coordinator. The teams went about their business, coordinating at sync points and when the need arose. Our sleepy bodies and minds were refreshed on a hike around the nearby mountain peak the next morning. The weekend proved to be great for team spirit and productivity.

One of the teams, under the inspirational leadership of Dieter Niklaus, dedicated itself to building the IoT system.

Building the Hardware

The detector hardware is built with a microcontroller (MCU) and a particulate matter (PM) sensor. The detector device also measures the ambient temperature and the relative humidity. All these sensor data is sent to a time series database (InfluxDB) over an IoT network. It is important to choose a low-power radio frequency network, so the detector can be deployed independently and with minimal maintenance. With LoRaWAN we get good network coverage and low power consumption.

building hardware

In order to measure the air quality at any point, we needed a battery powered device with a sensor that is affordable while proven to be accurate enough for our endeavour. Looking at projects with similar purposes (such as luftdaten.info), we learned that Nova’s SDS 011 fit quite well. It has a serial interface and easily connects to a microcontroller UART.

We chose the Adafruit’s Feather M0 LoRa as the MCU (Microcontroller Unit) because this module combines a LiPo (Lithium Polymer) battery charger, a LoRa RFM (radio frequency module) and a decently performant CPU core (ARM Cortex-M0) in a design with low power consumption.

With LoRaWAN we get good network coverage and low power consumption.

Device-specific security keys and configuration data must be kept in a non-volatile memory, so that the data is still available after a device restart. We added FRAM (ferroelectric random-access memory) to the design to cover this requirement.

The following block diagram shows the hardware design overview for the detector device.

hardware design overview

Boxed Detector

The detector device needed to be placed outside and withstand any kind of weather. The housing was required to provide protection against intrusion according to IP44 (avoid foreign solid substances ≥ 1mm and splashing water from entering).

The first housing prototype needed just to enclose the hardware and protect the electronics against impact. Holes were made to provide space for the Micro USB connector that would be plugged into the device in order to charge the battery, to update the latest firmware, to access debug console and to load security key data during device production. Another hole provided the dust measurement air intake of the sensor. The last opening was added to act as the sensor’s air exhaust.

detector device

The detector device needed to be placed outside and withstand any kind of weather.

protoype housing

The prototype housing was designed and 3D printed by a portable 3D printer during the Hack & Hike weekend.

3D printer

The Things Network

The Things Network (TTN) is an open community-driven network that enables its members to deploy their own LoRaWAN-based IoT applications. Its architecture is built on the LoRaWAN standard, which is defined by the LoRa Alliance, of which TTN is also an active member. LoRaWAN is a media access control (MAC) protocol for wide area networks. It is designed to allow low-powered devices to communicate with internet-connected applications over long-range wireless connections. In most cases, LoRaWAN uses LoRa modulation. LoRa modulation is based on Chirp spread-spectrum technology, which makes it work well with channel noise, multipath fading and the Doppler effect, even at low power. The LoRa Radio Frequency link operates in an ISM band (i.e. in Europe between 863 MHz and 870 MHz).

The network topology has 4 components: end notes, gateways, network server, and application server. The following figure illustrates the network topology of The Things Network:

network topology of The Things Network

The end nodes are the “things”. Our detector is such a node. The end nodes can send data packets through the LoRa Radio Frequency uplink channel randomly at any time. The packets are received by the gateways within radio link range. The same packets can be captured by multiple gateways at the same time. The duty cycle with which an end node sends packets shall not exceed 1% to ensure fair radio frequency channel usage.

The Things Network is an open community-driven network that enables its members to deploy their own LoRaWAN-based IoT applications.

The Gateways receive the data packets from the nodes and send them to the TTN Network Server. The more gateways are available near the area where the nodes are located, the better the network coverage will be. If a spot of interest does not support any coverage, any TTN Community member is able to add a gateway. This enables not only the owner of the new gateway to access the network but also adds more TTN coverage for all community members.

The Network Server routes messages from the nodes to the right application. The Application Server provides the bridge to the user’s cloud application. The messages are handled by an MQTT broker, to which the application will be subscribed.

TICK in the Cloud

We chose to use the TICK stack as our cloud application. The TICK stack is a time series platform that is designed to handle metrics and events. It consists of four independent systems that can work in concert with each other.

TICk stack

For our purpose, we used the time series database InfluxDB. It is capable of storing large amounts of time-stamped data coming from our detector though The Things Network. It has a built-in HTTP API to which our TTN gateway connects. It is hosted in a Docker container so that it can be easily deployed in any cloud environment.

With the hardware built and an IoT network able to store data in the cloud, we were ready for the next step. In part 3 of this series, we shall address how we use the sensor data along with other information to predict air quality using machine learning techniques.

This article is the second in a series on how a community of technology enthusiasts developed a dust measurement network to gauge and predict air quality.


Thanks to the following people for helping to make this project a reality: Adrian Beffa, Alain Zoja, Andreas Schöpfer, Angus Long, Barbora Feketeová, Caroline Jakob, Christian Schluep, David Krauer, Esther Studer, Gunther Dobratz, Halina Cardini, Isabelle Rüthemann, Ján Neščivera, Joel Sommer, Marek Linka, Marty Michael, Matej Pivarči, Michael Huber, Michal Dorner, Michel Meyer, Nathan Lauener, Nicolas Friberg, Ondrej Kollár, Reto Zumbühl, Ján Režnák, Simon Matter, Soňa Pochybová, Thomas Kägi, Dieter Niklaus


Read also Dust Measurement Network: Shaping the idea

News from ERNI

In our newsroom, you find all our articles, blogs and series entries in one place.

> Load more

ERNI Schweiz

Casinoplatz 2

3011 Bern

Phone: +41 58 268 12 00

Email: [email protected]

ERNI Suisse

Bâtiment L

Route des Acacias 43

1227 Geneva

Phone: +41 58 268 11 03

Email: [email protected]

ERNI Suisse

Voie du Chariot 3

1003 Lausanne

Phone: +41 58 268 11 03

Email: [email protected]

ERNI Schweiz

Brünigstrasse 18

6005 Lucerne

Phone: +41 58 268 12 00

Email: [email protected]

ERNI Schweiz

Geschäftshaus Airgate

Thurgauerstrasse 40

8050 Zürich

Phone: +41 58 268 12 00

Email: [email protected]

ERNI Deutschland

Trakehner Str. 7-9

60487 Frankfurt am Main

Phone: +49 162 334 77 30

Email: [email protected]

ERNI Deutschland

Design Offices München – Arnulfpark

Luise-Ullrich-Str. 20

80636 München

Phone: +49 162 334 77 30

Email: [email protected]

ERNI Slovakia

Ševčenkova 34

851 01 Bratislava

Phone: +421 2 32 55 37 37

Email: [email protected]

ERNI España

Edificio El Triangle

Plaça Catalunya 1-4, 3º planta, Módulo A y B

08002 Barcelona

Phone: +34 93 667 77 76

Email: [email protected]

ERNI España

Carrer Pallars, 208, Bajos

08005 Barcelona

Phone: +34 93 667 77 76

Email: [email protected]

ERNI España

Calle de Alfonso XII 62

Oficina 3101

28014 Madrid

Phone: +34 901 848 787

Email: [email protected]

ERNI España

Sant Cugat ERNI Office

Plaça Xavier Cugat, 2 EDIF B Planta Baja

08174 Sant Cugat del Vallès

Phone: +34 93 667 77 76

Email: [email protected]

ERNI Romania

Calea Dorobantilor no. 98-100

3rd floor, in Olimpia Business Center

400609 Cluj-Napoca

Phone: +40 744 319 228

Email: [email protected]

ERNI Singapore

7 Straits View

Marina One East Tower #05-01

Singapore 018936

Phone: +65 9161 9863

Email: [email protected]

ERNI Philippines

9th Floor, 500 Shaw Zentrum Building

500 Shaw Boulevard

Mandaluyong City, Philippines 1555

Phone: +63 2 531 59 82

Email: [email protected]