Make One PM2.5/air Quality Monitor With Arduino UNO


Introduction: Make One PM2.5/air Quality Monitor With Arduino UNO

Make one PM2.5 monitor with Arduino UNO

use Arduino unoR3 board and one arduino compatible 4-digital tube to collect and display the PM2.5 value.

one laser PM2.5 sensor SDS011( is used for the PM2.5 detect.

Step 1: Download Arduino IDE

Arduino IDE: the version of 1.0.6 is used. goto http:// www. arduino. cc to download.

Step 2: Hardware Connect:

SDS011----this sensor has 7 pins. 3&5 are the power pins, and 6&7 are the ttl-5V com port pins.







7---- arduino-rx

4-digital tube connect:

1— ser--connect-to----arduino8

2— clk—connect-to----arduino9

3— st—connect-to----arduino10

4— gnd—connect-to----gnd

5— vcc—5V--connect-to----5V

Step 3: Open and Upload the Firmware

open the "ArduinoSDS011Demo.ino" file, and upload. the file would be automatically compiled and uploaded to arduino board.

code explain:

function Setup:the display and com init.

function Loop: function ProcessSerialData read the PM2.5 data,function Display display the data.

Step 4: DONE

the PM2.5 value is about 80 without smoke. It reach up to 999 within 5 seconds when the smoke is generated.

That's all.



    • Planter Challenge

      Planter Challenge
    • Make it Move Contest

      Make it Move Contest
    • Casting Contest

      Casting Contest

    We have a be nice policy.
    Please be positive and constructive.




    Please help me! Max7219 LED display does not work. No light. What should I change my code? Display wiring is OK, working with another program.

    Thank you very much

    Hi! That's a wonderful project. I'm still a student and have no programming experience. I'm also curious about whether it is possible to further program the chip so that the detected value of PM can control a motor. For example, the motor can be turned on only if the detected value exceeds a certain standard. Thanks a lot!

    Sorry to say, but I believe there is a bug in your code!

    If you look in the sensor datasheet, you do not construct an int out of the low and high bytes of PM10 and PM2.5 like in the code you posted. The datasheet says to do this instead:

    PM2.5 value: PM2.5 (μg /m3) = ((PM2.5 High byte *256) + PM2.5 low byte)/10

    PM10 value: PM10 (μg /m3) = ((PM10 High byte *256) + PM10 low byte)/10

    datasheet link:

    2 replies

    the datasheet says value is calculated in 2 steps:
    1 tmp=high*256+low;
    2 value=tmp/10;
    for the first step, tmp=high*256+low. is exactly the same as tmp=(high<<8)+low;

    for the second step, you are right, I have not done the second step in ProcessSerialData function.
    This is because I do not know how anduino deal with floating point number.
    But I have done the second step in display function. so the display should be right.

    Thank you for your attention, and your comment.

    Ahh, I see. Arduino handles floats like any other C++ microcontroller. When you divide by 10, just write it as 10.0 and make sure the variable the value is being stored in is type "float"

    I'm trying to make it but having trouble reading the PM values. The connections:

    SDS011 --- Arduino Uno

    TX RX

    RX TX


    5V 5V

    I don't have LCD so I comment the line //Display(); and replace it by 2 LEDs (they will be on if the value is 0)

    I always receive 0 for both PM 10 & PM 2.5.
    Do you have any hint what can go wrong?

    Hi, thanks for making this! I am a newbie and recently looked for SDS011 tutorials but couldn't find much. Btw I planned to use a 1602 LCD instead of the 4-digital tube for display, could you tell which part of the code should be changed?

    2 replies

    their are one function you should change.
    the function do 3 things:
    1 clear the display buffer;
    2 DisPm25data function for pm2.5 display;
    3 DisPm10data function for pm10 display;

    I made it! Thanks for sharing!

    I have managed to have an SDS011 working well with an Arduino Mega, but the sensor has now failed. I think this may be because sensor uses 3.3V serial whereas the Mega runs its at 5V. However you suggest that the TTL level for the SDS011 is 5v. Can you confirm please.SDS011

    2 replies

    could you do a specific description of your 'failed'?

    SDS011 should compatible with both 5V & 3.3V ttl voltage.

    the working voltage is about 3v-5.3v.

    you could insert a resistor of about 10K to pull-up to 5V to the arduino 5v rx port.

    Thank you for the quick reply; it is useful. I mean failed by the fan not running and no output on the SDS011 despite 5V being confirmed on the supply. I don't know the reason for failure; I thought mismatch of TTL level might be why as a TTL level of 3.3V is quoted in the the later (current) version of the SDS011 spec.

    Could you post a link of the display that you bought?

    7-segment display used is 4-digit or 8 digit. Please share the link and part number to purchase the display

    Thanks for this! I too have found that there are some problems with serial data conflicts if as I am you are using the serial monitor instead of an lcd display.

    Question about the sensor and values - if the variable pm25 is 994, does that mean the pm2.5 level is actually 99.4? i.e. /10?

    Also, what is the part number for the lcd display you used? did you buy it on taobao?


    1 reply

    1 yes, 994 means 99.4ug/m3;

    2 yes, search "德飞莱 595" in taobao, you would find it;

    Dear sir,

    I have been using your code, and it works well.
    However, it appears the serial communications part doesn't play nicely with other codes, and people on the Arduino forum say it needs some changes.
    Would you consider fixing it up some so it places nicely with other libraries, and having me pay you money for your time with the end result being open source?
    I lack the programming experience, and the capacity to do it on my own.
    Regardless I appreciate your efforts, and the monitoring of the volcanic pollution here has been rather interesting to say the least.

    Thanks again!

    Joshua Martin Paauilo, Hawai'i

    1 reply

    Hi jm, If you could give me a more specific question, I may help you more quickly.
    for example, could you give me a project that the pm2.5 parse code could not work?


    Kindly suggest how to measure PM10 in the above project

    1 reply

    their are two vars in the above code: Pm25 and Pm10, where the var Pm10 is probabily what you want?