IKEA Vindriktning with Tasmota and SCD30

I recently reported on my first experience with Home Assistant. The reason for this was that I wanted to collect the data from a suitably modified IKEA Vindriktning air quality sensor. The alternative firmware Tasmota, which can be used on ESP8266 or ESP32-based microcontrollers, serves as the basis for expanding the sensor. In addition, I now use the Sensirion SCD30 to measure the CO2 concentration in the room air, the relative humidity and the temperature.

Components

IKEA Vindriktning

IKEA Vindriktning

With the Vindriktning, IKEA offers a relatively inexpensive air quality sensor (current price EUR 12.99, as of August 14, 2022), which uses a green, yellow or red indicator light to indicate the concentration of particles of the size PM 2.5 in the air. These are fine dust particles with a diameter of 2.5 µm, which are so small that they can penetrate deep into the airways and damage the lungs.

Power is supplied via USB-C, although a power adapter is not included in the scope of delivery. Unfortunately, there is no exact information about the power requirement. In the product instructions, a model with 5 volts and 2 amperes is specified as the suitable power supply unit, which seems to me to be quite a lot. In fact, the device also works without any problems with significantly less power and effectively requires just over 1 watt, to which the necessary fan, which moves the air through the sensor, contributes significantly.

Due to the low price, however, you also have to live with limitations in the validity of the measurement, see also https://www.airgradient.com/open-airgradient/blog/ikea-vindriktning-accuracy/. The sensor used is a Cubic PM1006K (see also specification as PDF). This sensor does not work with a laser but with an LED as the light source and has an accuracy of only ±20 μg/m³ or ± 20%. Furthermore, the PM1006K measures particles with a diameter of 0.3 μm to 10 μm, i.e. the measurement also includes particles that are significantly less harmful than fine dust with 2.5 μm. Better sensors with laser measurement like the Plantower PMS5003 or Sensirion SPS30 have an accuracy of ± 10%. However, such models alone cost 30 to 50 EUR, depending on the seller and model.

Wemos D1 Mini

D1 Mini

Due to its compact shape, the Wemos D1 Mini, which is based on the ESP8266 and can be programmed very easily via USB, is ideal for expanding the IKEA Vindriktning. It is also quite cheap at around 4 EUR. You can get this controller from providers like Berrybase, Reichelt or AZ Delivery.

The power can be supplied with 5 volts via micro USB at the “5V” connection, which is internally regulated by the board to 3.3 volts for the microcontroller. The regulated voltage is also available for other devices via the “3V3” connection.

Important: the reverse way of feeding in 3.3 volts and drawing 5 volts via the “5V” connection is not possible!

The I/O connections of the D1 Mini can be used universally and can be assigned as desired for different sensors in Tasmota.

Sensirion SCD30

Sensirion SCD30

The Sensirion SCD30 is an NDIR sensor (non-dispersive infrared sensor) that measures several values:

  • CO2 concentration in indoor air in the range of 400 ppm to 10000 ppm with an accuracy of 30 ppm.
  • Relative humidity with an accuracy of 3%.
  • Temperature from -40 °C to +70 °C with an accuracy of 0.4 °C.

Due to its properties, this sensor is the most expensive part of the conversion at around 50-70 EUR. Of course, you can also use cheaper variants, such as the MH-Z19. However, this is less accurate and does not offer any measurement of humidity, for which you would then have to install another sensor. The design of the MH-Z19 is also not ideal for installation in the Vindriktning housing.

Important for installation: the side with the sensor openings and printed with “Sensirion” should face inwards into the cavity of the Vindriktning housing, so that a reliable exchange of air is guaranteed.

Tasmota

There is extensive documentation for Tasmota on Github, where you can also get the source code of the software. There is no ready-made image for the D1 Mini with support for all sensors including SCD30 and IKEA Vindriktning, as the available storage space on the D1 Mini is limited and some I2C devices would be mutually exclusive.

There are various ways to create your own version of the firmware from the sources, which are described on the page “Compiling”. Since already using Visual Studio Code with PlatformIO for other projects like AlphaClock, I chose this path.

