Posted on 8 Comments

#40: DIY air quality sensor, part 3 – software

You can build the Air Quality Sensor project without understanding how the software works, but if you want to know what’s really going on behind the scenes you can join me for a deep dive into the source code.

Part 1 showed how to make the simplest possible air quality sensor. Part 2 added a 128×32 pixel OLED display and a mode button.


8 thoughts on “#40: DIY air quality sensor, part 3 – software

  1. Hi Jonathan,

    Thanks for the episodes on the DIY Air Quality sensor. I’ve ordered my senors and some cases from you already and can’t wait for them to arrive.

    I was just planning on using the basic version without the screen and Tasmota.

    However your latest video you mention that the sensor life can be extended significantly by turning it off between readings and that Tasmota doesn’t do this.

    Can I modify your code to work without a screen by commenting out the renderScreen() function call from the Main Loop?

    Or do I need to make more significant edits to your code?

    Thanks for the video, the inspiratrion and the code! I learned a lot.


    1. I pushed a PR that should be in the latest versions of Tasmota that allow for the sensors to go to sleep.

      1. Thanks Gene, I’m still waiting for the sensors to arrive.. they’re still somewhere between China and Oz.

        I’ll make sure I have the latest version when I flash the Wemos.



      2. Thanks for your work on the update Gene.. I’ve been using it for a week or so now. However I’m finding that I’m not getting and readings (taken or sent) after about 16-24hrs.

        I’m using the sensor version of tasmota ( on a Wemos D1 Mini Pro. Sensor18 is set to 300

  2. Hi Guys,
    Just wondering if the fan should go off in the sleep period? Getting data on this unit is tricky..
    I’ve not tried it yet, but does setting pin 6 (Reset) to 0V stop the fan?

  3. Is this a typo.?..

    sprintf(g_mqtt_message_buffer, “{\”PMS5003\”:{\”PM1\”:%i,\”PM2.5\”:%i,\”PM10\”:%i,\”PB0.3\”:%i,\”PB0.5\”:%i,\”PB1\”:%i,\”PB2.5\”:%i,\”PB5\”:%i,\”PB10\”:%i}}”,
    g_pm1p0_ae_value, g_pm2p5_ae_value, g_pm10p0_ae_value,
    g_pm0p3_ppd_value, g_pm0p3_ppd_value, g_pm1p0_ppd_value,
    g_pm2p5_ppd_value, g_pm5p0_ppd_value, g_pm10p0_ppd_value);
    } else {

    Hmmm…. Change
    Line 536 — g_pm0p3_ppd_value, g_pm0p3_ppd_value,g_pm1p0_ppd_value,
    Line 536 ++ g_pm0p3_ppd_value, g_pm0p5_ppd_value,g_pm1p0_ppd_value,

  4. Extra connection, D0 to RST.
    Only see it on #40 video, I have watched, rad and listened, I built it, it works without;
    Have I missed something? Thanks, great project.

  5. When part 4? really wanting the BME680


Leave a Reply

Your email address will not be published. Required fields are marked *