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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="nanoFramework.Iot.Device.Pms5003" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="nanoFramework.Iot.Device.Pms5003" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="nanoFramework.Iot.Device.Pms5003" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add nanoFramework.Iot.Device.Pms5003 --version 1.0.1
                    
#r "nuget: nanoFramework.Iot.Device.Pms5003, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package nanoFramework.Iot.Device.Pms5003@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=nanoFramework.Iot.Device.Pms5003&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=nanoFramework.Iot.Device.Pms5003&version=1.0.1
                    
Install as a Cake Tool

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 Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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