Modifying the IKEA Vindriktning

The housing of the IKEA Vindriktning is held together with four screws. Once you have removed these, you get to the inner workings, which consists of the controller board with the LEDs and the sensor module with fan. The housing is divided into two chambers: the lower chamber contains a small fan that regularly sucks in air and sends it through the air sensor into the upper chamber, where it rides out again. The cables to the sensor module and the fan are plugged in and can be easily removed.

First a picture of the finished conversion before the final assembly for orientation:

IKEA Vindriktning, modification

Detailed view of the cable connections:

IKEA Vindriktning, modification detail

The controller board is connected to the D1 Mini with three cables as following:

IKEA Vindriktning D1 Mini
5V 5V
GND G
REST D1

In addition, the SCD30 is connected as follows – important, the SCD30 only requires 3.3 volts for power supply:

SCD30 D1 Mini
VIN 3V3
GND G
RX/SDA D3
TX/SCL D4

As an alternative connection for GND you can also use one of the rear soldering points of the USB socket. Do not solder at the front soldering points – there is a risk of solder getting into the socket and making it unusable!

Fan hack

The fan is necessary because the particle sensor needs a regular flow of air in order to be able to measure meaningful values. However, despite IKEA’s statement that the device should not be audible, it is still clearly audible and is regularly switched on and off by the controller.

According to the imprint, the fan works with 5 volts. However, it also works reliably with 3.3 volts and is significantly quieter. Since this voltage is available on the D1 Mini, I connected it permanently like this. I extended the fan cable with my own cables and insulated the soldering points with a piece of shrink tubing. The measured values ​​were not influenced negatively by this. For the sake of completeness, I would like to point out that this modification is purely experimental. It remains to be seen whether the fan will work this way in the long term.

If the fan makes a clearly audible noise after assembly, tapping the case a little helps. It doesn’t seem to be the highest quality model.

Assembly

Important: before putting everything back together you have to create the firmware and transfer it to the D1 Mini via its USB port, as the IKEA Vindriktning’s USB socket is only used for power supply.

It takes some creativity to assemble – I placed the D1 Mini on one side above the air sensor and the CO2 sensor on the opposite side. I then used the black wires that connect the controller board to the air sensor to support the CO2 sensor to keep it from tipping over. The remaining cables are then laid loosely in the cavity and provide additional support for both the D1 Mini and the CO2 sensor. However, there is still enough airflow for the sensors to ensure correct readings.

When assembling, you should make sure that no cables are pinched and that the housing parts can be plugged together easily and without any effort. When assembled, nothing should rattle either, that would be a sign that one of the circuit boards can be moved freely.

Creating the firmware for Tasmota

Please note: until recently there was a bug in Tasmota that the SCD30 was not recognized after switching on because Tasmota did not wait until the SCD30 could be addressed. This bug was fixed on August 14, 2022 (see also the Github issue on this), so make sure to use a version that is up to August 15, 2022 or newer.

TasmoCompiler

The easiest way for a suitable firmware is via TasmoCompiler. Here you have to add to the “Custom Options” for the support of the SCD30 and IKEA Vindriktning:

#define USE_I2C
#define USE_SCD30
#define USE_VINDRIKTNING

The firmware generated in this way can then be downloaded from the web interface and saved locally for the later flash process.

Visual Studio Code

For Visual Studio Code you have to download the source code from Github as a ZIP file or create a local working copy with Git.

The following entries in the tasmota/my_user_config.h file are required in the code so that the firmware is generated to match the ESP8266 and includes support for the SCD30 and IKEA Vindriktning:

#define MODULE ESP8266
#define USE_SCD30
#define USE_VINDRIKTNING

The instructions are usually already there, but commented out. Simply removing the comment is sufficient.

If you cannot or do not want to use Tasmotizer for the WiFi configuration, you must also add the access data to your own WiFi:

#define STA_SSID1 "SSID"
#define STA_PASS1 "Password"

