Search the Knowledge Base
Measuring Particulate Matter Using a PMS5003 Sensor & Arduino UNO
Tutorial Aim:
The goal of this tutorial is to measure & display the number of suspended particles in the air (particle concentration) using a PMS5003 air quality sensor with an Arduino UNO.
Requirements:
This tutorial makes use of the Arduino IDE 2.3
- Arduino IDE
- Arduino (Compatible) UNO R3 with USB cable
- PM2.5 Air Quality Sensor Module – PMS5003
- 4 MM Jumper Wires
PMS5003 Pin Layout:
Please note that the pins for a PMS5003 are numbered right to left as seen in the image below. In this tutorial we’ll be ignoring PMS5003 pins 3 & 6.
| Pin | Function | Description | Remarks | Arduino Pin | |
|---|---|---|---|---|---|
| 1 | VCC | Supply voltage 5V | 4.5 – 5.5V | 5V | |
| 2 | GND | Ground | GND | ||
| 3 | SET | HIGH or SUSPENDED – work mode LOW – sleep mode | 3.3V logic | N/A | |
| 4 | RXD | UART/TTL data recieve | 3.3V logic | 2 | |
| 5 | TXD | UART/TTL data transmit | 3.3V logic | 3 | |
| 6 | Reset | LOW to reset | 3.3V logic | N/A | |
| 7 | NC | Not connected | N/A | ||
| 8 | NC | Not connected | N/A |
Code Walk Through:
Libraries:
To access & communicate with the sensor we include the SoftwareSerial library, so that we can use Serial communication with the digital pins. For information about the SoftwareSerial library, please visit the Arduino doc page.
The struct pms5003 is designed to contain all the sensor outputs, as well as the checksum so that we can check if the data was successfully read.
Particulate Matter Sensor Code:
Entire tutorial code for your reference. Please note that the code is available in the download section.
Downloadable Content:
Please find this tutorial’s code on our GitHub page.
Credits:
- Maker Community
- The Arduino Community
- The STEM Community
