GithubHelp home page GithubHelp logo

hypfer / esp8266-vindriktning-particle-sensor Goto Github PK

View Code? Open in Web Editor NEW
1.1K 39.0 126.0 363 KB

Wifi MQTT Data Logging via an esp8266 for the Ikea VINDRIKTNING PM2.5 air quality sensor

License: Apache License 2.0

C++ 98.63% C 1.37%
mqtt smarthome ikea

esp8266-vindriktning-particle-sensor's Introduction

MQTT connectivity for the Ikea VINDRIKTNING

This repository contains an ESP8266 firmware, which adds MQTT to the Ikea VINDRIKTNING PM2.5 air quality sensor. The modification doesn't interfere with normal operation of the device in any way. The ESP8266 just adds another data sink beside the colored LEDs.

half_assembled

Home Assistant Autodiscovery is supported. Furthermore, the WifiManager library is used for on-the-fly configuration. Also, ArduinoOTA is used, so that firmware updates are possible even with a reassembled device.

As the ESP8266 is 5V-tolerant, this should there shouldn't be any issues, however I haven't had time to test this for longer periods of time. Therefore, if the ESP burns out after a while, just add a voltage divider or something.

Prerequisites

To extend your air quality sensor, you will need

  • An ESP8266 with a 5v voltage regulator (e.g. a Wemos D1 Mini)
  • Some short dupont cables
  • A soldering iron
  • A long PH0 Screwdriver (e.g. Wera 118022)

Fortunately, there is a lot of unused space in the enclosure, which is perfect for our ESP8266. Also, everything we need is accessible via easy to solder testpoints.

Hardware

To install the ESP8266, you need to unscrew the four visible screws in the back of the enclosure.

Then, there are also three screws holding the tiny PCB in place. These aren't necessary to remove since you can solder in-place, however personally, I'd recommend taking the board out of there since it will be easier to solder without fear of accidentally melting some plastic.

board

As you can see in this image, you'll need to solder wires to GND, 5V and the Testpoint that is connected to TX of the Particle Sensor.

