The air we breathe plays a critical role in our overall health and well-being, and the air quality in our homes is just as important as the air outside. Unfortunately, many homes have poor air quality due to various factors such as mould, dust, pet dander, and chemicals from cleaning products. Poor air quality can lead to various health problems, including allergies, asthma, and respiratory infections.

One of the best ways to ensure good air quality in your home is to measure it regularly. This can be done using sensors that detect carbon monoxide, volatile organic compounds (VOCs), and particulate matter. These sensors can be connected to open-source software, such as Home Assistant, which can provide real-time data on the air quality in your home and alert you if it reaches harmful levels.

Using Home Assistant

Home Assistant

Home Assistant is an open-source platform that allows you to automate your home and control various devices using a single interface. It's compatible with a wide range of sensors, including those that measure air quality. Once connected, you can use the software to monitor and track the levels of pollutants in your home over time and even set up notifications to alert you when the air quality drops below a certain level.

In addition to measuring air quality, Home Assistant allows you to control other devices in your home, such as lights, thermostats, and security cameras. This means that you can use the software to monitor the air quality in your home and take steps to improve it. For example, you can set up automation to turn on an air purifier when the levels of pollutants in the air rise above a certain level.

Overall, good air quality is essential for the health and well-being of you and your family. Using open-source software like Home Assistant, you can easily measure and monitor the air quality in your home and take steps to improve it. This will help protect your health and make your home a more comfortable and pleasant place to live.

Air Quality Sensors

To measure our home's air quality, we use a Netatmo Smart Home Weather Station, which measures temperature, humidity, air quality, CO2, and sound levels.

We also use a modified Ikea Vindriktning air quality sensor, which checks the air quality by detecting particles (PM2.5) in your home. Power is supplied via a USB-C connector which powers the sensor, and a light indicates 3 levels of air quality – green (good), yellow (ok), and red (poor).

Adding Wi-Fi to the Ikea Vindriktning

The Ikea Vindriktning sensor is modified using an ESP8266 ESP-12F Mini Module (amazon link), which is flashed with Tasmota and configured to send data to Home Assistant via the MQTT server.

The case of the Vindriktning is held together with four screws; removing these allows you to separate the case. One side of the case contains the control PCB, and the other contains the air sensor.

Case Opened
Case Opened

The PCB is held into the case with three small screws. With these removed, you can disconnect the two connectors which power the LEDs and air quality sensor.

At one end of the PCB are small solder pads marked:

  • ISPDA
  • REST
  • ISPCLK
  • GND
  • +5V
pcb
PCB showing pads where the wires will be soldered.

Wires need to be soldered to the +5V, GND and REST pins. These are connected to the ESP8266 ESP-12F Mini Module on the following Pins:

Vindriktning PCB ESP8266 ESP-12F Mini Module
+5V 5V
GND G
REST D1

With the wires connected, the ESP8266 ESP-12F Mini Module can be fitted into the case allowing access to the USB socket and reset button.

pcb
PCB and ESP module fitted into the case.

Programming the ESP8266 ESP-12F Mini Module with Tasmota

1. Connect the device to your computer via a USB Mini cable, and the module should be detected as a USB-Serial device. Hold the reset button when connecting to your computer to put it into programming mode.

2. In your web browser, go to the web installer at https://tasmota.github.io/install/

3. Select "Tasmota All Sensors" in the dropdown menu under the unofficial section.

4. Select your language and click "Connect".

Select version
Select "Tasmota All Sensors"

5. A popup window will appear with a list of available devices, select the COM port for your module and click connect.

Select device
Select Serial Device

6. You may need to download and install a USB driver if your device is not connected. The links will be shown on the "No port selected" screen.

Error Screen
Error Screen

7. When the device is connected, you will be shown two options: Install Tasmota All Sensors or Logs & Console.

8. Select “Install Tasmota”.

Install Options
Installation Options

9. Tick the box for "Erase device" and then click "Next".

Erase device
Erase device

10. A confirmation dialog will show, and click "Install" to continue.

Confirm Installation
Confirm Installation

11. The installation will start, erasing the device and loading the new firmware.

Installing
Installing

12. When the installation is complete, click "Next"

Installation completed
Installation completed

13. The device will scan for available Wi-Fi networks and show a dialog titled "Configure Wi-Fi" with a menu containing all available Wi-Fi networks and a password field.

Configure Wi-Fi
Configure Wi-Fi

14. Select your Wi-Fi network and enter your password and click "Connect".

Select Wi-Fi
Select Wi-Fi

15. The device will connect to your Wi-Fi network and then show a dialog showing that it is connected. Click "Visit Device".

Wi-Fi Connected
Wi-Fi Connected

16. The browser will connect to the devices IP address, and the main Tasmota web page will load.

17. Click "Configuration" and select "Configure Module".

Tasmota Main Page
Tasmota Main Page

18. Select the Module Type "Generic (18) and click "Save".

19. The device will restart and return you to the main screen.

20. Click "Configuration" and select "Configure Module".

Tasmota Module Type Selection
Tasmota Module Type Selection

21. Select "Vindriktning" on the D1 GPIO5 menu and click "Save".

22. The device will restart and return you to the main screen.

Tasmota Module Configuration
Tasmota Module Configuration

23. Go to "Configure Other", enter a new Device Name and Friendly Name such as "AirQuality" and click "Save"

Tasmota Configure Other
Tasmota Configure Other

24. Next, we configure MQTT, go to "Configure MQTT".

25. Enter the Host, Port, Client, User, Password, Topic and Full Topic.

26. Click Save, and the data will now be sent to your MQTT Server.

Tasmota Configure MQTT
Tasmota Configure MQTT

Setting up Home Assistant for the Vindriktning Sensor

Open your home assistant configuration.yaml file or MQTT sensors file and add the following code to create the new sensor:

  - state_topic: "/home/sensors/airquality/SENSOR"
    value_template: "{{ value_json.VINDRIKTNING['PM2.5'] }}"
    name: "AirQuality"
    unit_of_measurement: "µg/m³"

Restart Home Assistant and add the new sensor to your dashboard.

Vindriktning graph in Home Assistant
Vindriktning graph in Home Assistant

Setting up Home Assistant for Netatmo Smart Home Weather Station

First, you must set up the Netatmo Smart Home Weather Station to connect to your network using the app. Instructions for this are provided with the device.

  1. In Home Assistant, go to "Settings"
  2. Go to "Devices & Services"
  3. Click "+ Add Integration"
  4. In the search box, type "net", and this will filter the list
  5. Select "Netatmo"
  6. The Netatmo website will load asking you to login to give permissions for Home Assistant.
  7. When the permissions have been accepted a new integration will be listed for the weather station.
  8. Add these entries to your dashboard to show the new sensor's data.
Netatmo in Home Assistant
Netatmo Setup

Adding alert notifications

I used a blueprint for Home Assistant from gist.github.com/tvwerkhoven to create a high and low CO2 alert from the Netatmo sensor.

This blueprint can also be used for the Vindriktning sensor to send you alerts or activate ventilation or fans if the air quality is poor.