Difference between revisions of "Dust Sensor"
m (Text replacement - "{{#urlget:amazon|default}}=display" to "{{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}=display") |
|||
Line 2: | Line 2: | ||
<div class="tabbertab" title="Introduction"> | <div class="tabbertab" title="Introduction"> | ||
{{Infobox item|colorscheme=blue | {{Infobox item|colorscheme=blue | ||
− | |img=[[File:Dust-Sensor-intro.jpg|300px|alt=Dust-Sensor|link=http://www.waveshare.com/dust-sensor.htm | Dust_Sensor]] | + | |img=[[File:Dust-Sensor-intro.jpg|300px|alt=Dust-Sensor|{{Amazon_nolink|default={{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}|url=link=http://www.waveshare.com/dust-sensor.htm}} | Dust_Sensor]] |
|brief= | |brief= | ||
|caption=Dust Sensor, A simple Air Monitor | |caption=Dust Sensor, A simple Air Monitor |
Revision as of 08:48, 17 May 2022
| ||
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℃
- Life time: 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.
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.
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.
- If you want to use C codes, please refer to the C/C++ Guides
- If you want to use Micropython codes, please refer to the Micropython Guides.
- The link of the newest Micropython firmware of Pico
- Official Guides of Raspberry Pi Pico
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 |
Download examples
Use the 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://www.waveshare.com/w/upload/2/2a/Dust-Sensor-code.7z 7z x Dust-Sensor-code.7z -o./Dust-Sensor-code
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
- 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.
- Click File -> Open.. and browser the Micropython codes (Dust Sensor.py) to run the codes
Expected result
- The dust data are printed to serial port:
Reference:
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
Sensor | STM32 | Description |
---|---|---|
VCC | 3.3V | Power input |
GMD | GND | Power ground |
AOUT | PA6 | Analog output |
ILED | PA7 | Driver pin of internal LED |
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 by SSCOM software.
Reference:
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 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 |
Examples
- How to Install Arduino IDE
- Download the demo codes to your PC and unzip
- Install the Arduino IDE in your PC
- Go into Dust-Sensor-code/Arduino/Dust_Sensor
- Run the Dust_Senosr.ino file
- Select the correct Board and the Port
- 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.
Reference:
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 |