Then just connect these Wires to GND, VIN (5V) and D2 (if you're using a Wemos D1 Mini).

Done.

Software

The firmware can be built and flashed using the Arduino IDE.

For this, you will need to add ESP8266 support to it by using the Boards Manager.

Furthermore, you will also need to install the following libraries using the Library Manager:

  • ArduinoOTA 1.0.3
  • ArduinoJSON 6.10.1
  • PubSubClient 2.8.0
  • WiFiManager 0.15.0

Just build, flash, and you're done.

When connecting everything up, you should see an open Wi-Fi Access Point to configure your Wi-Fi and MQTT credentials.

Low-Noise Mod

Note: The intent of this section is only to document that this is possible. I don't "recommend" doing this nor do I advise against it.

As you might've noticed, there's a fan in there, which is audible even multiple meters away.

For some reason, the Ikea uC firmware decides to toggle the fan on and off every minute or so causing the noise it makes to change and therefore it constantly stays noticeable.

Good thing is that the Fan does spin up fine with just 3.3V, which means that we can run it constantly from the voltage regulator of the D1 Mini.

At 3.3V its noise is barely noticeable from 50 cm away.

3.3v

Having the Fan not connected at all was also tried but proved to mess up all readings completely.

This is of course a more invasive modification than just adding Wi-Fi data logging. Though, given that it is just a €10 device, I'm fine with that.

To make soldering a bit easier, note that the whole outer metal part of the Micro USB connector of the D1 Mini is connected to GND.

Misc

The VINDRIKTNING consists of a custom(?) Cubic PM1006-like Sensor + another uC that does all that LED stuff, which talk via UART. The uC simply regularly polls the sensor and displays the results.

Therefore, to add Wi-Fi connectivity, we just need to also listen to the TX of the Sensor and decode those messages. The Ikea uC will do all that polling stuff for us.

As reported in #16, the transitions from Green to Yellow and Yellow to Red in the Ikea firmware are at around 30 and 100μg/m³.

ToDo

Reconfiguration of a provisioned device without having to OTAU a firmware that clears the settings would be nice.

References and sources

esp8266-vindriktning-particle-sensor's People

Contributors

dominikpalo avatar enwi avatar hypfer avatar nohn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp8266-vindriktning-particle-sensor's Issues

The value does not fall below 200

Not sure how to fix incorrect display values? He's been showing me 200-260 for some time. And it will never go down. I also tried to vacuum and it didn't help.

Not an issue, low noise mod skews sensor results by ~50%

I've implemented the low noise mod and connected the fan permanently to the 3.3v pin of the Wemos D1.
This does indeed reduce the fan noise significantly. But I do see a change in the sensor measurements though, they are about half as high compared to the results without the low noise mod.

2021-12-20 152800

My PM2,5 levels are to low to see whether this is an absolute reduction or a percentage reduction. Hopefully someone can give us a clear answer to that question.

increase max mqtt password

hi, could you increase the max mqtt password from 24 to 32 chars please?
I tried to do it myself but get: "Socket error on client , disconnecting" in Home assistant so I probably messed it up.
Thanks

Option for config file

It would be nice if there is a option to use a config file instead of settings the values through the WifiManager.
If you already have to flash the firmware its should be easy enough to set the correct values in a file.

Its common practices to use long and complex passwords, and it's a hassle to type in those passwords on you mobile for example.

Sporadic crashes when Wifi wants to connect

Hi,

I have the issue that the D1 mini is crashing at this line:

wifiManager.autoConnect(identifier);

Stack Decoding says:

Exception 0: Illegal instruction
PC: 0x40251220
EXCVADDR: 0x00000000

Decoding stack results
0x40100848: ets_post(uint8, ETSSignal, ETSParam) at /home/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266/core_esp8266_main.cpp line 181
0x40100848: ets_post(uint8, ETSSignal, ETSParam) at /home/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266/core_esp8266_main.cpp line 181

Now that is odd, I've installed the WifiManager in the particular version and in the one from plattform.ini, the Boards are from the latest 3.0.2 version, I've selected the "Lolin (Wemos) D1 Mini (clone)"

Embarrasingly stuck

So I set up an MQTT broker and linked it to Home Assistant, and I soldered the board in and flashed it, and ran the config from its ad-hoc network... now what? I'm seeing the device on my router but I don't know what to do next, none of the guides on MQTT broker stuff seem to explain what to do, if I should just expect it to work? I tried inputting the address of my MQTT broke both with and without port number and I don't really know what the heck to do. Do i need to broadcast a topic? What even is a topic? Should I have set something in the code before flashing it?

My apologies for ranting but this is has turned out to be a really poor example of a first time MQTT project 😅

Set OTA password

I am unable to determine the OTA password, i see where it gets set but I cant figure out where it gets configured

Crash after first reading is received

Thanks for this excellent work!

I tried to replicate but after receiving the first reading, the system crashes. A side-effect of this is that the Wifi Config is lost and you have to reconfigure it, making debugging a bit of a pain :)

The serial log looks like this:

IP: 192.168.1.239
-- Current GPIO Configuration --
PIN_UART_RX: 4
Receiving:................................................................Receiving:....................Done.
Received PM 2.5 reading: 6

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Exception (0):
epc1=0x40201673 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

>>>stack>>>

ctx: cont
sp: 3ffffdc0 end: 3fffffc0 offset: 0190
3fffff50:  3ffef6a8 3ffef9a4 00000004 40201673  
3fffff60:  40217c3d 0000000f 00000000 00000000  
3fffff70:  3ffef6a8 3ffef720 3ffef1c0 402037cc  
3fffff80:  00000000 00000000 00000001 3ffefb34  
3fffff90:  3fffdad0 00000000 3ffefb20 40203800  
3fffffa0:  3fffdad0 00000000 3ffefb20 40217640  
3fffffb0:  feefeffe feefeffe 3ffe862c 4010156d  
<<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

I've decoded the exception to be

Exception 0: Illegal instruction
PC: 0x40201673
EXCVADDR: 0x00000000

Decoding stack results
0x40217c3d: __delay(unsigned long) at /Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/cores/esp8266/core_esp8266_wiring.cpp line 55
0x402037cc: handleUart() at /Users/user/Downloads/esp8266-vindriktning-particle-sensor-master/src/esp8266-vindriktning-particle-sensor/serialCommunication.ino line 81
0x40203800: loop() at /Users/user/Downloads/esp8266-vindriktning-particle-sensor-master/src/esp8266-vindriktning-particle-sensor/esp8266-vindriktning-particle-sensor.ino line 142
0x40217640: loop_wrapper() at /Users/user/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.1/cores/esp8266/core_esp8266_main.cpp line 201

