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, 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.

  • 22.11.2023.

    Recognising trends: An insight into regression analysis

    Data plays a very important role in every area of a company. When it comes to data, a distinction is made primarily between operational data and dispositive data. Operational data play an important role, especially in day-to-day business. However, they are not nearly as relevant as dispositive data. This is because these data are collected over a longer period of time and provide an initial insight into the history or the past.

  • 08.11.2023.

    Why do we need digital transformation for medical devices?

    For hospitals, it is not up for discussion as to whether they want to digitalise. The increasing age of the population in western countries and the progressive shortage of medical professionals mean that without digitalisation, the healthcare system will not be able to provide the quality that patients want in the future.

  • 25.10.2023.

    Mastering the challenges of mobile app testing: Strategies for efficient quality assurance

    Discover the unique challenges faced in testing mobile applications and learn how to overcome them effectively. From selecting suitable devices and operating systems to leveraging cloud-based test platforms, test automation and emulators, this article provides seven essential strategies for optimising your mobile app testing process.

  • 11.10.2023.

    Incorporating classical requirements engineering methods in agile software development for a laboratory automation system

    Traditional agile methodologies can sometimes struggle to accommodate the complexity and regulatory requirements of laboratory automation systems, leading to misalignment with stakeholder needs, scope creep, and potential delays. The lack of comprehensive requirements documentation can result in ambiguous expectations and hinder effective communication among cross-functional teams.

  • 27.09.2023.

    Unveiling the power of data: Part III – Navigating challenges and harnessing insights in data-driven projects

    Transforming an idea into a successful machine learning (ML)-based product involves navigating various challenges. In this final part of our series, we delve into two crucial aspects: ensuring 24/7 operation of the product and prioritising user experience (UX).

  • 13.09.2023.

    Exploring Language Models: An overview of LLMs and their practical implementation

    Generative AI models have recently amazed with unprecedented outputs, such as hyper-realistic images, diverse music, coherent texts, and synthetic videos, sparking excitement. Despite this progress, addressing ethical and societal concerns is crucial for responsible and beneficial utilization, guarding against issues like misinformation and manipulation in this AI-powered creative era.

  • 01.09.2023.

    Peter Zuber becomes the new Managing Director of ERNI Switzerland

    ERNI is setting an agenda for growth and innovation with the appointment of Peter Zuber as Managing Director of the Swiss business unit. With his previous experience and expertise, he will further expand the positioning of ERNI Switzerland, as a leading consulting firm for software development and digital innovation.

  • data230.08.2023.

    Unveiling the power of data: Part II – Navigating challenges and harnessing insights in data-driven projects

    The second article from the series on data-driven projects, explores common challenges that arise during their execution. To illustrate these concepts, we will focus on one of ERNI’s latest project called GeoML. This second article focuses on the second part of the GeoML project: Idea2Proof.