OK did a lot more testing and it doesn’t really make sense. Sometimes the sensor works, most of the time does not. If it powers on, it usually continues to work fine. But if it fails on power-up, it will not work until it gets a successful power-on.
After extensive testing what seems to have solved it is adding a 10k pull-up resistor to the sensor’s RX (input) line. Looks like the sensor goes into some other mode or state if RX is not pulled up during power-up. The ESP8266 is supposed to have a pull-up on the TX line (TX pin for the UART, GPIO1) but the pull up is to 3.3 V and so may explain why the sensor sometimes works and sometimes not.
I added a level converter to the RX line since ESP is 3.3 V and the sensor is 4.5 V. It shouldn’t work so conversion at least makes sure of that. Pull up is on the sensor’s side to 5 V. The converter’s Output Enable is controlled by a GPIO that enables the converter just before a measurement is taken. Not sure if that is necessary or not though.
As for consistency, I thought I broke the first sensor so got a new one. Now both of them are connected to HA, one via the original Hypfer style (rx only) and the other one via Esphome with rx/tx. Both are reporting the same value, within a few µg/m^3.
Taking a lot of inspiration from this discussion I’ve finally put together my own Air Quality Sensor based on the Vindriktning. I’ve managed to fit a fair bit into this little device, including a DHT22 Temperature and Humidity sensor which I have cut out so its exposed to the outside of the case, a MH-Z19 for CO2 sensing, and an addressable RGB LED, all coming back to the Wemos D1 mini. The RGB led was added to provide a secondary red, yellow, green indicator controlled by HA for the CO2 level or any other notification I guess.
This is almost exactly what I did too! I have a HTU21D for RH/T, PM1006 for PM2.5 and MH-Z19B for CO2, all in the Vindriktning case. I thought about adding the leds just like you did, still in process of designing it, the D1 Mini does not have many IO left…
I built 3 air quality sensors using the Vindriktning along with a SCD40 for Temperature, CO2 and Humidity measurements. On my first 2, I had problems with the pads lifting (mentioned earlier in this thread) as I was trying to route the wires. So on those 2, I completely removed the stock board and replaced it with a small strip of WS2812B LEDs. I also cut a hole in the rear to plug power directly into the D1 Mini. The advantage to this is you have addressable RGB so you can make them any colour based on any parameter. The disadvantage of removing the default board is loss of the USB Type C charge port and the built in fan control (mine run 100% of the time).
I moved the fan power from 5V to 3.3V as suggested in this thread. They are seemingly silent but I notice my temperature measurements seem a degree or 2 too warm which might indicated 3.3V isn’t sufficient to dissipate the heat from the microcontroller. I also wonder if other readings, like PM2.5 are affected.
After 1 week of use, I learned a lot about my home and HVAC system. For reference, I live in a well insulated home (built 6 years ago) and in my region (Canadian prairies), the experts recommend not running your HRV during the summer because it brings in humidity from outside which causes your Air Conditioner to work harder. The CO2 sensors told me my baseline CO2 levels were around 800. I also had my HVAC fan set to ‘Auto’ which only runs when the furnace or AC activates. In my bedroom with those settings, my CO2 levels reached nearly 2500 PPM while sleeping, well over the 1000 PPM threshold Health Canada recommends. Even sitting in my office, I would get up to 1200 PPM. So I changed my HRV to run continuously at low speed and run my HVAC fan continuously as well. Now my baseline CO2 levels are 500-600 PPM and barely move in rooms that are occupied. Eventually, I think I should get a smart thermostat that integrates with my HRV so I can request fresh air based on CO2 levels in the home instead of based on humidity.
The PM2.5 sensor is handy too. I see the spikes when I’m cooking. I also do some painting with an airbrush and it’s useful to see if my ventilation is adequate and if it’s safe to remove my respirator.
Really nice ! Could you please share your ESPHome Yaml ? Do you have any reference to buy the display and some picture of the IO you used on the board ?
I made a CO² analyser, I was afraid of the result, specially à 7h00 in the morning: door closed, I often read over 2200 ppm.
I tried to put 5 leds (power, green orange red and a fifth one for… I don’t now…), but I ran out of availlable GPIO… some times, the esp8266 didn’t boot.
i put one adressable led, a PL9823 (compatible WS2812)
if I am able to lit it in red (or any color I want from the web side of the esp) i cannot find how to lit it with the percentage of data read in the captor. this must be running locally in the esp.
about the CO², it is so hot now in Paris than we have the windows open 24/7 and the MH-Z19 always stays at 400 pph, that is its lower base.
I would like to see your yaml file for the ribbon-led !!!
I will see later for the particule sensor. (as soon as my led will display the quality of the air)
I made something like that… it is just the beginning.
I can switch on or off the status light and change the colors from Home Assistant
or directly in the embeded web site of the ESP.
So once a minute, it checks the conditions.
If CO2 ppm < 1000 AND PM 2.5 < 50 ug/m3, the LED is green
If CO2 ppm 1000-1500 OR PM2.5 is 50-100, the LED is yellow
If CO2 ppm > 1500 OR PM2.5 > 100, the LED is red
If I wanted to get even fancier, I think I could make the addressable LEDs indicate different values but this is good enough for me.
After 8 months of usage since my setup, I am noticing the fan noise got quite loud. The noise doesn’t bother me as much since the box is placed over the fridge. I noticed this winding noise a few days ago and I thought my fridge is dying (the fridge is well over the 7 years of usage). It turns out that the noise was from the sensor. I am hoping the fan noise is just a noise and will not pose any danger to the point of melt down. I didn’t modify the fan and kept it as it from factory.
the only problem I still have is that the LED doesn’t work properly at the boot time…
either, it doesn’t lit, either it lits in white.
if it lits in white, I have to wait for a higher value of CO², (in order to change the color of the led).
if it doesn’t lit, I can switch it on with the web page or with HA.
when it is started, it works …
I have the same problem. Did you ever solve it? Or @fabiosoft do you know?
Edit:
After playing around with it for ~8 hours I would say if you go the full control route, ditch the IKEA pcb. I am no expert in electronics yet feel like the design is so weird. It’s a pain with the LEDs.
From more testing and online discussion I have to conclude that it is possible that the LEDs are not powered by the power supply but by the ESP. That is not best practice. I am going to ditch the IKEA PCB, except for the bottom and the capacitor. Then use a custom RGB anode LED with BC547 transistors.
My package is:
ESP32, close to bare; 3.3V
AMS1117 voltage regulator (5V → 3.3V)
PM1006 (PM2.5), fan continuously at 3.3V
MH-Z19B (CO2)
SGP41 (VOC and NOx)
RGB LED
PCBs and wires to hook it all up
Might make a how to for noobs like myself. Also, it was very difficult to cut and fit everything. Precision such as wire length is important. Sensor values were compared to sensors outside the box. They are very close.
Hi, unfortunately the dim orange LED is still an issue, anyway your solution seems good.
I digged into the IKEA board to give sense and repurpose to local control this very cool and cheap device, for me, i doesn’t make sense get this device and then completly rebuild with external components.
Sorry, no idea. That is a purpose made board from that company. It is their design and work. Those prices what you are quoting seems normal regarding shipment cost, customs tax, etc.
That is not a dodgy Chinese webshop, they are a company in Europe. If it would be a US company and I would like to order it to Europe, then they would quote similar shipping costs.
Thanks for this, gave me the push to get control off of HA and onto the device locally. I too have the issue of it not working on boot. Looking at running a on boot command to check levels and set initial color
The initialisation of the light is a bit better than the previous script, mainly because the on_value_range start too early and is refreshed only when the value is changing of range. So I add a second range near the floor value of the CO2 sensor.