nanoFramework.Iot.Device.Pms5003
1.0.1
Prefix Reserved
dotnet add package nanoFramework.Iot.Device.Pms5003 --version 1.0.1
NuGet\Install-Package nanoFramework.Iot.Device.Pms5003 -Version 1.0.1
<PackageReference Include="nanoFramework.Iot.Device.Pms5003" Version="1.0.1" />
<PackageVersion Include="nanoFramework.Iot.Device.Pms5003" Version="1.0.1" />
<PackageReference Include="nanoFramework.Iot.Device.Pms5003" />
paket add nanoFramework.Iot.Device.Pms5003 --version 1.0.1
#r "nuget: nanoFramework.Iot.Device.Pms5003, 1.0.1"
#:package nanoFramework.Iot.Device.Pms5003@1.0.1
#addin nuget:?package=nanoFramework.Iot.Device.Pms5003&version=1.0.1
#tool nuget:?package=nanoFramework.Iot.Device.Pms5003&version=1.0.1
Plantower PMS5003 particulate-matter sensor
The PMS5003 measures PM1.0, PM2.5, and PM10 mass concentration and particle counts in six size bins. This binding reads the sensor's 32-byte active-reporting frames over UART and validates the frame header, length, and checksum.
Documentation
ESP32-C3 Super Mini wiring
| PMS5003 | ESP32-C3 Super Mini | Notes |
|---|---|---|
| Pin 1 VCC | 5V | Sensor power |
| Pin 2 GND | GND | Common ground |
| Pin 4 RXD | GPIO21 (TX) | Optional for active-reporting mode |
| Pin 5 TXD | GPIO20 (RX) | Sensor data to ESP32 COM2 RX |
| Pin 3 SET | GPIO3 | Driven high for normal operation |
| Pin 6 RESET | GPIO2 | Driven high to keep the sensor out of reset |
The PMS5003 UART uses 9600 baud, 8 data bits, no parity, and one stop bit. Configure the ESP32 UART pin functions before opening SerialPort. After reset, allow 30 seconds for the fan and measurement chamber to stabilize before reading the first frame.
Usage
const int Reset = 2;
const int Set = 3;
GpioController gpioController = new GpioController();
GpioPin resetPin = gpioController.OpenPin(Reset, PinMode.Output);
GpioPin setPin = gpioController.OpenPin(Set, PinMode.Output);
setPin.Write(PinValue.High);
resetPin.Write(PinValue.Low);
Thread.Sleep(100);
resetPin.Write(PinValue.High);
Thread.Sleep(30000); // Allow the fan and measurement chamber to stabilize.
Configuration.SetPinFunction(Gpio.IO20, DeviceFunction.COM2_RX);
Configuration.SetPinFunction(Gpio.IO21, DeviceFunction.COM2_TX);
SerialPort serialPort = new SerialPort("COM2", Pms5003.DefaultBaudRate, Parity.None, 8, StopBits.One);
serialPort.ReadTimeout = 5000;
serialPort.Open();
Pms5003 sensor = new Pms5003(serialPort);
PmsReading reading = sensor.Read();
Debug.WriteLine($"PM2.5: {reading.Pm2Point5Atmospheric} ug/m3");
Read() synchronizes to the next frame header. A serial timeout is surfaced by SerialPort; malformed frames throw InvalidOperationException. Dispose the sensor to dispose its serial port, or pass shouldDispose: false to retain ownership.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net is compatible. |
-
- nanoFramework.CoreLibrary (>= 1.17.11)
- nanoFramework.Runtime.Events (>= 1.11.39)
- nanoFramework.System.Device.Model (>= 1.2.862)
- nanoFramework.System.IO.Ports (>= 1.1.142)
- nanoFramework.System.IO.Streams (>= 1.1.96)
- nanoFramework.System.Text (>= 1.3.42)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1 | 93 | 10/1/2026 |