The Plantower PMS5003 talks 9600 baud, 8N1, 3.3 V logic, and sends a 32 byte frame on its own. Aliases: PMS5003, PMS7003, Plantower, dust sensor, PM2.5 sensor, particulate matter, air quality sensor, G5.
Pins
| Pin | Name | What it does |
|---|---|---|
| 1 | VCC |
Supply, 4.5 V to 5.5 V. The fan will not run on 3.3 V. |
| 2 | GND |
Ground. |
| 3 | SET |
Low sleeps the sensor, high or open runs it. |
| 4 | RX |
Commands in, 3.3 V logic. |
| 5 | TX |
Frames out, 3.3 V logic. |
| 6 | RESET |
Low holds it in reset, high or open runs it. |
The frame
Every frame is 32 bytes: 42 4D, the length 00 1C, thirteen 16 bit words (high byte
first), and a checksum that is the sum of the 30 bytes before it. The words are PM1.0,
PM2.5 and PM10 in micrograms per cubic meter twice (the factory "CF=1" calibration, then
the atmospheric environment), the number of particles in 0.1 liter of air over 0.3, 0.5,
1.0, 2.5, 5.0 and 10 micrometers, and a last word with the version and an error code.
In active mode (the power-on mode) the sensor sends a frame about every 2.3 seconds while the dust holds steady, and every 200 to 800 ms (shorter at higher dust) while it changes by more than 10 micrograms. The first frame comes about a second after power on.
Commands
Seven bytes: 42 4D, the command, two data bytes, and a two byte checksum of the first
five bytes.
| Command | Bytes | What happens |
|---|---|---|
| Read | 42 4D E2 00 00 01 71 |
Passive mode: the sensor answers with one frame. |
| Passive mode | 42 4D E1 00 00 01 70 |
No automatic frames. Answered 42 4D 00 04 E1 00 01 74. |
| Active mode | 42 4D E1 00 01 01 71 |
Frames on their own again. Answered 42 4D 00 04 E1 01 01 75. |
| Sleep | 42 4D E4 00 00 01 73 |
Fan and laser off. Answered 42 4D 00 04 E4 00 01 77. |
| Wake | 42 4D E4 00 01 01 74 |
Back to work in the mode it had. No answer. |
A sleeping sensor hears nothing but the wake command. A command with a wrong checksum is ignored.
Properties
| Property | What it is |
|---|---|
pm1, pm25, pm10 |
The dust the sensor reports, 0 to 1000 micrograms per cubic meter. |
The three sliders on the part set them while it runs. They are cumulative masses (PM10 includes PM2.5, which includes PM1.0), so a PM2.5 set under the PM1.0 is raised to match.
Libraries
PMS.h (fu-hsi's PMS library): pms.read(data) takes one byte a call, so call it as often
as you can; data.PM_AE_UG_2_5 is the atmospheric PM2.5. activeMode(), passiveMode(),
requestRead(), sleep() and wakeUp() send the commands above.
Adafruit_PM25AQI.h: aqi.begin_UART(&pmSerial) then aqi.read(&data), with the US and
China air quality indexes worked out for you. Or read the Serial bytes yourself: wait for
42 4D, take 30 more bytes, and check the sum.
What the model gets right
The frame layout, checksum, commands and answers are the Plantower manual's, byte for byte. The two output intervals (stable and fast), the sleep and reset pins and the 4.5 V minimum supply follow it. The first frame comes a second after power on or wake.
What it does not model
There is no fan and no air inside, so the 30 seconds the manual asks for after power on before the readings are stable do not apply: the first frame already carries the sliders. The factory and atmospheric values are the same here, where a real sensor reports a smaller atmospheric value at high dust levels. The readings are exactly what is set, with none of the sensor's 10 percent error or noise. The particle counts are worked out from the three masses with a fixed size split and a density of 1.65 g/cm3, so they move the way the dust does, but a real sensor's counts depend on the dust and will not match them. The error code in the last word is always 0. The PMS3003 (24 byte frame) and the I2C PMSA003I are not this part.
Common mistakes
Powering it from a 3.3 V pin: it needs 5 V, and under 4.5 V it says nothing. Calling
pms.read() once a second: it takes one byte a call, so the frame never completes. Reading
the sensor on the Uno's hardware serial (pins 0 and 1), which the serial monitor uses: use
SoftwareSerial on two other pins, or a board with a second UART.
See it in action
PMS5003 dust monitor reads the frames with the PMS library and shows PM2.5, PM10 and an air quality grade on an I2C LCD. Open it at /templates.