Dust Sensor

From Waveshare Wiki
Jump to: navigation, search
Dust Sensor
Dust-Sensor

Dust Sensor, A simple Air Monitor
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Overview

  • Onboard sharp GP2Y1010AU0F, detecting fine particles larger than 0.8μm in diameter, even like cigarette smoke.
  • Low power consumption, analog voltage output, the output level is linear with dust density.
  • Embedded voltage boost circuit to support a wide range of power supplies.

Specifications

  • Sensitivity : 0.5V/(100μg/m3)
  • Measurement range: 500μg/m3
  • Power: 2.5V~5.5V
  • Operating current : 20mA(max)
  • Operating temperature: -10℃~65℃
  • Storage temperature: -20℃~80℃
  • Lifetime: 5 years
  • Dimension : 63.2mm × 41.3mm × 21.1mm
  • Mounting holes size: 2.0mm
  • Air hole size: 9.0mm

Sensor Characteristics

The output voltage of the module is proportional to dust density in the range of 0 to 0.5mg/m3.
Dust Sensor- (1).png

Control principle

  • Enable the internal infrared emitting diode by setting the pin ILED to HIGH.
  • Wait 0.28ms, then the external controller starts to sample the voltage from the pin AOUT of the module. Notes that the output wave will take 0.28ms to reach steady-state after the internal infrared emitting diode is enabled.

Dust Sensor- (2).png

Pinouts

PIN Description
VCC 2.5V-5.5V
GND Power ground
AOUT Analog data output
ILED Driver pin of internal LED

Get Started at Pico

If you are the first time o use the Pico, you need to first learn how to get started at the Pico before you run other examples.
The Pico supports C and the Micropython which requires different firmware.
In most of the examples archives (Demo codes), we provide a Micropython firmware (uf2 file), we recommend you to use the provided firmware to test the board. Because the codes may run abnormally with different firmware.
If the board is tested to be workable, you can also download the newest firmware from Raspberry Pi and do further programming.

Hardware Connection

Sensor Pico Description
VCC 3.3V Power input
GMD GND Power ground
AOUT GP26 Analog data output
ILED GP22 Driver pin of internal LED
Dust-Sensor-Pico 1.jpg

Download examples

Use Raspberry Pi as the host device. Open a terminal and run the following commands to download the example.

sudo apt-get install p7zip-full
cd ~
sudo wget  https://files.waveshare.com/upload/2/2a/Dust-Sensor-code.7z
7z x Dust-Sensor-code.7z -o./Dust-Sensor-code
cd ~/Dust-Sensor-code
cd Pico/c/build/

Examples

C codes

  • Go into the c directory.
cd ~/Dust-Sensor-code/Pico/c/build
  • Add the path of SDK.
export PICO_SDK_PATH=../../pico-sdk
Note that if the path of your SDK is different, you need to modify the command and use the correct path to export.
  • Generate Makefile and build.
cmake ..
make -j9
  • After building, a uf2 file is generated.
  • Press and hold the button of Pico, connect it to Raspberry Pi then release the button.
  • Copy/Drag the uf2 file to the portable disk (RPI-RP2) recognized.
cp main.uf2 /media/pi/RPI-RP2/

Micropython codes

Use in Windows

  • 1. Press and hold the BOOTSET button on the Pico board, connect the Pico to the USB port of the computer through the Micro USB cable, and release the button after the computer recognizes a removable hard disk (RPI-RP2).
  • 2. Copy the Rp2-pico-20210418-v1.15.7z file in the python directory to the recognized removable disk (RPI-RP2).
  • 3. Open Thonny IDE (Note: Use the latest version of Thonny, otherwise there is no Pico support package, the latest version under Windows is v3.3.3).
  • 4. Click Tools->Settings->Interpreter, and select Pico and the corresponding port as shown in the figure.

Pico-lcd-0.96-img-config.png

  • 5. File -> Open -> the corresponding .py file, click to run, as shown in the following figure:

Pico-lcd-0.96-img-run.png
This demo provides a simple program...

Use in Raspberry Pi

  • Flash the Micropython firmware first.
  • Open the Thonny IDE (Menu->Programming->Thonny Python IDE).
  • 【Optional】If the Thonny IDE in the Raspberry Pi is not the new version that supports Pico, please upgrade it first.
sudo apt upgrade thonny
  • Configure Interpreter, choose Tools->Options... -> Interpreter, choose MicroPython(Raspberry Pi Pico) and the ttyACM0 port.
400
  • Click File -> Open.. and browser the Micropython codes (Photo Interrupter Sensor.py) to run the codes.

Expected result

  • The dust data are printed to serial port:
Dust Sensor- (3).jpg

Reference:

