{"id":2061,"date":"2022-08-01T07:33:00","date_gmt":"2022-08-01T12:33:00","guid":{"rendered":"https:\/\/lab.rapternet.us\/?p=2061"},"modified":"2023-03-04T20:51:24","modified_gmt":"2023-03-05T02:51:24","slug":"using-ikea-pm2-5-air-quality-sensors-in-home-assistant","status":"publish","type":"post","link":"https:\/\/lab.rapternet.us\/?p=2061","title":{"rendered":"Using IKEA pm2.5 Air Quality Sensors in Home Assistant"},"content":{"rendered":"\n<p>I&#8217;ve been doing research on making some custom air quality sensors for inside and outside my house. The laser cutter is a main focus point for these as it would be nice to know how it affects air quality (and in the future, maybe activate an air filter based off the sensors readings). When I found out IKEA makes some simple air quality sensors that can be easily hacked using an ESP device, I decided to try it out.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">Hardware<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>IKEA VINDRIKTNING air quality sensor<\/li>\n\n\n\n<li>Wemos D1 Mini (small ESP8266 with a 5v voltage regulator)<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Setup<\/h2>\n\n\n\n<p>I started by adopting the ESP into home assistant and getting it generically setup in ESPHome. Once I had that done, I started wiring it into the air quality sensor. The sensor has 5 copper pads at the top of the circuit board, these are for debugging, and will work great for our ESP to read the sensor data. We want the +5V, Ground, and Rest pads. These will power the ESP8266 as well as provide the data.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1920\" height=\"2560\" src=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/pxl_20220721_2358244869002754581902608117-scaled.jpg\" alt=\"\" class=\"wp-image-2056\" srcset=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/pxl_20220721_2358244869002754581902608117-scaled.jpg 1920w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/pxl_20220721_2358244869002754581902608117-225x300.jpg 225w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/pxl_20220721_2358244869002754581902608117-768x1024.jpg 768w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/pxl_20220721_2358244869002754581902608117-1152x1536.jpg 1152w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/pxl_20220721_2358244869002754581902608117-1536x2048.jpg 1536w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption class=\"wp-element-caption\">Soldering Connections to the Debug Pads<\/figcaption><\/figure>\n\n\n\n<p>I soldered these to the D1 Mini&#8217;s 5v, ground, and D2 pins (GPIO4). I made the wires maybe 4in in length in order to let me open the device without having to disconnect everything. I then hot glued the D1 mini into the case to keep it further out of the airflow inside the device.<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1920\" height=\"2560\" data-id=\"2060\" src=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/pxl_20220721_2358291672358188751876797545-1-scaled.jpg\" alt=\"\" class=\"wp-image-2060\" srcset=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/pxl_20220721_2358291672358188751876797545-1-scaled.jpg 1920w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/pxl_20220721_2358291672358188751876797545-1-225x300.jpg 225w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/pxl_20220721_2358291672358188751876797545-1-768x1024.jpg 768w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/pxl_20220721_2358291672358188751876797545-1-1152x1536.jpg 1152w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/pxl_20220721_2358291672358188751876797545-1-1536x2048.jpg 1536w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption class=\"wp-element-caption\">D2 Mini Mounted in the Case<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"2560\" height=\"1920\" data-id=\"2058\" src=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/PXL_20220721_235833160-scaled.jpg\" alt=\"\" class=\"wp-image-2058\" srcset=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/PXL_20220721_235833160-scaled.jpg 2560w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/PXL_20220721_235833160-300x225.jpg 300w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/PXL_20220721_235833160-1024x768.jpg 1024w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/PXL_20220721_235833160-768x576.jpg 768w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/PXL_20220721_235833160-1536x1152.jpg 1536w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/PXL_20220721_235833160-2048x1536.jpg 2048w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption class=\"wp-element-caption\">Whole Enclosure<\/figcaption><\/figure>\n<\/figure>\n\n\n\n<p>With everything mounted, I closed up the case and powered it on. The D1 mini booted up well and connected to WIFI since I had already configured that. Once it was connected as online in ESPHome, I made the few final updates to its configuration.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"2560\" height=\"1920\" src=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/PXL_20220722_000159244-scaled.jpg\" alt=\"\" class=\"wp-image-2059\" srcset=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/PXL_20220722_000159244-scaled.jpg 2560w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/PXL_20220722_000159244-300x225.jpg 300w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/PXL_20220722_000159244-1024x768.jpg 1024w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/PXL_20220722_000159244-768x576.jpg 768w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/PXL_20220722_000159244-1536x1152.jpg 1536w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2022\/07\/PXL_20220722_000159244-2048x1536.jpg 2048w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption class=\"wp-element-caption\">Closed Back Up<\/figcaption><\/figure>\n\n\n\n<p>The last updates to the ESPHome configuration for it was to setup the sensor reader. I got this configuration from the pull request adding the capabilities to read these types of sensors (link in the resources).<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">uart:\n  rx_pin: GPIO4\n  baud_rate: 9600\n\nsensor:\n  - platform: pm1006\n    pm_2_5:\n      name: \"Particulate Matter &lt;2.5\u00b5m\"<\/pre>\n\n\n\n<p>With that, I let home assistant integrate the device, and everything worked. I now get the data in my home assistant dashboard along with some stats, the history, min, and max data. This works nicely and will be useful to be able to monitor it (especially in pollen season).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Resources<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/community.home-assistant.io\/t\/ikea-vindriktning-air-quality-sensor\/324599\">Home Assistant Forums on the configuration<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/AeroSteveO\/ESP-Projects\/tree\/main\/vindriktning\" data-type=\"URL\" data-id=\"https:\/\/github.com\/AeroSteveO\/ESP-Projects\/tree\/main\/vindriktning\">GitHub Repo with code, details, hardware information<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/esphome\/esphome\/pull\/2038\">EspHome Pull Request to Simplify it all<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been doing research on making some custom air quality sensors for inside and outside my house. The laser cutter is a main focus point for these as it would be nice to know how it affects air quality (and in the future, maybe activate an air filter based off the sensors readings). When I &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/lab.rapternet.us\/?p=2061\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Using IKEA pm2.5 Air Quality Sensors in Home Assistant&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[85,90,74,39,49],"class_list":["post-2061","post","type-post","status-publish","format-standard","hentry","category-how-to","tag-air-sensors","tag-electronics","tag-esphome","tag-home-assistant","tag-smart-home"],"_links":{"self":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/2061","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2061"}],"version-history":[{"count":9,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/2061\/revisions"}],"predecessor-version":[{"id":2988,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/2061\/revisions\/2988"}],"wp:attachment":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2061"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2061"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}