title tutorial

This sensor connects to your home or office WiFi, and automatically uploads a measurement every five minutes. You will need to plug it into a power socket. The node is based on the Wemos microcontroller and costs around Euro 30. You can also order a readily assembled and programmed version here.

A printable version of this tutorial is available. We also have a tutorial for the hackAIR home v1 sensor (based on Arduino).


What you need



  • Soldering iron + soldering tin (from ca. 20 EUR)
  • Poster putty
  • Computer

For general soldering instructions, check out this tutorial: Introduction to soldering.

wemos (2)

Assemble the sensor

Step 1: Solder headers to your microcontroller

Solder the short headers to the Wemos microcontroller.

In order to keep the header stable during soldering use some poster putty (see red arrow)

putty under Wemos to make soldering easier

Your finished board should look like this:

wemos (4)

Step 2: Solder headers to the humidity sensors

Solder the long headers to the humidity sensor shield

Use poster putty again, it really helps!


Your finished humidity sensor shield should look like this:

Sensor with headers

Step 3: Stack the shields

Stack the shield over the Wemos and check alignment. The white dots on both the Wemos board and the humidity sensor need to be on the same side.

Check that all pins line up and everything is aligned. If everything is OK then plug it in (push it down as white arrow indicates).

wemos (7)

Your finished Wemos shield pair should look like this:


In order to check that you put the shield in the correct orientation there is an easy way: White dots. At the Wemos board as well as at the humidity sensor shield you are going to find a white dot in one of the corners. The white dots from Wemos board and sensor shield must be in the same side (just like the picture on the right)


Step 4: Connect the cables

Connect the sensor with four M/F jumper wires as follows. The picture shows the connections of the female side to the SDS011 sensor.

wemos (10)
Sensor Wemos
5V 5V

Install the software

Step 1: Preparations and downloads

Download the Arduino IDE software and install it on your computer.


Register on the hackAIR platform (if you have not done that already).

Go to your user profile on the platform Tab “Sensors” click on “add a new sensor”.


Fill in the information for your new sensor, including location details.


Save the information that you have provided. Now you go back to your profile, go to the tab “My sensors”. Click on the arrow in the bottom right corner. This takes you to your sensor profile. Here you see the access key. Copy the access key into a document on your computer. You need it later.

If you want to send your sensor data to OpenSenseMap as well, you also need to register your sensor there:

  • Go to https://opensensemap.org and create an account (→ Register)

  • Register your sensor ( → New SenseBox),  select hackAIR as the sensor type and take note of your senseBox ID and senseBox access token.

access key 2

Step 2: Arduino set up

Now open the Arduino software to set it up to work with your sensor.

Arduino 1

1. Add a board manager. Go to Arduino Preferences

Arduino preferences

Add the following link to Additional Boards Manager URLs:


Additional Boards Manager (1)

Go to Tools Board Boards Manager… and select LOLIN(WEMOS) D1 W2 & mini


2. Install libraries

Click on Sketch Include Library Manage Libraries…

We need to install the following four additional libraries:

  • WiFiManager by tzapu
  • DHT sensor library by Adafruit
  • Adafruit unified sensor library by Adafruit
  • hackAIR by Thanasis Georgiou

If you are installing the advanced version of the hackAIR software (e.g. to connect to OpenSenseMap), you also need the following libraries:

    • Adafruit_MQTT by Adafruit

    • ArduinoJson by Benoit Blanchon (Attention! Use version 5.13.2, not version 6)

    • ESP8266 InfluxDb by Tobias Schürg



3. Connect Wemos

Connect the Wemos sensor to your computer with the USB cable.

Select the correct board type by going to Tools Board Arduino Wemos D1 R2 & mini


Select the correct port by going to Tools Port [name of the port]

On Windows: If more than one port is shown, you can find the correct one in your computer’s Device Manager.

On Mac: you’ll first need to download USB2Serial drivers. Once that is done, choose something like “wchusbserial”.


4. Upload software to Wemos

To install the original version (without OpenSenseMap support), go to File Examples hackAIR Wemos


This is the window that opens – it contains the software that needs to be uploaded to your Wemos sensor


Scroll down to Line 28: #define AUTHORIZATION “AUTHORIZATION TOKEN”

Replace the words “AUTHORIZATION TOKEN” in the quotation marks with your sensor access key, but keep the quotation marks.

In Line 34, replace the DHT11 with DHT22.

If you are installing the advanced version (with OpenSenseMap support), you need to download the hackAIR sensor software from https://github.com/hackair-project/hackair-v2-advanced and open it.


Now you are ready to upload the software. To do so, just click on the upload button (the arrow that points to the right).


5. Connect the sensor to the network

Now you are ready to use your sensor. Disconnect the Wemos from the computer, and reconnect it with the sensor. When you power it up, it will create a temporary WiFi network.

With your laptop or phone, connect to the WiFi network ESP-wemos. Go to and configure the WiFi by entering the details of your home WiFi (SSID and password).

If you have installed the advanced software version, you will also be asked for your hackAIR access key and your OpenSenseMap credentials (senseBox ID and senseBox access token).

Once set up correctly, the temporary network will disappear and the sensor starts measuring.

Screen Shot 2018-05-01 at 15.21.21

Measure air quality

Once your sensor is up and running, you can read its measurements on the platform:

  • Browse to the https://platform.hackair.eu and login with your account
  • Visit your profile and select your sensor area
  • By selecting each sensor you will be able to see your measurements.

If you have also set up your sensor to send to OpenSenseMap, your data will show up there, too.


If your sensor does not show up on the platform, you can check if the sensor is working with the Arduino software:

1. Connect your sensor to your computer

2. Select the right port

3. Open Tools > Serial Monitor

4. You should see:

  • a row of numbers appearing
  • the message “connected”
  • a line with: {“reading”:{“PM2.5_AirPollutantValue”:”X”,”PM10_AirPollutantValue”:”Y”},”battery”:”Z”,”tamper”:”0″,”error”:”0″}

5. Check your internet connection, and the SSID and password, if “connected” does not appear

6. Check your soldering and connections, if the line “{“reading”:{etc.” doesn’t appear