{"id":20316139,"url":"https://github.com/lupyuen/ikea_air_quality_sensor","last_synced_at":"2026-05-05T16:05:42.171Z","repository":{"id":87766775,"uuid":"455033369","full_name":"lupyuen/ikea_air_quality_sensor","owner":"lupyuen","description":"IKEA VINDRIKTNING Air Quality Sensor connected to LoRaWAN and The Things Network with Apache NuttX OS","archived":false,"fork":false,"pushed_at":"2022-02-09T03:41:41.000Z","size":117,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-14T12:53:46.768Z","etag":null,"topics":["bl602","bl604","grafana","ikea","iot","lorawan","nuttx","prometheus","riscv32","thethingsnetwork","vindriktning"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lupyuen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["lupyuen"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["paypal.me/lupyuen"]}},"created_at":"2022-02-03T04:49:39.000Z","updated_at":"2022-02-10T09:09:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"a3f4ba36-241b-47a3-860d-8dfe2e22ec59","html_url":"https://github.com/lupyuen/ikea_air_quality_sensor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lupyuen%2Fikea_air_quality_sensor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lupyuen%2Fikea_air_quality_sensor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lupyuen%2Fikea_air_quality_sensor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lupyuen%2Fikea_air_quality_sensor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lupyuen","download_url":"https://codeload.github.com/lupyuen/ikea_air_quality_sensor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241818902,"owners_count":20025210,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bl602","bl604","grafana","ikea","iot","lorawan","nuttx","prometheus","riscv32","thethingsnetwork","vindriktning"],"created_at":"2024-11-14T18:24:35.958Z","updated_at":"2026-05-05T16:05:42.127Z","avatar_url":"https://github.com/lupyuen.png","language":"C","funding_links":["https://github.com/sponsors/lupyuen","paypal.me/lupyuen"],"categories":[],"sub_categories":[],"readme":"# IKEA VINDRIKTNING Air Quality Sensor connected to LoRaWAN and The Things Network with Apache NuttX OS\n\nRead the article...\n\n-   [\"Connect IKEA Air Quality Sensor to Apache NuttX OS\"](https://lupyuen.github.io/articles/ikea)\n\nLet's transmit the PM 2.5 Sensor Data from IKEA VINDRIKTNING Air Quality Sensor to The Things Network (via LoRaWAN)...\n\n-   We'll transmit the data with the IKEA Sensor connected to PineDio Stack BL604 running Apache NuttX OS\n\n-   We'll visualise the Sensor Data with Prometheus and Grafana\n\nI found the VINDRIKTNING sensor at my local IKEA Store (IKEA Tampines Singapore), in the Lighting Section, near the Air Purifiers.\n\n(Wow IKEA has Air Purifiers now)\n\n[Watch the IKEA Sensor on YouTube](https://youtu.be/wyXb3aSPet4)\n\n# Install App\n\nTo add this repo to your NuttX project...\n\n```bash\n## TODO: Change this to the path of our \"incubator-nuttx-apps/examples\" folder\npushd nuttx/apps/examples\ngit submodule add https://github.com/lupyuen/ikea_air_quality_sensor\npopd\n```\n\nThen update the NuttX Build Config...\n\n```bash\n## TODO: Change this to the path of our \"incubator-nuttx\" folder\ncd nuttx/nuttx\n\n## Preserve the Build Config\ncp .config ../config\n\n## Erase the Build Config and Kconfig files\nmake distclean\n\n## For BL602: Configure the build for BL602\n./tools/configure.sh bl602evb:nsh\n\n## For ESP32: Configure the build for ESP32.\n## TODO: Change \"esp32-devkitc\" to our ESP32 board.\n./tools/configure.sh esp32-devkitc:nsh\n\n## Restore the Build Config\ncp ../config .config\n\n## Edit the Build Config\nmake menuconfig \n```\n\nIn menuconfig, enable the IKEA Air Quality Sensor App under \"Application Configuration\" → \"Examples\".\n\n# Configure Apache NuttX OS\n\nWe configure the UART Port on Apache NuttX OS for the IKEA Sensor...\n\n```bash\nmake menuconfig\n```\n\nEnable UART1:\n- Select \"System Type → BL602 Peripheral Support\"\n- Check \"UART1\"\n\nSet to 9600 bps:\n- Select \"Device Drivers → Serial Driver Support → UART1 Configuration\"\n- Set \"BAUD rate\" to 9600\n\nEnable `cat`:\n- Select \"Application Configuration → NSH Library → Disable Individual commands\"\n- Uncheck \"Disable cat\"\n\nBuild and flash NuttX OS to PineDio Stack BL604.\n\nIKEA Sensor is now connected to NuttX OS at `/dev/ttyS1`\n\n# Solder UART Port on IKEA Sensor\n\nWe expose the UART Port on IKEA Sensor by soldering these pads...\n\n| UART Pin | IKEA Sensor | Wire Colour\n|:---|:--:|:---\n| UART Tx | REST | Blue\n| GND | GND | Black\n\n[See the soldering steps](https://twitter.com/MisterTechBlog/status/1489506811321282565?t=uW3yDgeLLXhf4x3wjmC2HA\u0026s=19)\n\n[(More details)](https://style.oversubstance.net/2021/08/diy-use-an-ikea-vindriktning-air-quality-sensor-in-home-assistant-with-esphome/)\n\n# Connect to PineDio Stack BL604\n\nTo transmit the PM 2.5 readings to The Things Network via LoRaWAN, we connect the IKEA Sensor to [PineDio Stack BL604](https://lupyuen.github.io/articles/pinedio)...\n\n| Function | GPIO | PineDio Stack | IKEA Sensor | Wire Colour\n| :---: | :---: | :---: | :---: | :---:\n| RX | GPIO 3 | 14 | REST | Blue\n| TX | GPIO 4 | 13 | Unused |\n| GND | GND | 20 | GND | Black\n\nConnect USB Ports of IKEA Sensor and PineDio Stack BL604 to the same computer. Remember: Only One Power Source!\n\nPineDio Stack BL604 has a onboard Semtech SX1262 LoRa Transceiver, so it talks to LoRaWAN and The Things Network.\n\n[(More about LoRaWAN On PineDio Stack)](https://lupyuen.github.io/articles/lorawan3)\n\n# Output Log\n\nRun the following command to test the IKEA Sensor on NuttX OS...\n\n```text\nnsh\u003e ikea_air_quality_sensor\n16  11  0b  00  00  00  17  00  00  02  ff  00  00  00  21  02  00  00  0b  88\nGot PM2.5 Concentration: 23 µg/m³\n16  11  0b  00  00  00  17  00  00  02  ff  00  00  00  21  02  00  00  0b  88\nGot PM2.5 Concentration: 23 µg/m³\n16  11  0b  00  00  00  18  00  00  03  04  00  00  00  22  02  00  00  0b  80\nGot PM2.5 Concentration: 24 µg/m³\n16  11  0b  00  00  00  18  00  00  03  04  00  00  00  22  02  00  00  0b  80\nGot PM2.5 Concentration: 24 µg/m³\n16  11  0b  00  00  00  18  00  00  03  04  00  00  00  22  02  00  00  0b  80\nGot PM2.5 Concentration: 24 µg/m³\n16  11  0b  00  00  00  18  00  00  03  03  00  00  00  22  02  00  00  0b  81\nGot PM2.5 Concentration: 24 µg/m³\n16  11  0b  00  00  00  18  00  00  03  02  00  00  00  22  02  00  00  0b  82\nGot PM2.5 Concentration: 24 µg/m³\n16  11  0b  00  00  00  18  00  00  03  02  00  00  00  22  02  00  00  0b  82\nGot PM2.5 Concentration: 24 µg/m³\n16  11  0b  00  00  00  18  00  00  03  02  00  00  00  22  02  00  00  0b  82\nGot PM2.5 Concentration: 24 µg/m³\n16  11  0b  00  00  00  18  00  00  03  04  00  00  00  22  02  00  00  0b  80\nGot PM2.5 Concentration: 24 µg/m³\n16  11  0b  00  00  00  18  00  00  03  04  00  00  00  22  02  00  00  0b  80\nGot PM2.5 Concentration: 24 µg/m³\n16  11  0b  00  00  00  18  00  00  03  03  00  00  00  22  02  00  00  0b  81\nGot PM2.5 Concentration: 24 µg/m³\n16  11  0b  00  00  00  18  00  00  03  03  00  00  00  22  02  00  00  0b  81\nGot PM2.5 Concentration: 24 µg/m³\n16  11  0b  00  00  00  18  00  00  03  02  00  00  00  22  02  00  00  0b  82\nGot PM2.5 Concentration: 24 µg/m³\n16  11  0b  00  00  00  17  00  00  03  01  00  00  00  21  02  00  00  0b  85\nGot PM2.5 Concentration: 23 µg/m³\n16  11  0b  00  00  00  17  00  00  03  00  00  00  00  21  02  00  00  0b  86\nGot PM2.5 Concentration: 23 µg/m³\n```\n\n[Watch the demo on YouTube](https://youtu.be/dUHlG67pB3M)\n\n# Test with Bus Pirate\n\nBefore testing with Apache NuttX OS, we sniffed the IKEA Sensor's UART Port with Bus Pirate. Connect Bus Pirate to IKEA Sensor as follows...\n\n| Bus Pirate | IKEA Sensor | Wire Colour\n|:---|:--:|:---\n| Data In (MISO) | REST | Blue\n| GND | GND | Black\n\nConnect USB Ports of IKEA Sensor and Bus Pirate to the same computer. Remember: Only One Power Source!\n\nEnter these Bus Pirate commands to capture the UART output from IKEA Sensor (9600 bps, 8 bits, no parity, 1 stop bit)...\n\n```text\nHiZ\u003em\n1. HiZ\n2. 1-WIRE\n3. UART\n4. I2C\n5. SPI\n6. 2WIRE\n7. 3WIRE\n8. KEYB\n9. LCD\n10. PIC\n11. DIO\nx. exit(without change)\n\n(1)\u003e3\nSet serial port speed: (bps)\n 1. 300\n 2. 1200\n 3. 2400\n 4. 4800\n 5. 9600\n 6. 19200\n 7. 38400\n 8. 57600\n 9. 115200\n10. Input Custom BAUD\n11. Auto-Baud Detection (Activity Required)\n\n(1)\u003e5\nData bits and parity:\n 1. 8, NONE *default \n 2. 8, EVEN \n 3. 8, ODD \n 4. 9, NONE\n(1)\u003e\nStop bits:\n 1. 1 *default\n 2. 2\n(1)\u003e\nReceive polarity:\n 1. Idle 1 *default\n 2. Idle 0\n(1)\u003e\nSelect output type:\n 1. Open drain (H=Hi-Z, L=GND)\n 2. Normal (H=3.3V, L=GND)\n\n(1)\u003e\nClutch disengaged!!!\nTo finish setup, start up the power supplies with command 'W'\n\nReady\nUART\u003eW\nPOWER SUPPLIES ON\nClutch engaged!!!\n```\n\n[Watch the demo on YouTube](https://youtu.be/QOJF6hAhFv4)\n\nSee below for the ASCII and Binary Logs.\n\n[(More about Bus Pirate interfacing with UART)](http://dangerousprototypes.com/docs/UART)\n\n## ASCII Log\n\nASCII Log of UART Output from IKEA Sensor...\n\n[Watch the demo on YouTube](https://youtu.be/QOJF6hAhFv4)\n\n```text\nUART\u003e(2)\nRaw UART input\nAny key to exit\n\n\u003c@:\n   \u003cB:\n\u001b[6C:;8\n\u001b[9C:;8\n\u001b[12C9:7 \n\u001b[16C997!\n\u001b[20C987\"\n\u001b[24C876%\n\u001b[28C876%\n\u001b[32C876%\n\u001b[36C866\u0026\n\u001b[40C856'\n\u001b[44C745*\n\u001b[48C745*\n\u001b[52C745*\n\u001b[56C745*\n\u001b[60C735+\n\u001b[64C614/\n\u001b[68C614/\n\u001b[72C614/\n\u001b[76C614/\n\u001b[79C\n\u001b[37;80H 624.\n\u001b[4C624.\n\u001b[8C624.\n\u001b[12C614/\n\u001b[16C614/\n\u001b[20C614/\n\u001b[24C6040\n\u001b[28C6040\n\u001b[32C5/33\n\u001b[36C5.34\n\u001b[40C4,28\n\u001b[44C4,28\n\u001b[48C5-35\n\u001b[52C5.34\n\u001b[56C5.34\n\u001b[60C5-35\n\u001b[64C4,28\n\u001b[68C2%0C\n\u001b[72C2%0C\n\u001b[76C2\u00260B\n\u001b[79C\n\u001b[37;80H 2'0A\n\u001b[4C3)1=\n\u001b[8C3*1\u003c\n\u001b[12C4+29\n```\n\n[(See the complete log)](https://gist.github.com/lupyuen/f40454dda8e3d7f279fb6ef721add465)\n\n## Binary Log\n\nBinary Log of UART Output from IKEA Sensor...\n\n```text\nUART\u003e{\nUART LIVE DISPLAY, } TO STOP\nUART\u003e\nREAD: -f 0x00\nUART\u003e\nREAD: -f 0x00\nUART\u003e\nREAD: -f 0x00\nUART\u003e\nREAD: 0x16\nUART\u003e\nREAD: 0x11\nUART\u003e\nREAD: 0x0B\nUART\u003e\nREAD: 0x00\nUART\u003e\nREAD: 0x00\nUART\u003e\nREAD: 0x00\nUART\u003e\nREAD: 0x3D\nUART\u003e\nREAD: 0x00\nUART\u003e\nREAD: 0x00\nUART\u003e\nREAD: 0x03\nUART\u003e\nREAD: 0x45\nUART\u003e\nREAD: 0x00\nUART\u003e\nREAD: 0x00\nUART\u003e\nREAD: 0x00\nUART\u003e\nREAD: 0x3B\nUART\u003e\nREAD: 0x01\nUART\u003e\nREAD: 0x00\nUART\u003e\nREAD: 0x00\nUART\u003e\n```\n\n[(See the complete log)](https://gist.github.com/lupyuen/db0c97b12bd1070e17cd2e570a5aa810)\n\n[(Another binary log)](https://gist.github.com/lupyuen/ebe4c0628fc9ea2e124e6f00d8246b49)\n\n# Decode Sensor Data\n\nBased on the [PM1006 Datasheet](https://github.com/arendst/Tasmota/files/7083662/PM1006_LED_PARTICLE_SENSOR_MODULE_SPECIFICATIONS.pdf), we decode the Sensor Data (20 bytes) as follows...\n\n```text\nHeader:   0x16 0x11 0x0B\nUnused:   0x00 0x00\nPM2.5:    0x00 0x36\nUnused:   0x00 0x00 0x03 0x32 0x00 0x00\nUnused:   0x00 0x34 0x01 0x00 0x00 0x00\nChecksum: 0x2E\n```\n\n[(Source)](https://gist.github.com/lupyuen/db0c97b12bd1070e17cd2e570a5aa810#file-ikea-binary-log-L7705-L7743)\n\nThis gives the PM 2.5 value of 54 (`0x0036`).\n\nTo validate the Checksum, all 20 bytes must add up to 0.\n\n[(More details)](https://github.com/arendst/Tasmota/issues/13012)\n\n[(And this)](https://community.home-assistant.io/t/ikea-vindriktning-air-quality-sensor/324599)\n\n[(ESPHome Source Code)](https://github.com/esphome/esphome/blob/dev/esphome/components/pm1006/pm1006.cpp#L57-L96)\n\n[(Arduino Source Code)](https://github.com/Hypfer/esp8266-vindriktning-particle-sensor/blob/master/src/SerialCom.h#L26-L63)\n\n# Test with Apache NuttX OS\n\nHere's a quick way to test the IKEA Sensor with NuttX OS. Enter these NuttX commands to read the UART port and dump the data...\n\n```text\nnsh\u003e ls /dev\n/dev:\n console\n gpio0\n gpio1\n gpio2\n null\n spi0\n spitest0\n timer0\n ttyS1\n urandom\n zero\nnsh\u003e cat /dev/ttyS1\n\n3(1\u003e\n    2'0A\n        2%0C\n            1$/F\n                .,T\n                   .,T\n                      .\n                       .,V\n                          .,V\n                             -+Y\n                                -+Y\n```\n\n[Watch the demo on YouTube](https://youtu.be/iFf8_f7ExUI)\n\nTo see the binary data, modify the GPS Demo App: [gps_main.c](https://github.com/lupyuen/incubator-nuttx-apps/blob/master/examples/gps/gps_main.c)...\n\n```c\n/* Read until we complete a line */\ncnt = 0;\ndo\n  {\n    read(fd, \u0026ch, 1);\n    //  Insert this line to dump the data in hex:\n    printf(\"%02x  \", ch);\n```\n\nBuild and run the modified GPS Demo App...\n\n```text\nnsh\u003e gps\n00  00  \n16  11  0b  00  00  00  39  00  00  03  39  00  00  00  37  01  00  00  00  21  \n16  11  0b  00  00  00  2b  00  00  03  17  00  00  00  29  01  00  00  00  5f  \n16  11  0b  00  00  00  32  00  00  03  26  00  00  00  30  01  00  00  00  42 \n16  11  0b  00  00  00  31  00  00  03  24  00  00  00  2f  01  00  00  00  46  \n16  11  0b  00  00  00  31  00  00  03  24  00  00  00  2f  01  00  00  00  46  \n16  11  0b  00  00  00  31  00  00  03  23  00  00  00  2f  01  00  00  00  47  \n16  11  0b  00  00  00  31  00  00  03  22  00  00  00  2f  01  00  00  00  48  \n16  11  0b  00  00  00  30  00  00  03  21  00  00  00  2e  01  00  00  00  4b  \n16  11  0b  00  00  00  2f  00  00  03  1f  00  00  00  2d  01  00  00  00  4f  \n16  11  0b  00  00  00  2f  00  00  03  1f  00  00  00  2d  01  00  00  00  4f  \n16  11  0b  00  00  00  2f  00  00  03  1f  00  00  00  2d  01  00  00  00  4f  \n16  11  0b  00  00  00  2f  00  00  03  1e  00  00  00  2d  01  00  00  00  50  \n16  11  0b  00  00  00  2f  00  00  03  1e  00  00  00  2d  01  00  00  00  50  \n16  11  0b  00  00  00  2f  00  00  03  1d  00  00  00  2d  01  00  00  00  51  \n16  11  0b  00  00  00  2e  00  00  03  1c  00  00  00  2c  01  00  00  00  54  \n16  11  0b  00  00  00  2e  00  00  03  1c  00  00  00  2c  01  00  00  00  54  \n16  11  0b  00  00  00  2e  00  00  03  1c  00  00  00  2c  01  00  00  00  54\n```\n\n[Watch the demo on YouTube](https://youtu.be/TyG-dJCx8OQ)\n\nYep we see the 20-byte frames of Sensor Data, and the PM 2.5 encoded inside!\n\nPM 2.5 = 46 (`0x002e`)\n\n# Connect to LoRaWAN and The Things Network\n\nTODO\n\n# Visualise with Prometheus and Grafana\n\nTODO\n\n# References\n\n-   [\"Use an IKEA VINDRIKTNING air quality sensor in Home Assistant with ESPHome\"](https://style.oversubstance.net/2021/08/diy-use-an-ikea-vindriktning-air-quality-sensor-in-home-assistant-with-esphome/)\n\n-   [IKEA VINDRIKTNING Manual](https://www.ikea.com/us/en/manuals/vindriktning-air-quality-sensor__AA-2289325-1.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flupyuen%2Fikea_air_quality_sensor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flupyuen%2Fikea_air_quality_sensor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flupyuen%2Fikea_air_quality_sensor/lists"}