Air quality criterion
PM2.5
density value(μg/m3)
Air quality index
AQI
Air quality level Air quality evaluation
0-35 0-50 Excellent
35-75 51-100 Average
75-115 101-150 Light pollution
115-150 151-200 Moderate pollution
150-250 201-300 Heavy pollution
250-500 ≥300 Serious pullution

The STM32 examples are based on the STM32F103RBT6 and the STM32H743. The connection provided below is based on the STM32F103RB. If you need to use other STM32 boards, you may need to change the hardware connection and port the code yourself.

Use with STM32

Hardware connection

Connect to the Development Board

  • The following sections describe the specific operation steps and experimental phenomena, using four different types of development boards as examples.

Open103R (STM32F103R)

1. Compile and download the demo.
2. Through the serial module, connect the development board USART2 interface to the computer, and the serial debug assistant is set as follows:

Baudrate 115200
Data Bit 8
Stop Bit 1
Parity Bit None
Flow Control None

3. Sensor module connection:

Sensor and Open103R Pin Correspondence Table
Module Development Board
VCC 3.3V或5V
GND GND
AOUT GPIOA.6
ILED GPIOA.7

Open407Z-C (STM32F407Z)

1. Compile and download the demo.
2. Through the serial module, connect the development board USART2 interface to the computer, and the serial debug assistant is set as follows:

Baud Rate 115200
Data Bit 8
Stop Bit 1
Parity Bit None
Flow Control None

3. Sensor module connection:

Sensor and Open407Z-C Pinout Correspondence Table
Module Development Board
VCC 3.3V/5V
GND GND
AOUT GPIOA.6
ILED GPIOA.7

NUCLEO-F103RB (STM32F103R)

This development board demo program is divided into Mbed and ST Library two versions. The operation procedures and experimental phenomena are the same.
1. Compile and download the demo.
2. Connect the development board to the computer through the USB interface, and set the serial debug assistant as follows:

Baud Rate 115200
Data Bit 8
Stop Bit 1
Parity Bit None
Flow Control None

3. Sensor module connection:

Sensor and XNUCLEO-F103RB Pin Correspondence Table
Module Development Board
VCC 3.3V/5V
GND GND
AOUT A6
ILED A4

The connection provided is the pinout of the corresponding STM32F103RBT6 as an example, if there is a need to use another STM32, please connect according to the actual pins!
Flame sensor, Hall sensor, infrared proximity sensor, liquid level sensor, soil sensor, MQ5 gas sensor, sound sensor, and UV sensor these modules pin out the same, here is the MQ5 gas sensor module with STM32F103RBT6 as an example (according to the table for connection, the diagram is for reference only):

Dust-Sensor-STM32 1.jpg

Examples

The examples are developed based on the HAL libraries. Download the Demo codes archive to your PC. Unzip and find the STM32 project from Dust-Sensor-code\STM32\STM32F103RB\MDK-ARM.

  • Open the Dust Sensor.uvprojx file by Keil.
  • Build and the project.
  • Program the project to your STM32 board.
  • Connect the UART1 of your STM32 board to the PC and check the serial data with SSCOM software.
Dust Sensor- (3).jpg

Reference:

Air quality criterion
PM2.5
density value(μg/m3)
Air quality index
AQI
Air quality level Air quality evaluation
0-35 0-50 Excellent
35-75 51-100 Average
75-115 101-150 Light pollution
115-150 151-200 Moderate pollution
150-250 201-300 Heavy pollution
250-500 ≥300 Serious pollution

The Arduino example is written for the Arduino UNO. If you want to connect it to other Arduino boards, you may need to change the connection.

Use with Arduino

Hardware connection

Sensor Arduino Description
VCC 5V Power input
GMD GND Power ground
AOUT A0 Analog data output
ILED D7 Drive pin of the internal LED
Dust-Sensor-Arduino 1.jpg

Examples

  • How to Install Arduino IDE.
  • Download the demo codes to your PC and unzip them.
  • Install the Arduino IDE on your PC.
  • Go into Dust-Sensor-code/Arduino/Dust_Sensor.
  • Run the Dust_Senosr.ino file.
  • Select the correct Board and the Port.
MQ5 Arduino 1.jpg
  • Build the project and upload it to the board.
  • Open the serial monitor of the Arduino IDE or the SSCOM software and check the serial data.
Dust Sensor- (3).jpg

Reference:

Air quality criterion
PM2.5
density value(μg/m3)
Air quality index
AQI
Air quality level Air quality evaluation
0-35 0-50 Excellent
35-75 51-100 Average
75-115 101-150 Light pollution
115-150 151-200 Moderate pollution
150-250 201-300 Heavy pollution
250-500 ≥300 Serious pollution

Resources

Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)