(using a D1 Mini Pro)
Any ideas what's going wrong?

reading calculation appears to be wrong

https://github.com/Hypfer/esp8266-vindriktning-particle-sensor/blob/master/src/serialCommunication.ino#L2
says

serialRxBuf[3] * 256 ^ 3 + serialRxBuf[4] * 256 ^ 2 + serialRxBuf[5] * 256 ^ 1 + serialRxBuf[6];

which I believe is equivalent to

serialRxBuf[3] * 256 ^ (3 + serialRxBuf[4]) * 256 ^ (2 + serialRxBuf[5]) * 256 ^ (1 + serialRxBuf[6]);

The code is most certainly not multiplying [3] by '256 to the power of 3', etc.

I think the right code would be

serialRxBuf[5] * 256 + serialRxBuf[6];

based on page 7 of http://www.jdscompany.co.kr/download.asp?gubun=07&filename=PM1006_LED_PARTICLE_SENSOR_MODULE_SPECIFICATIONS.pdf

Web interface problem

hello, first of all thanks for your development. the installation went smoothly, the sensor works fine, but the web interface is not available, when I want to change the setting, I cannot reach anywhere. I completely deleted the esp card, I reinstalled it many times, but the problem was not solved, what can I do?

Many readings of zero, leading to few messages

Great work on this mod, thanks @Hypfer!

I've now tried it with two sensors. One works flawlessly, reporting regularly over MQTT. The other is quiet for long periods of time, only occasionally reporting a reading. Over serial, I see that many of the measurements are zero (and the code won't publish unless the average reading is greater than zero).

At first I thought it was either a dead sensor, or a hardware issue with my mod. But if I hold a match next to the sensor, the light changes to yellow and red, and the reported numbers increase. MQTT messages are then sent until the smoke dissipates, the sensor returns to green, and the numbers reduce to zero again.

So what's going wrong? Bad sensor? Acceptable calibration differences between sensors, which need to be handled differently in the code? With a sample size of 2, I don't have enough to go on.

For now, I'm going to remove the "don't publish if zero" line in the code, set the two devices next to each other, and set-up logging of the MQTT messages to see if this sheds any light on the behavior.

platformio: section '.text' will not fit in region 'iram1_0_seg'

Fantastic project, but I can't manage to compile it with PlatformIO:

$ platformio run

