Arduino Dust Sensor with ESP8266

Comparing the size of ESP8266 with a SD Card
Comparing the size of ESP8266 with a SD Card

The ESP8266 comes in various packages (e.g. ESP-12, ESP-07) but I bought the (pretty) bare package for less than US$2.50. For this price, the ESP8266 (ESP-01) has got 80 MHz CPU, 512KB program storage space, WiFi and 2 GPIOs. This tiny Arduino board is very suitable for Internet-of-Things (IoT) implementations.

With this, I decided to rebuild my previous Arduino-based Dust Sensor. The codes for the ESP8266 is as follow.


The periodically updated codes can be found on Github – Arduino Dust Sensor.


Treat shadowandy!

If these step-by-step guides have been very helpful to you and saved you a lot of time, please consider treating shadowandy to a cup of Starbucks.  

5 thoughts on “Arduino Dust Sensor with ESP8266

  • November 23, 2016 at 5:17 pm

    Thank you for sharing the project.
    It’s already a while since you did the project.
    Could you comment on it? Is ESP reliable enough to deal with sensor? I read on tne net some comments, that ESP have some trouble with arduino/nodemcu scripts , it’s sometimes not starting up, sometimes freezes. I wonder if you face this trouble too. I would like to build few of those monitoring stations, and wonder which platform for dealing with sensor will be better (ESP or Arduino with wifi shield… ) Please advice. The purpose is to install few stations in my neighborhood streets, with big displays, to inform people about air quality (you know, here in Poland we still burn lot of coal to heat houses… it’s sometimes hard to breathe). Networking capability will be used to record data and map data for later use…
    kind regards, pacraf

  • November 24, 2016 at 3:09 pm

    Hi pacraf,

    Yes, the ESP8266 can be unreliable at times. I have added decoupling capacitor to the ESP8266 which made it slightly more stable but it still freezes randomly which I have no idea what happened to it. For actual production deployment, I would recommend getting a Arduino with WiFi shield.

    If you have managed to locate a Node.JS application that interfaces well with the air quality sensor (via the GPIO), then you might want to consider using Raspberry Pi (with Node.JS). Recommending this because you will be able to easily hook up a display (i.e. display) to the HDMI output of Raspberry Pi. You can also easily make use of common React or AngularJS frameworks to craft up a nice UI for display.

  • January 1, 2017 at 11:36 pm

    Hi, many thanks for sharing.
    I think your code could contain a small but significant error: Line 88 should read
    double vol10 = (4.0 / 3.0) * pi * pow(r10, 3);
    Since (4/3) is integer division, yielding 1, and (4.0/3.0) is double division, yielding 1.3333, the value you want.
    Same holds for line 95.

  • February 2, 2017 at 10:41 pm


    I have an issue with reading from sensor. The calculation is always the same:

    Concentration pm10: 0.27
    Concentration pm25: 0.00
    Count pm10: 0.62
    Count pm25: 0.00

    The only thing different from your installation is that I’m using NodeMCU ESP8266-12E board. Everything else is the same (wiring, sensor, llc).

    Any suggestions how to debug?

Comments are closed.