Class Sps30Sensor
Allows for interaction with the SPS30 particulate matter sensor. Uses the SHDLC protocol as specified by Sensirion.
public class Sps30Sensor
- Inheritance
-
Sps30Sensor
Remarks
Datasheet can be found at https://sensirion.com/media/documents/8600FF88/616542B5/Sensirion_PM_Sensors_Datasheet_SPS30.pdf.
Constructors
Sps30Sensor(ShdlcProtocol)
Initializes a new instance of the Sps30Sensor class.
public Sps30Sensor(ShdlcProtocol shdlc)
Parameters
shdlc
ShdlcProtocolAn initialized ShdlcProtocol instance.
Methods
DeviceReset()
Soft reset command. After calling this command, the module is in the same state as after a Power-Reset. The reset is executed after sending the MISO response frame.
public void DeviceReset()
GetAutoCleaningInterval()
Reads the interval [s] of the periodic fan-cleaning.
public uint GetAutoCleaningInterval()
Returns
- uint
The auto cleaning interval in seconds.
GetDeviceInfoProductType()
This command returns product type with a maximum of 32 characters.
public string GetDeviceInfoProductType()
Returns
- string
The device product type as a string.
GetDeviceInfoSerialNumber()
This command returns serial number with a maximum of 32 characters.
public string GetDeviceInfoSerialNumber()
Returns
- string
The device serial number as a string.
ReadDeviceStatusRegister(bool)
Use this command to read the Device Status Register.
public DeviceStatus ReadDeviceStatusRegister(bool clearBitsAfterRead = false)
Parameters
clearBitsAfterRead
boolTrue to clear any persistent error bits after reading the status.
Returns
- DeviceStatus
The parsed device status.
ReadMeasuredValues()
Reads the measured values from the module. This command can be used to poll for new measurement values. The measurement interval is 1 second.
public Measurement ReadMeasuredValues()
Returns
- Measurement
The parsed measurement, either Float or UInt16, depending on StartMeasurement(MeasurementOutputFormat).
ReadVersion()
Gets version information about the firmware, hardware, and SHDLC protocol.
public VersionInformation ReadVersion()
Returns
- VersionInformation
The parsed version information.
SetAutoCleaningInterval(uint)
Writes the interval [s] of the periodic fan-cleaning.
public void SetAutoCleaningInterval(uint intervalInSeconds)
Parameters
intervalInSeconds
uintThe new interval in seconds.
Sleep()
Enters the Sleep-Mode with minimum power consumption. This will also deactivate the UART interface, note the wake-up sequence described at the Wake-up command.
public void Sleep()
StartFanCleaning()
Starts the fan-cleaning manually.
public void StartFanCleaning()
StartMeasurement(MeasurementOutputFormat)
Starts the measurement. After power up, the module is in Idle-Mode. Before any measurement values can be read, the Measurement-Mode needs to be started using this command.
public void StartMeasurement(MeasurementOutputFormat format)
Parameters
format
MeasurementOutputFormatThe format for the measurement, see MeasurementOutputFormat.
StopMeasurement()
Stops the measurement. Use this command to return to the initial state (Idle-Mode).
public void StopMeasurement()
WakeUp()
Use this command to switch from Sleep-Mode to Idle-Mode.
public void WakeUp()