Of course, instead of SSID and password, you enter the data of your own wireless lan.

After making all the adjustments, open PlatformIO in the left sidebar and look for the “Default” section in the Project Tasks and then “General”. A new firmware image is then created by clicking on “Build All”:

Visual Studio Code with PlatformIO and Tasmota

If the build process was successful, you will find the firmware file firmware.bin in the folder build_output/firmware.

Transferring firmware and configuring Tasmota

Preparations

Drivers for the CH340 may be required to connect the D1 Mini via USB. The D1 Mini is then controlled with a serial connection via USB.

The drivers are available here: https://www.wemos.cc/en/latest/ch340_driver.html

Transferring the firmware with Tasmotizer

Tasmotizer is a very convenient tool for transferring firmware. With this you can not only flash the firmware, but also adjust the configuration for the WiFi access, so that you do not have to enter this data in the source code in advance.

Tasmotizer

The COM port to which the D1 Mini is connected is automatically identified. You should still check whether the correct port is displayed.

After selecting the firmware.bin file, click “Tasmotize!” to start the transfer. After the process, you have to disconnect and reconnect the USB connection to the D1 Mini once.

Tasmotizer, transfer status

Tasmotizer, successful confirmation

If Tasmota’s web interface is available, you can use it later to carry out firmware updates and do not have to use the USB connection.

Configuring Tasmota

In the second step you can set the WiFi configuration with “Send config”. If necessary, you can also enter the MQTT settings for the transmission of data to Home Assistant directly here.

Tasmotizer, configuration

After clicking on “Save”, the data is sent to the D1 Mini and this is then automatically restarted. After a short wait of about 10-15 seconds you should also see the current IP address with “Get IP”. You can then access this address with a browser with HTTP and should see the Tasmota interface.

Now click on “Configuration” and make the following settings:

Under “Configure Module” select “Generic (18)” as “Module Type” and click on “Save”. Tasmota will then restart and after a few seconds the web interface should appear again.

Then you call up “Configure Module” again and set the assignment as you previously made the connections:

D3 GPIO0 I2C SDA
D4 GPIO2 I2C SCL
D1 GPIO5 VINDRIKTNING

Tasmota, sensor settings

All other entries remain at “None”. After saving with “Save”, Tasmota will be restarted again. After a few seconds, the web interface should appear including the measured values of the sensors:

Tasmota, status with IKEA Vindriktning and Sensirion SCD30

Protect access to the web interface

If you want to avoid that the web interface is freely accessible, you can also set a password under “Configure Other”. The username is then admin.

Tasmota, setting password for web interface

Adjusting the measured temperature

It can happen that the temperature measured by the SCD30 is a few degrees too high, because the surroundings of the D1 Mini and the air sensor slightly warm up the Vindriktning’s casing.

In this case, you can also use Tasmota to correct it with the TempOffset command followed by the numerical value by which the measured temperature values should be corrected. See also https://tasmota.github.io/docs/Commands/#sensors. Important: The command affects all temperatures that Tasmota transmits. This means that the reported dew point (“SCD30 Dew point”) is then correspondingly lower or higher.

To do this, click on “Consoles” and then “Console” in the web interface. A console now appears with the current messages from the system and an input field where you can enter commands and send them with the Enter key.

In my example, a correction of -4.1 was required because the reported temperature was 4.1 °C higher than the values measured by other thermometers in the same room. The command required for this is then TempOffset -4.1. The value specified in each case overwrites the previous setting, i.e. with TempOffset 0 the temperature is transmitted again without correction.

The change takes effect immediately after the command has been sent and is also saved permanently.

Connection to Home Assistant

The last step is to set up the connection to Home Assistant. Here you can proceed as I have already described in my article on Home Assistant.

As a result, you should see a device in Home Assistant that transmits all data:

Home Assistant, data display of Tasmota with sensor data

Leave a public comment

Your email address will not be published. This is not a contact form! If you want to send me a personal message, use my e-mail address in the imprint.

You can use the following HTML tags in the comment:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>