API Documentation

SPS30

Sps30Device

The class Sps30DeviceBase implements the low level interface of the sensor. The class Sps30Device extends the Sps30DeviceBase. It provides additional functions to ease the use of the sensor.

class sensirion_uart_sps30.device.Sps30DeviceBase(channel)[source]

Low level API implementation of SPS30

__init__(channel)[source]
property channel
start_measurement(measurement_output_format)[source]

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.

Parameters:

measurement_output_format – Possible enum values: output_format_float, output_format_uint16

Note

This command can only be executed in Idle-Mode.

Example:
sensor.start_measurement(OutputFormat(261))
stop_measurement()[source]

Use this command to return to the Idle-Mode.

read_measurement_values_uint16()[source]

Reads the measured values from the module. If no new measurement values are available, the module returns an empty response frame.

Return mc_1p0:

Mass Concentration PM1.0 [µg/m³]

Return mc_2p5:

Mass Concentration PM2.5 [µg/m³]

Return mc_4p0:

Mass Concentration PM4.0 [µg/m³]

Return mc_10p0:

Mass Concentration PM10.0 [µg/m³]

Return nc_0p5:

Number Concentration PM0.5 [#/cm³]

Return nc_1p0:

Number Concentration PM1.0 [#/cm³]

Return nc_2p5:

Number Concentration PM2.5 [#/cm³]

Return nc_4p0:

Number Concentration PM4.0 [#/cm³]

Return nc_10p0:

Number Concentration PM10.0 [#/cm³]

Return typical_particle_size:

Typical Particle Size [µm]

read_measurement_values_float()[source]

Reads the measured values from the module. If no new measurement values are available, the module returns an empty response frame.

Return mc_1p0:

Mass Concentration PM1.0 [µg/m³]

Return mc_2p5:

Mass Concentration PM2.5 [µg/m³]

Return mc_4p0:

Mass Concentration PM4.0 [µg/m³]

Return mc_10p0:

Mass Concentration PM10.0 [µg/m³]

Return nc_0p5:

Number Concentration PM0.5 [#/cm³]

Return nc_1p0:

Number Concentration PM1.0 [#/cm³]

Return nc_2p5:

Number Concentration PM2.5 [#/cm³]

Return nc_4p0:

Number Concentration PM4.0 [#/cm³]

Return nc_10p0:

Number Concentration PM10.0 [#/cm³]

Return typical_particle_size:

Typical Particle Size [µm]

sleep()[source]

Enters the Sleep-Mode with minimum power consumption. This will also deactivate the UART interface.

Note

This command can only be executed in Idle-Mode.

wake_up_communication()[source]
wake_up()[source]

Use this command to switch from Sleep-Mode to Idle-Mode. In Sleep-Mode the UART interface is disabled and must first be activated by sending a low pulse on the RX pin. This pulse is generated by sending a single byte with the value 0xFF. If then a Wake-up command follows within 100ms, the module will switch on again and is ready for further commands in the Idle-Mode.

Alternatively, if the software implementation does not allow to send a single byte with the value 0xFF, the Wake-up command can be sent twice in succession. In this case the first Wake-up command is ignored, but causes the interface to be activated.

start_fan_cleaning()[source]

Starts fan cleaning manually

Note

This command can only be executed in Measurement-Mode.

read_auto_cleaning_interval()[source]

Reads auto cleaning interval of the periodic fan-cleaning

Return auto_cleaning_interval:

Interval in seconds

write_auto_cleaning_interval(auto_cleaning_interval)[source]

Writes auto cleaning interval of the periodic fan-cleaning

Parameters:

auto_cleaning_interval – Interval in seconds

Example:
sensor.write_auto_cleaning_interval(604800)
read_product_type()[source]

This command returns the product type. It is defined as a string value with a length of 8 ASCII characters (excluding terminating null-character)

Return product_type:

8-byte ASCII string + null-character

read_serial_number()[source]

This command returns the serial number. It is defined as a string value with a maximum length of 32 ASCII characters (including terminating null-character)

Return serial_number:

32-byte ASCII string

read_version()[source]

Gets version information about the firmware, hardware, and SHDLC protocol.

Return firmware_major_version:

Return firmware_minor_version:

Return reserved1:

Return hardware_revision:

Return reserved2:

Return shdlc_major_version:

Return shdlc_minor_version:

read_device_status_register(clear_status_register)[source]

Use this command to read the device status register. For more details, check explanations given in chapter 4.4 of the datasheet.

Parameters:

clear_status_register – To clear the status register after reading set to true, otherwise set to false.

Return device_status_register:

Return reserved:

device_reset()[source]

Device software reset command. After calling this command, the module is in the same state as after a power reset.

Note

To perform a reset when the sensor is in sleep mode, it is required to send first a wake-up sequence to activate the interface.

class sensirion_uart_sps30.device.Sps30Device(channel)[source]

Driver class implementation of SPS30

sps30

Access to base class

__init__(channel)[source]
wake_up_sequence()[source]

Fully wake up the device

Commands

The transfer classes specify the data that is transferred between host and sensor. The generated transfer classes are used by the driver class and not intended for direct use.

class sensirion_uart_sps30.commands.OutputFormat(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
OUTPUT_FORMAT_FLOAT = 259
OUTPUT_FORMAT_UINT16 = 261
class sensirion_uart_sps30.commands.StartMeasurement(measurement_output_format)[source]

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.

CMD_ID = 0
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_uart_sps30.commands.StopMeasurement[source]

Use this command to return to the Idle-Mode.

CMD_ID = 1
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_uart_sps30.commands.ReadMeasurementValuesUint16[source]

Reads the measured values from the module. If no new measurement values are available, the module returns an empty response frame.

CMD_ID = 3
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
class sensirion_uart_sps30.commands.ReadMeasurementValuesFloat[source]

Reads the measured values from the module. If no new measurement values are available, the module returns an empty response frame.

CMD_ID = 3
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
class sensirion_uart_sps30.commands.Sleep[source]

Enters the Sleep-Mode with minimum power consumption. This will also deactivate the UART interface.

CMD_ID = 16
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_uart_sps30.commands.WakeUpCommunication[source]
CMD_ID = 255
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_uart_sps30.commands.WakeUp[source]

Use this command to switch from Sleep-Mode to Idle-Mode. In Sleep-Mode the UART interface is disabled and must first be activated by sending a low pulse on the RX pin. This pulse is generated by sending a single byte with the value 0xFF. If then a Wake-up command follows within 100ms, the module will switch on again and is ready for further commands in the Idle-Mode.

Alternatively, if the software implementation does not allow to send a single byte with the value 0xFF, the Wake-up command can be sent twice in succession. In this case the first Wake-up command is ignored, but causes the interface to be activated.

CMD_ID = 17
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_uart_sps30.commands.StartFanCleaning[source]

Starts fan cleaning manually

CMD_ID = 86
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_uart_sps30.commands.ReadAutoCleaningInterval[source]

Reads auto cleaning interval of the periodic fan-cleaning

CMD_ID = 128
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
class sensirion_uart_sps30.commands.WriteAutoCleaningInterval(auto_cleaning_interval)[source]

Writes auto cleaning interval of the periodic fan-cleaning

CMD_ID = 128
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_uart_sps30.commands.ReadProductType[source]

This command returns the product type. It is defined as a string value with a length of 8 ASCII characters (excluding terminating null-character)

CMD_ID = 208
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
class sensirion_uart_sps30.commands.ReadSerialNumber[source]

This command returns the serial number. It is defined as a string value with a maximum length of 32 ASCII characters (including terminating null-character)

CMD_ID = 208
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
class sensirion_uart_sps30.commands.ReadVersion[source]

Gets version information about the firmware, hardware, and SHDLC protocol.

CMD_ID = 209
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
class sensirion_uart_sps30.commands.ReadDeviceStatusRegister(clear_status_register)[source]

Use this command to read the device status register. For more details, check explanations given in chapter 4.4 of the datasheet.

CMD_ID = 210
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
class sensirion_uart_sps30.commands.DeviceReset[source]

Device software reset command. After calling this command, the module is in the same state as after a power reset.

CMD_ID = 211
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>

Result Types

The signal classes specify transformations of the raw sensor signals into a meaningful units. The generated signal types are used by the driver class and not intended for direct use.