Introduction: AirMo - the Air Quality Monitor!

“I want to talk about the global pandemic that's underway and how we can solve it together. It's a major health challenge and yet just a few people are talking about it. However, it kills seven million people worldwide every year.

It attacks our breath, our health, it undermines our well-being, it affects all of us, every single one of us, it’s all around us and yet because we don't see it, we choose to ignore it.”

(Source :

Did you never ask yourself, why have you often some headache, sore throat, stinging eyes and respiration problems? And why people talk so often about lung cancer?

Our project is developed around the cause of all these problems à Air pollution.

Think about this breathing air above our streets of our cities, of our work spaces, and of our homes. The air quality of everywhere we are can become dangerous if we ignore it.

Now it's time to talk about it and find a way to solve it together.

In this video, (TEDx event – conference)

Romain Lacombe, Head of Innovation and Development of Etalab ( in 2011 to 2014, and now, founder and CEO of Plumes Labs, made an appeal to scientist and start-up to involve on the collect of air quality data, to share it to all for our health. All these data can improve our life, improve our scientists’ research.

Hence, it gives us, my higher education establishment, my team and me, the idea to develop our proper air quality monitor that we call AirMo.

In the following parties, we will present you a tutorial explaining all the development about our AirMo.

We will start with the board and components that we used, then the wireless communication technology, and finally, we will present to how to use the back-end platform, the bridge and the front-end platform (also named light mode)

Step 1: AirMo's Components

- STM32 Nucleo-L476RG

- Rechargeable lithium ion battery

- Solar Plate (sol3W)

- LiPo Rider Pro (106990008)

- Sigfox Module (akene TD1208)

- Grove – « Air Quality » sensor <----- Analog

- Grove – « Light » sensor <----- Analog

- Grove - « Temperature and Humidity » sensor <----- Digital

- Alcohol and gas sensor (MQ-3) <----- Analog

- Large dust particles sensor (GP2Y1010AU0F) <------------ Analog && Digital

- Adapter for dust sensor (DRF0280)

Step 2: Sensors + STM32 Nucleo-L476RG and Mbed Compiler

  1. Begin with mbed compiler ( Online)

    1. First, you have to create an account on the Mbed website: you just need a valid email address
    2. Once you are in the compiler menu, you had to choose the type of development card
    3. Now, you can start editing your project

  2. Test your program

    1. After you write your code or if you want to know how to debug your development card, you can use the UART to put message on your computer :
      ( Note that sometimes your program compile with success , but the card crash because of some code problems)

      - Implement Uart in your main file : Serial serial (USBTX, USBRX);
      - Initialise it with a baud value : serial.baud(9600);
      - Now , once you compiled and flashed your program in the card, you can display messages emmiting by the development card to your computer by adding some display instruction in your code :

      In the computer you can use minicom or screen to read the messages. You can also use putty if you are under windows OS, or also Arduino serial monitor ...
  3. Let's talk about sensors

    The Mbed community is very rich of code examples for many electrical components. Specially if you use Seed products.
    So, the first think to do is to check if some library exists in the Mbed website for your component..

    1. Air Quality sensor

      For the Air Quality sensor , you will find all explanation in

      Then , you can find the libraries in Mbed website.

      Note: this sensor can’t output specific data to describe target gasses’ concentrations quantitatively. But it’s still competent enough to be used in applications that require only qualitative results

    2. Dust sensor

      For the dust sensor, we adapt a sketch written for Arduino after we followed this link:

      After reading this tutorial, you can give a value of dust density in mg/m^3.

    3. Humidity and température sensor

      For this sensors, it's the same than air quality:

      First, check the seed-wiki documentation in

      Then you can import the librairies from Mbed website.

      It's really easy and it works very well

    4. Gas sensor (MQ-3)

      For the MQ-3 gas sensors, we found all the explanation in the seed-wiki documentation:

      So, you had to follow the step to calibrate the sensor before to put the final code.
      Here, you just have to adapt the code from Arduino to Mbed. In this case, it's really simple

Step 3: The LPWAN Protocol : Sigfox Communication

Sigfox is an LPWAN protocol created by a french telecom firm - SIGFOX

It enables remote devices to connect using ultra-narrow band (UNB) technology. Most of these will require only low bandwidth to transfer small amounts of data. Networks are only able to handle approximately 12 bytes per message and at the same time no more than 140 messages per device per day

For many of IOT applications, the traditional cellular phone systems are too complex to allow for very low power operation and too costly to be feasible for many small low-cost nodes...The SIGFOX network and technology is aimed at the low-cost machine to machine application areas where wide area coverage is required

For our project - AirMo, the format of data detected is simple and the amount of data is not so heavy. So we used Sigfox for translating the data detected from sensors to our IOT platform - Actoboard

We will introduce the use of Sigfox in the following steps

Step 4: Sigfox Module and Mbed Compiler

In MBED, as we mentioned before, there are numerous libraries for our components. Because of this, we don't need to write a Sigfox communication protocol by ourselves. What we need is to use functions directly in the Sigfox library to communicate by Sigfox

In this project, we used Akene board which has integrated a sigfox module. And fortunately, there is a library specified for Akene board in MBED. As showed in the picture, we need to change the Serial pins that we used to connect Akene and STM32 NUCLEO board in our project (D5 for TX, D4 for Rx). At the same time, we should use SoftSerial type for _serial port which needs to be modified in "Akene.h".

Finally, in the "main.cpp", we have written a function void sendMessage(capteur_data test) which can be used directly to transferring the data. The type "capteur_data" is a struct type which contains numerous data of sensors.

Step 5: Communication Between Sigfox Module and the Platform Actoboard

Each Sigfox module card has a unique number wrote on the card and a PAC number. To receive the data, you should create an account on the platform Actoboard . You can add a data source with the card number and PAC number.

Then set the data source and decide the data form. The data form decides the type and the size of the data. you should write like: Nom_Variable::Type:Nombre_Bits. In this case, we have 6 value named temperature, humidity, illumination, gas, dust and air. Air and illumination are unsigned integer and has 16 bit. The others are signed integer and have 16 bit.

Step 6: Print the Data on the Platform Actoboard

In the dashboards, add a new dashboard and add some widgets, you can choose the type, data source, data set for each widget. We add the value widgets for each value and a time series widget for all the value so that we can understand the chart of them.

Step 7: Create a Bluemix Account

IBM Bluemix is a cloud platform as a service (PaaS), which means that it allows customers to develop, run and manage applications without the complexity of building and maintaining the whole infrastructure that is normally associated with application development. The reason we are using it is that it offers IoT services – we can easily connect and manage our devices. In addition to that, there are plenty of other services that we can easily connect our applications to, that allows us to quickly develop fairly complex systems.

In order to start building your applications, you have to make an account. Go to and sign up. After you make an account, log in. The first time you log in a window asking you to set up environment should be displayed.

Name your organization (project or team that shares resources, such as apps, databases, and other services) and choose the region ( the geographic region where your organization exists). For region choose US South because some features that we will use support only in that region right now. New organizations can be added later if needed. Now you have to choose space name, dev for example. After setting up your environment, you are ready to use IBM Bluemix. If you go to the Dashboard, in your space you can see all applications you create and also all services, containers and virtual servers you choose to use.

Step 8: Connect Actoboard to Bluemix

In the main dashboard, click Create App. You can see that Bluemix supports several programming languages. We will build our app using Node-Red. It is a visual tool for wiring together hardware devices, APIs, and online services. Let’s build our app firstly and then you will have a better insight in Node-Red. Click on browse boilerplates (containers boilerplates) and choose Node-Red Starter. Enter your app name and click create. After some time, if everything went ok, your app will be running. If you go to the main dashboard, you should see your app listed under applications. If you click on it, you will see app status, available memory, bound services etc. Note that Cloudant Database service is bound to your app by default.

You can access your app by clicking on the link and open Node-Red flow editor.

First, we need an input, we want to choose the received data in Actoboard as input. So back to Actoboard and in the Forwarding URL, enter

In the Node-Red, chose HTTP as input and set the Method as POST and URL as /sigfox. Now we could deal with the data from Actoboard.

Step 9: SMS Notification Service

What if the situation is more urgent, let’s say temperature rises above 40 and we want to send an SMS notification? Fortunately, there is a Twilio node that allows us to do that easily. Twilio is a service that gives developers the possibility to programmatically make and receive phone calls and send and receive text messages using its web service APIs. Twilio's services are accessed over HTTP and are billed based on usage. Go to and sign up. In the console, click on the # to see your number you can send messages from. To use your Twillio account from Node-RED, you will need ACCOUNT SID and AUTH TOKEN.

Chose Twillio as out put and chose to add new twillio-api, then enter you ACCOUNT SID and AUTH TOKEN.

Add a new rule in the switch node that the temperature over 20. Add a function behind switch which will print "Temperature is over 20 degrees!”. So when the temperature is over 20, we will receive a message that "Temperature is over 20 degrees!”.

You can also add a delay node to limit the rate of notification

Then set the others value like temperature.

Step 10: The Node-RED's Platform

Actually, the first platform of visualization that the team chose is not Actoboard, it is But the Sigfox communication parameter is already fixed by our teacher with actoboard, and we have as a constraint to not access to the Sigfox website to make configuration. So the Sigfox communication works only with the Actoboard. However, after configured the Actoboard, we find a solution to transfer Sigfox data to freeboard.

Step 11: The Node-RED's Platform

by the same way to send a message to a mobile phone, we can configure Bluemix node-red, for sending data and showing that information on freeboard.

To do this, you need to install the freeboard package on your Node-RED environment. For that, open the manager palette, go to install panel and search the package which is named “node-red-bluemix-nodes”, then when it is found, click on “install” and “Done”

Step 12: The Node-RED's Platform

After the package is installed, you can find in advanced functions, the function named freeboard, add it to your flow, and renamed it with your own freeboard name, then you can access to your Bluemix freeboard platform by clicking on the word “freeboard” in the info panel. When you open the freeboard window, you will note that it is not accessible. It’s fine, you just need to delete “/red” in the URL address. Then you will be redirected to the freeboard platform of you Bluemix service.

Step 13: Platform

You can add data sources by clicking “add” which is below the “DATASOURCES” title, save your platform by clicking “save freeboard” then “minified”. Note that it is important to bookmark the URL of your platform after saved it. For the design of your platform, you can add blocks by clicking on “add pane”. I think it is very easy, and everyone can find itself how to design the platform, so I will not explain more.

The above image is our freeboard platform look.

Step 14: The Final Result

Here is the video that we made which present you our work!
and there is the zip file which contains all the codes needed for this project.

And here is the link for the public platform of actoboard :

For our freeboard platform, we can't share the link, because it's modifiable for everyone who has the freeboard link.

Step 15: Reference & Bibliography

Microcontroller Contest 2017

Participated in the
Microcontroller Contest 2017

Sensors Contest 2017

Participated in the
Sensors Contest 2017