Processing d1_mini (platform: espressif8266; board: d1_mini; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/d1_mini.html
PLATFORM: Espressif 8266 (1.5.0) > WEMOS D1 mini
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
 - framework-arduinoespressif8266 1.20300.1 (2.3.0)
 - tool-esptool 1.409.0 (4.9)
 - toolchain-xtensa 1.40802.0 (4.8.2)
Converting esp8266-vindriktning-particle-sensor.ino
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 26 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ArduinoJson> 6.18.3
|-- <PubSubClient> 2.8.0
|-- <WiFiManager> 0.16.0
|   |-- <DNSServer> 1.1.0
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <ESP8266WebServer> 1.0
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <ESP8266WiFi> 1.0
|-- <EspSoftwareSerial>
|-- <ArduinoOTA> 1.0
|   |-- <ESP8266WiFi> 1.0
|   |-- <ESP8266mDNS>
|   |   |-- <ESP8266WiFi> 1.0
|-- <DNSServer> 1.1.0
|   |-- <ESP8266WiFi> 1.0
|-- <ESP8266WebServer> 1.0
|   |-- <ESP8266WiFi> 1.0
|-- <ESP8266WiFi> 1.0
Building in release mode
Compiling .pio/build/d1_mini/src/esp8266-vindriktning-particle-sensor.ino.cpp.o
Linking .pio/build/d1_mini/firmware.elf
/PATH_TO_LD/ld: .pio/build/d1_mini/firmware.elf section `.text' will not fit in region `iram1_0_seg'
collect2: error: ld returned 1 exit status
*** [.pio/build/d1_mini/firmware.elf] Error 1

What could be wrong?

which libraries to use? Just a question.

  • working with VScode I'm insecure which libraries to use.
    lib_deps =
    bblanchon/ArduinoJson@^6.18.3
    tzapu/WiFiManager@^0.16.0
    knolleary/PubSubClient@^2.8

  • Config.h,Types.h and SerialCom.h already in scr folder but "compilation terminated ... include files not found"

  • besides the 3.3V issues would an ESP-01 be sufficient
    Thank-you for advice

5V mention in the README

You mention in the README that the ESP8266 is 5V-tolerant, but then you mention the regulator. If you connect the 5V pad to the 5V pin of the ESP8266 board, that's not merely 5V-tolerant, it's 5V required. There's no danger of the ESP burning after a while, it'll run fine forever.

Possible improvement: sample size of 7

My sensor works in bursts of 7 samples with +/- 2 seconds in between, followed by a 10 seconds pause.

does this differ from yours?
is there a reason you use an average of 5 samples?

[question] some success with ESP32?

I soldered the VINDRIKTNING to a ESP32 board (ESP32-MINI) but do not get a signal from the sensor. a
An additional DHT11 works well. I compiled tasmota32 with the #define USE_VINDRIKTNING option and wired REST to GPIO17.
Any recommendations?

Not an issue, you probably need to clean the sensor regularly

Situation: vindriktning with small self-made esp8266 board that sends the values to my IOT system. Readout function based on this git repo.
Over the last 2 months the pm2.5 values have been (on average) nearly linearly increasing, up to the point where it was 140 ppm average, and red all the time. I opened up the box, found that the small filter on the sensor was all clogged up. Gave it a gentle blowout with the air compressor (yes, I protected the fan). Started all up again. The first 4-5 hours it did not seem to make any difference. But then suddenly there was a 100 ppm drop, followed by a drop of 30 more 1 hours later. Both drops were while we were out, nothing happened in the house, the device did not reboot.

It reacts to our presence, so it is not dead, and now it is back to levels where it was when I just bought it.
So either I damaged it, or the sensor really sensitive to dust accumulation on the sensor. I tend to believe the latter.

Maybe others also see that nearly linear increase over time? That could confirm my suspicion.

Screenshot 2021-12-05 at 19 48 17

Screenshot 2021-12-05 at 19 50 59

Received message with invalid header.

Hi,

I have uploaded to a D1 Mini, it connects to my wifi, I get the status Online message in MQTT, together with the air filter and wifi message, however, it doesn't show any values in MQTT and I can't see it in Home Assistant. When I look at the Serial output of the arduino IDE, I get this messag: "Received message with invalid header."

Occasionally it does show a reading:

Received PM 2.5 reading: 42
Current measurements: 42, 39, 39, 40, 40

Thanks in advance

Not an issue: but a link to the actual PM1006 datasheet

Cubic's website sucks and it doesn't make it clear that there are both PM1006 and PM1006K versions of the sensor that pretty much look identical. I found a link to the PM1006 datasheet which appears to match the data that I have seen posted elsewhere.
The PM1006 only does pm2.5 :(

[(http://www.jdscompany.co.kr/download.asp?gubun=07&filename=PM1006_LED_PARTICLE_SENSOR_MODULE_SPECIFICATIONS.pdf)]

Not Issue - I need help with code

Hello everyone. I have my own web communication on ESP32 and i need only take values from sensor. Am I understand right that i need only SerialCom.h library and calling on it with SerialCom::handleUart(state); and its done ? Thanks for answer have a nice day.

Not an issue - A little more information about the fan

Hi. First of all, thanks for this amazing project! I really want to do it, and during the analysis, I had some questions regarding the fan.

If I understand correctly, the firmware of the Ikea board toggle the fan every minute. Surely the firmware does a reading with the fan on. The doubt is the next one: If you replace the 5v output of the ikea board for the 3v3 output of the esp. Does the toogle function hold? Or would you have a fan that is always running?

Thanks

Which WifiManager?

I was not sure which WifiManager to use, the search gave multiple results an the version number did differ (there seems to be a 2.0.x version now).

maybe add the "tzapu" tag to ease?

Sensor disappears in Home Assistant

Have been running this for a few days, but the sensor disappears quite often in Home Assistant
I'm guessing it's timing related - where the MQTT loses it's connection and a last-will message is sent.

get no values from sensor

Hi all,

after install and successful upload to wemos i can see messages in MQTT Explorer but no values ... i just see:

{
  "device": {
    "identifiers": [
      "VINDRIKTNING-49ED42"
    ],
    "manufacturer": "Ikea",
    "model": "VINDRIKTNING",
    "name": "VINDRIKTNING-49ED42",
    "sw_version": "2021.08.0"
  },
  "availability_topic": "esp8266-vindriktning-particle-sensor/VINDRIKTNING-49ED42/status",
  "state_topic": "esp8266-vindriktning-particle-sensor/VINDRIKTNING-49ED42/state",
  "name": "VINDRIKTNING-49ED42 PM 2.5",
  "unit_of_measurement": "μg/m³",
  "value_template": "{{value_json.pm25}}",
  "unique_id": "VINDRIKTNING-49ED42_pm25",
  "icon": "mdi:air-filter"
}

i would expect to see some values in "value_template" and not "{{value_json.pm25}}"... i would say i solder correctly on the board ... also i tested with PIN_UART_RX = 5 in SerialCom.h but the same output ... is my wemos maybe brocken ?
any ideea?

Thanks ....
GREAT IDEEA :-)

UART levels 5V / 3.3V

You write in your readme "ESP8266 is 5V-tolerant, this should there shouldn't be any issues". This is not true of course. Anything aboce 3.6V can damage the pins.

Since the UART level of an PM1006 is I do expect issues with burning pins on the ESP8266.

Maybe the IKEA board has a level shifter? Did you find one?

After connecting to personal WiFi an AP is still present

Hi,

thanks for this cool project! Everything is working fine up to now, but:
After the esp connects to my WiFi, still an AP is present! It changes the name from "Vindriktning-XXX" to "ESP-XXX".
How can I suppress this AP?

Br,
Michael

Seeing odd values on sensor UART

I'm getting really bizarre readings from the UART...

I've tried 2 different ESP8266s (d1 mini clones) and an ESP32 (a mini32) and see the same behaviour on each. The IKEA unit appears to work normally, and the LEDs on it light up as you would expect in different atmospheres.

Have also de/re-soldered the wires a few times, powered the ESP via either 5V pin or USB. Same deal each time.

Code modifications (for logging):

bool isValidHeader() {
  Serial.printf("Expected header: %02X %02X %02X\n", 0x16, 0x11, 0x0B);
  Serial.printf("Received header: %02X %02X %02X\n", serialRxBuf[0], serialRxBuf[1], serialRxBuf[2]);
  bool headerValid = serialRxBuf[0] == 0x16 && serialRxBuf[1] == 0x11 && serialRxBuf[2] == 0x0B;
  // ...
void handleUart(particleSensorState_t& state) {
  // ...
  Serial.print("Receiving: ");
  while (sensorSerial.available()) {
    serialRxBuf[rxBufIdx] = sensorSerial.read();
    Serial.printf("%02X ", serialRxBuf[rxBufIdx]);
    rxBufIdx++;
  // ...

Serial output

Receiving: F7 Done.
Expected header: 16 11 0B
Received header: F7 00 00
Received message with invalid header.

Receiving: FF Done.
Expected header: 16 11 0B
Received header: FF 00 00
Received message with invalid header.

Receiving: 7F FB Done.
Expected header: 16 11 0B
Received header: 7F FB 00
Received message with invalid header.

Receiving: EB FF FF Done.
Expected header: 16 11 0B
Received header: EB FF FF
Received message with invalid header.

Receiving: F7 FF FF Done.
Expected header: 16 11 0B
Received header: F7 FF FF
Received message with invalid header. 

I'm somewhat new to C++ / Arduino, would appreciate any tips re: where to look next!

Can't re-configure D1 after initial deployment

I noticed that reconfiguration after initial deployment is a "To Do" in the readme:

Reconfiguration of a provisioned device without having to OTAU a firmware that clears the settings would be nice.

What is the best/easiest way to do this at present (i.e., how should I OTAU firmware to clear settings)?

I have no experience with OTAU, and I presume there's a relatively simple way to accomplish this (for now) that I'm not familliar with.

I would be happy to contribute documentation if pointed in the right direction.

Aside from OTAU, I have had some success with bringing up the AP by temporarily blocking the D1's MAC address on my network and I've been playing around with flashing the firware again; however, when connected to my laptop by USB, I can see via serial monitor that the device seems to re-join the same wifi network with the previous settings (i.e., no AP and no opportunity to make SSID or MQTT config changes) after re-flashing.

Potential problem with running the fan at 3.3V?

I think there may be an issue with running the fan at 3.3V.
At 5V the fan will push a certain CFM for certain amount of time.
At 3.3V the fan will push much less CFM for that time.
The sensor unit counts the number of particles that are pushed though it in that time.
Net result, the sensor will see many less particles (due to less volume of air passing through it) and will under report the air quality.

After Wifi Connect, no Access to webinterface possible any more

Hi,

What I have done:

  • first connect to the esp wifi accesspoint and configure ssid, password and mqtt server + credentials.
  • it reboots
  • it connects to wifi, gets an ip from the wifi network
  • mqtt sends messages and mqtt broker receives them as well

But: I cannot access the webinterface for editing the mqtt Server etc. any more - I only get a

"ERR_CONNECTION_REFUSED"

Don't know where to look... I think its a default that only accesses from 192.168.4.0/24 are allowed (standard AP of the ESP Lib) but I don't know yet where it is defined.

Thanks a lot!

cheers

4

No mqtt topic is visible

I use MQTT Explorer & mosquitto broker.
However, i cant see the mqtt topic "air-sensor/sensor/particulate_matter_25m_concentration/state"
grafik

What do i have todo that i can see the values?
Are they values/topics only published if the hardware reading is possible.
Because my wiring is wrong i dont even see the topic?

Logging seems good to me, but there isnt any measurement either.

[17:18:23][C][logger:293]: Logger:
[17:18:23][C][logger:294]:   Level: DEBUG
[17:18:23][C][logger:295]:   Log Baud Rate: 0
[17:18:23][C][logger:296]:   Hardware UART: UART0
[17:18:23][C][uart.arduino_esp8266:102]: UART Bus:
[17:18:23][C][uart.arduino_esp8266:104]:   RX Pin: GPIO3
[17:18:23][C][uart.arduino_esp8266:106]:   RX Buffer Size: 256
[17:18:23][C][uart.arduino_esp8266:108]:   Baud Rate: 9600 baud
[17:18:23][C][uart.arduino_esp8266:109]:   Data Bits: 8
[17:18:23][C][uart.arduino_esp8266:110]:   Parity: NONE
[17:18:23][C][uart.arduino_esp8266:111]:   Stop bits: 1
[17:18:23][C][uart.arduino_esp8266:113]:   Using hardware serial interface.
[17:18:23][C][pm1006:017]: PM1006:
[17:18:23][C][pm1006:018]:   PM2.5 'Particulate Matter 2.5µm Concentration'
[17:18:23][C][pm1006:018]:     Device Class: 'pm25'
[17:18:23][C][pm1006:018]:     State Class: 'measurement'
[17:18:23][C][pm1006:018]:     Unit of Measurement: 'µg/m³'
[17:18:23][C][pm1006:018]:     Accuracy Decimals: 0
[17:18:23][C][pm1006:018]:     Icon: 'mdi:blur'
[17:18:23][C][pm1006:019]:   Update Interval: never
[17:18:24][C][captive_portal:088]: Captive Portal:
[17:18:24][C][mdns:103]: mDNS:
[17:18:24][C][mdns:104]:   Hostname: air-sensor
[17:18:24][C][ota:093]: Over-The-Air Updates:
[17:18:24][C][ota:094]:   Address: air-sensor.local:8266
[17:18:24][C][ota:097]:   Using Password.
[17:18:24][C][api:138]: API Server:
[17:18:24][C][api:139]:   Address: air-sensor.local:6053
[17:18:24][C][api:141]:   Using noise encryption: YES
[17:18:24][C][mqtt:065]: MQTT:
[17:18:24][C][mqtt:066]:   Server Address: [redacted]:1883 ([redacted])
[17:18:24][C][mqtt:068]:   Username: [redacted]
[17:18:24][C][mqtt:069]:   Client ID: [redacted]
[17:18:24][C][mqtt:074]:   Topic Prefix: 'air-sensor'
[17:18:24][C][mqtt:076]:   Log Topic: 'air-sensor/debug'
[17:18:24][C][mqtt:079]:   Availability: 'air-sensor/status'
[17:18:24][C][mqtt.sensor:027]: MQTT Sensor 'Particulate Matter 2.5µm Concentration':
[17:18:24][C][mqtt.sensor:031]:   State Topic: 'air-sensor/sensor/particulate_matter_25m_concentration/state'

config.yaml

esphome:
  name: air-sensor

esp8266:
  board: esp01_1m

# Enable logging
logger:
  baud_rate: 0

# Enable Home Assistant API
api:
  encryption:
    key: "xxxx"

ota:
  password: "xxxxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Air-Sensor Fallback Hotspot"
    password: "xxxx"

captive_portal:
    
# Example configuration entry
uart:
  rx_pin: RX
  baud_rate: 9600

sensor:
  - platform: pm1006
    pm_2_5:
      name: "Particulate Matter 2.5µm Concentration"    

mqtt:
  broker: xxxx
  discovery: true

Board i used with a dc/dc converter for the power supply & voltage divider for the UART TX/RX pin
https://www.amazon.de/dp/B074RL7YR3?psc=1&ref=ppx_yo2ov_dt_b_product_details

Spikes

I have some unwanted spikes in value signal.
Using it with MQTT/Homeassistant. Any suggestion on how to solve or the reason of those spikes?

image

Not an issue - just a question! ZigBee instead?

Hi, thanks for the project, very clever idea, and an interesting device.

I did purchase one of these sensors today, I didn't even realise it had a fan, quite a noisy one at that! You're right, without the fan operating such as generating some smoke behind it it doesn't detect it at all, but as soon as the fan turns on it does just fine. I do wondering if lowering the voltage on the fan gives the same accuracy, because I sure am tempted! Doing some very caveman style testing shows it's very accurate so far.

There is some interesting info on the sensor if it is this one. Interesting the range of PM it can detect, not just 2.5um particles, unless this is a custom modification made! I wonder if it can detect grass pollen at around 20um
https://pdf.directindustry.com/pdf/cubic-sensor-instrument-co-ltd/pm1006k-led-particle-sensor-module/54752-927719-_4.html

Anyway, onto my question - if I wished to do a similar mod but using ZigBee (Smartthings hub) rather than WiFi would you have any suggestions?

This devices begs for smart connectivity, I can't believe Ikea did not do this with their already established ZigBee range!

There is nothing wrong with WiFi of course, it'd work great. I'm just a fan of ZigBee for low data rate/low powered devices.

Many thanks

Question about wiring points

The photo you have of the wired up test points, you seem to have the data wire connected to the test point labelled 'REST'. Just confirming that this is correct. Isn't REST a reset line of some kind, and the far left test point labelled ISPDA the data test point? Or is the board labelling incorrect. Don't have a scope so can't really check myself...

Control LED

Thank you for the great project.
The design of the device is very clean and I think about to use it as an cheap status light for home automation like homeassistant.
Ist it possible to control the LED colors without the particle-sensor - only to switch the colors with mqtt?
Best regards
Daniel

Temperature and Humidity

Hello,

First of all, awesome project. I didn’t even know that IKEA has an Air Quality sensor. Some might would think that they would fit inside their Air purifier first a sensor like this...

Anyhow, have you thought of adding a Temperature and Humidity sensor into the device to give a full range of environmental details? Like a DTH22 or AM2302. Is there enough space to fir that as well?

Best Regards,

Gábor

Control LED? Night mode?

Did you find same traces for LED controlling? I can see some pins labelled LED_G and LED_R...but i can't figure out what's the purpose and if i can use GPIO or need a relay... btw where is the Yellow? 🤣

Maybe could be useful in bedrooms during the night (too tiny space to add a photoresistor too?)

How to See the Data in an App ? & Simple Wiring to ESP8266

I have the Code running OK on The ESP8266 D1 Mini in the VINDRIKTNING.
The Serial Port is streaming measurements to my IDE Serial Monitor.

What do I have to use to see the data on an App ? (or a browser)
The Config.h is untouched, I dont know what to enter !
It has somehow managed to connect to my WiFi despite not giving it an SSID or Password.

I installed Home Assistant on my Android Tablet, it asks for a URL, I dont have one
The Blog does say this code works with auto discovery, but no joy.

This must be a pretty basic issue, but I cant find any tutorial related to it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.