Template: Dust Sensor STM32 Guide

From Waveshare Wiki
Jump to: navigation, search

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