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

39,045

29

35

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(www.inovafitness.com) 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.

1----NC

2----NC

3----5V

4----NC

5----GND

6----arduino-tx

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.

Share

    Recommendations

    • Arduino Contest 2019

      Arduino Contest 2019
    • Trash to Treasure

      Trash to Treasure
    • Tape Contest

      Tape Contest

    35 Discussions

    0
    None
    pjozsi

    1 year ago

    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

    0
    None
    selinaguo

    2 years ago

    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!

    0
    None
    Va_Tech_EE

    2 years ago

    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: http://inovafitness.com/software/SDS011%20laser%20PM2.5%20sensor%20specification-V1.3.pdf

    2 replies
    0
    None
    jiangshan00000Va_Tech_EE

    Reply 2 years ago

    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.

    0
    None
    Va_Tech_EEjiangshan00000

    Reply 2 years ago

    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"

    0
    None
    iot_lab

    2 years ago

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

    SDS011 --- Arduino Uno

    TX RX

    RX TX

    GND GND

    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?

    0
    None
    arumpsp

    3 years ago

    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
    0
    None
    jiangshan00000arumpsp

    Reply 3 years ago

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

    0
    None
    James-P

    3 years ago

    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
    0
    None
    jiangshan00000James-P

    Reply 3 years ago

    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.

    0
    None
    James-Pjiangshan00000

    Reply 3 years ago

    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.

    0
    None
    BrandonZ2

    3 years ago

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

    0
    None
    biswajit11

    3 years ago

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

    0
    None
    theghostlibrary

    3 years ago

    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?

    Thanks!

    1 reply
    0
    None

    1 yes, 994 means 99.4ug/m3;

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

    0
    None
    jm82792

    3 years ago on Introduction

    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!

    Sincerely
    Joshua Martin Paauilo, Hawai'i

    1 reply
    0
    None
    jiangshan00000jm82792

    Reply 3 years ago on Introduction

    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?