nanoFramework.Iot.Device.Sps30 1.1.639

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package nanoFramework.Iot.Device.Sps30 --version 1.1.639                
NuGet\Install-Package nanoFramework.Iot.Device.Sps30 -Version 1.1.639                
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.Sps30" Version="1.1.639" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add nanoFramework.Iot.Device.Sps30 --version 1.1.639                
#r "nuget: nanoFramework.Iot.Device.Sps30, 1.1.639"                
#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.
// Install nanoFramework.Iot.Device.Sps30 as a Cake Addin
#addin nuget:?package=nanoFramework.Iot.Device.Sps30&version=1.1.639

// Install nanoFramework.Iot.Device.Sps30 as a Cake Tool
#tool nuget:?package=nanoFramework.Iot.Device.Sps30&version=1.1.639                

Sensirion SPS30 Particulate Matter Sensor

This is a library to interact with the Sensirion SPS30 Particulate Matter Sensor. Currently, only the UART interface using the SHDLC protocol is implemented. The SPS30 also supports I2C.

sps30-image.png

Documentation

  • The datasheet for this sensor can be found here

Usage for the UART interface

Important: make sure you properly setup the UART pins for ESP32 before creating the SerialPort. For this, make sure you install the nanoFramework.Hardware.Esp32 NuGet and use the Configuration class to configure the pins:

Configuration.SetPinFunction(4, DeviceFunction.COM2_TX);
Configuration.SetPinFunction(15, DeviceFunction.COM2_RX);

Initialize the SerialPort, wrap it in the ShdlcProtocol, then pass to the Sps30Sensor:

var serial = new SerialPort("COM2", 115200, Parity.None, 8, StopBits.One);
var shdlc = new ShdlcProtocol(serial, timeoutInMillis: 10000);
var sps30 = new Sps30Sensor(shdlc);

Use the sps30 to interact with the sensor, e.g.:

var version = sps30.ReadVersion();
Debug.WriteLine($"SPS30 detected: {version}");

Collect a measurement reliably:

try { sps30.StopMeasurement(); } catch { } // In case already measuring from a previous run
sps30.StartMeasurement(MeasurementOutputFormat.Float);
Thread.Sleep(5000); // SPS30 requires some time before it can sample data
var measurement = sps30.ReadMeasuredValues();
Debug.WriteLine($"Measurement: {measurement}");

The above would output the following:

SPS30 detected: ID=00080000, serial=4E1AD1BB796C64C5, version=Firmware V2.1, Hardware V7, SHDLC V2.0, status=RawRegister: 0, FanSpeedOutOfRange: False, LaserFailure: False, FanFailureBlockedOrBroken: False, cleaninginterval=604800
Measurement: MassConcentration [µg/m³] PM1.0=2.00064229965, PM2.5=5.78215932, PM4.0=8.74958038, PM10.0=9.3430643, NumberConcentration [#/cm³] PM0.5=5.54537582, PM1.0=12.034433364, PM2.5=15.72880268, PM4.0=16.44550895, PM10.0=16.58645629, TypicalParticleSize[nm]=675.40591955

Check out the sample for more information.

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.1.852 145 6 days ago
1.1.846 145 6 days ago
1.1.838 91 13 days ago
1.1.822 98 18 days ago
1.1.790 90 a month ago
1.1.775 98 a month ago
1.1.772 103 a month ago
1.1.755 93 2 months ago
1.1.743 84 2 months ago
1.1.737 71 2 months ago
1.1.729 73 2 months ago
1.1.718 87 3 months ago
1.1.704 91 3 months ago
1.1.696 88 3 months ago
1.1.673 102 5 months ago
1.1.662 105 5 months ago
1.1.656 94 5 months ago
1.1.639 125 6 months ago
1.1.631 95 7 months ago
1.1.613 116 7 months ago
1.1.601 94 8 months ago
1.1.590 102 8 months ago
1.1.573 119 9 months ago
1.1.570 113 9 months ago
1.1.548 108 5/15/2024
1.1.536 118 4/15/2024
1.1.514 127 3/22/2024
1.1.494 108 2/28/2024
1.1.462 210 1/5/2024
1.1.458 136 12/20/2023
1.1.436 158 11/10/2023
1.1.416 123 11/8/2023
1.1.403 140 10/6/2023
1.1.396 135 9/27/2023
1.1.384 143 9/6/2023
1.1.378 153 8/16/2023
1.1.369 150 8/2/2023
1.1.363 149 7/28/2023
1.1.357 161 7/19/2023
1.1.354 151 7/14/2023
1.1.345 146 6/21/2023
1.1.341 142 6/14/2023
1.1.337 148 6/7/2023
1.1.335 141 6/2/2023
1.1.329 138 5/26/2023
1.1.313 147 5/12/2023
1.1.302 146 5/10/2023
1.1.297 146 5/3/2023
1.1.273 224 3/17/2023
1.1.267 235 3/10/2023
1.1.263 230 3/8/2023
1.1.259 259 2/27/2023
1.1.256 268 2/24/2023
1.1.253 260 2/22/2023
1.1.222 308 1/9/2023
1.1.212 299 1/5/2023
1.1.208 301 1/3/2023
1.1.203 313 12/28/2022
1.1.159 382 11/14/2022
1.1.158 353 11/13/2022
1.1.153 370 11/5/2022
1.1.141 395 10/25/2022
1.1.128 394 10/22/2022
1.1.117 422 10/10/2022
1.1.114 411 10/8/2022
1.1.89 432 9/16/2022
1.1.87 488 9/15/2022
1.1.63 408 9/3/2022
1.1.47 423 8/15/2022
1.1.40 429 8/6/2022
1.1.38 436 8/5/2022
1.1.35 411 8/4/2022
1.1.28 422 8/1/2022
1.1.13 432 7/24/2022
1.1.10 423 7/23/2022
1.0.29.3202 441 7/7/2022
1.0.20.52556 410 6/30/2022
1.0.8.35854 457 6/26/2022
1.0.3.8772 420 6/24/2022
1.0.1.57221 429 6/23/2022
0.0.0 438 6/16/2022