API Documentation
SVM4X
Svm4xDevice
The class Svm4xDeviceBase implements the low level interface of the sensor. The class Svm4xDevice extends the Svm4xDeviceBase. It provides additional functions to ease the use of the sensor.
- class sensirion_uart_svm4x.device.Svm4xDeviceBase(channel)[source]
Low level API implementation of SVM4X
- property channel
- get_product_type()[source]
Gets the product type from the device.
- Return product_type
Character array containing the product type.
- get_product_name()[source]
Gets the product name from the device.
- Return product_name
Character array containing the product name.
- get_serial_number()[source]
Gets the serial number from the device.
- Return serial_number
Character array containing the serial number.
- get_version()[source]
Gets the version information for the hardware, firmware and SHDLC protocol.
- Return firmware_major
Firmware major version number.
- Return firmware_minor
Firmware minor version number.
- Return firmware_debug
Firmware debug state. If the debug state is set, the firmware is in development.
- Return hardware_major
Hardware major version number.
- Return hardware_minor
Hardware minor version number.
- Return protocol_major
Protocol major version number.
- Return protocol_minor
Protocol minor version number.
- device_reset()[source]
Executs a reset on the device.
Note
The device will reply before executing the reset. If the command is send with broadcast, the reset is done directly after the reception of the command.
- get_system_up_time()[source]
Get the system up time of the device.
- Return system_up_time
The time since the last power-on or device reset in seconds.
- start_measurement()[source]
Starts measurement in polling mode.
Note
This command is only available in idle mode.
- stop_measurement()[source]
Leaves the measurement mode and returns to the idle mode.
Note
This command is only available in measurement mode.
- read_measured_values_as_integers()[source]
Read measurement data as integers. This command is named get_signals in the datasheet.
- Return humidity
Compensated ambient humidity in % RH with a scaling factor of 100.
- Return temperature
Compensated ambient temperature in degrees celsius with a scaling of 200.
- Return voc_index
VOC index with a scaling value of 10.
- Return nox_index
NOx index with a scaling value of 10.
Note
This command is only available in measurement mode. The firmware updates the measurement values every second. Polling data with a faster sampling rate will return the same values. The first measurement is available 1 second after the start measurement command is issued. Any readout prior to this will return zero initialized values.
- read_measured_raw_values()[source]
Read measuremed raw values. This command is named get_signals_raw in the datasheet.
- Return raw_humidity
Uncompensated raw humidity in % RH as read from the SHT40 with a scaling factor of 100.
- Return raw_temperature
Uncompensated raw temperature in degrees celsius as read from the SHT40 with a scaling of 200.
- Return raw_voc_ticks
Raw VOC output ticks as read from the SGP sensor.
- Return raw_nox_ticks
Raw NOx output ticks as read from the SGP sensor.
Note
This command is only available in measurement mode. The firmware updates the measurement values every second. Polling data with a faster sampling rate will return the same values. The first measurement is available 1 second after the start measurement command is issued. Any readout prior to this will return zero initialized values.
- get_temperature_offset_for_rht_measurements()[source]
Gets the T-Offset for the temperature compensation of the RHT algorithm. This command is named get_temperature_offset in the datasheet.
- Return t_offset
Temperature offset which is used for the RHT measurements. Values are in degrees celsius with a scaling of 200. Thus the received value must be divided by 200.
- get_voc_tuning_parameters()[source]
Gets the currently set parameters for customizing the VOC algorithm. This command is named get_voc_parameters in the datasheet.
- Return voc_index_offset
VOC index representing typical (average) conditions.
- Return learning_time_offset_hours
Time constant to estimate the VOC algorithm offset from the history in hours. Past events will be forgotten after about twice the learning time.
- Return learning_time_gain_hours
Time constant to estimate the VOC algorithm gain from the history in hours. Past events will be forgotten after about twice the learning time.
- Return gating_max_duration_minutes
Maximum duration of gating in minutes (freeze of estimator during high VOC index signal). Set to zero to disable the gating.
- Return std_initial
Initial estimate for standard deviation. Lower value boosts events during initial learning period, but may result in larger device-to-device variations.
- Return gain_factor
Gain factor to amplify or to attenuate the VOC index output.
- get_nox_tuning_parameters()[source]
Gets the currently set parameters for customizing the NOx algorithm. This command is named get_nox_parameters in the datasheet.
- Return nox_index_offset
NOx index representing typical (average) conditions.
- Return learning_time_offset_hours
Time constant to estimate the NOx algorithm offset from the history in hours. Past events will be forgotten after about twice the learning time.
- Return learning_time_gain_hours
The time constant to estimate the NOx algorithm gain from the history has no impact for NOx. This parameter is still in place for consistency reasons with the VOC tuning parameters command. This getter will always return the default value.
- Return gating_max_duration_minutes
Maximum duration of gating in minutes (freeze of estimator during high NOx index signal). Set to zero to disable the gating.
- Return std_initial
The initial estimate for standard deviation has no impact for NOx. This parameter is still in place for consistency reasons with the VOC tuning parameters command. This getter will always return the default value.
- Return gain_factor
Gain factor to amplify or to attenuate the NOx index output.
- store_nv_data()[source]
This command stores all parameters previously set with the commands set_temperature_offset_for_rht_measurements, set_voc_tuning_parameters and set_nox_tuning_parameters to the non-volatile memory of SVM4x. These parameters will not be erased during reset and will be used by the corresponding algorithms after start-up. To reset the storage to factory settings the master has to set all parameters to the default values followed by a subsequent call of the store_nv_data command. This command is named store_input_parameters in the datasheet.
- set_temperature_offset_for_rht_measurements(t_offset)[source]
Sets the T-Offset for the temperature compensation of the RHT algorithm.
- Parameters
t_offset – Temperature offset in degrees celsius. Accepted data formats is a int16 value (2 bytes). Values are in degrees celsius with a scaling of 200. Thus the provided value must be multiplied by 200.
Note
Execute the store command after writing the parameter to store it in the non- volatile memory of the device otherwise the parameter will be reset upton a device reset.
- set_voc_tuning_parameters(voc_index_offset, learning_time_offset_hours, learning_time_gain_hours, gating_max_duration_minutes, std_initial, gain_factor)[source]
Sets parameters to customize the VOC algorithm. This command is only available in idle mode. This command is named set_voc_parameters in the datasheet.
- Parameters
voc_index_offset – VOC index representing typical (average) conditions. Allowed values are in range 1..250. The default value is 100.
learning_time_offset_hours – Time constant to estimate the VOC algorithm offset from the history in hours. Past events will be forgotten after about twice the learning time. Allowed values are in range 1..1000. The default value is 12 hours.
learning_time_gain_hours – Time constant to estimate the VOC algorithm gain from the history in hours. Past events will be forgotten after about twice the learning time. Allowed values are in range 1..1000. The default value is 12 hours.
gating_max_duration_minutes – Maximum duration of gating in minutes (freeze of estimator during high VOC index signal). Set to zero to disable the gating. Allowed values are in range 0..3000. The default value is 180 minutes.
std_initial – Initial estimate for standard deviation. Lower value boosts events during initial learning period, but may result in larger device-to-device variations. Allowed values are in range 10..5000. The default value is 50.
gain_factor – Gain factor to amplify or to attenuate the VOC index output. Allowed values are in range 1..1000. The default value is 230.
Note
Execute the store command after writing the parameter to store it in the non- volatile memory of the device otherwise the parameter will be reset upton a device reset.
- set_nox_tuning_parameters(nox_index_offset, learning_time_offset_hours, learning_time_gain_hours, gating_max_duration_minutes, std_initial, gain_factor)[source]
Sets parameters to customize the NOx algorithm. This command is only available in idle mode. This command is named set_nox_parameters in the datasheet.
- Parameters
nox_index_offset – NOx index representing typical (average) conditions. Allowed values are in range 1..250. The default value is 1.
learning_time_offset_hours – Time constant to estimate the NOx algorithm offset from the history in hours. Past events will be forgotten after about twice the learning time. Allowed values are in range 1..1000. The default value is 12 hours.
learning_time_gain_hours – The time constant to estimate the NOx algorithm gain from the history has no impact for the NOx algorithm. This parameter is still in place for consistency reasons with the VOC tuning parameters command. This parameter must always be set to 12 hours.
gating_max_duration_minutes – Maximum duration of gating in minutes (freeze of estimator during high NOx index signal). Set to zero to disable the gating. Allowed values are in range 0..3000. The default value is 720 minutes.
std_initial – The initial estimate for standard deviation parameter has no impact for the NOx algorithm. This parameter is still in place for consistency reasons with the VOC tuning parameters command. This parameter must always be set to 50.
gain_factor – Gain factor to amplify or to attenuate the NOx index output. Allowed values are in range 1..1000. The default value is 230.
Note
Execute the store command after writing the parameter to store it in the non- volatile memory of the device otherwise the parameter will be reset upton a device reset.
- get_voc_state()[source]
Gets the current VOC algorithm state. Retrieved values can be used to set the VOC algorithm state to resume operation after a short interruption, skipping initial learning phase. This command is only available during measurement mode.
- Return state
Current VOC algorithm state.
Note
This feature can only be used after at least 3 hours of continuous operation.
- set_voc_state(state)[source]
Set previously retrieved VOC algorithm state to resume operation after a short interruption, skipping initial learning phase. This command is only available in idle mode.
- Parameters
state – Current VOC algorithm state.
Note
This feature should not be used after interruptions of more than 10 minutes.
- class sensirion_uart_svm4x.device.Svm4xDevice(channel)[source]
Driver class implementation of SVM4X
- svm4x
Access to base class
- read_measured_values()[source]
Read measurement data and apply scaling.
- Return a_humidity
Compensated ambient humidity in %RH.
- Return a_temperature
Compensated ambient temperature in degrees celsius.
- Return a_voc_index
VOC Index
- Return a_nox_index
NOx Index
- get_temperature_offset_for_rht_measurements()[source]
Gets the T-Offset for the temperature compensation of the RHT algorithm.
- Return arg_0
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_svm4x.commands.GetProductType[source]
Gets the product type from the device.
- CMD_ID = 208
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_svm4x.commands.GetProductName[source]
Gets the product name from the device.
- CMD_ID = 208
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_svm4x.commands.GetSerialNumber[source]
Gets the serial number from the device.
- CMD_ID = 208
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_svm4x.commands.GetVersion[source]
Gets the version information for the hardware, firmware and SHDLC protocol.
- CMD_ID = 209
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_svm4x.commands.DeviceReset[source]
Executs a reset on the device.
- CMD_ID = 211
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- post_processing_time = 0.1
- class sensirion_uart_svm4x.commands.GetSystemUpTime[source]
Get the system up time of the device.
- CMD_ID = 147
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_svm4x.commands.StartMeasurement[source]
Starts measurement in polling mode.
- CMD_ID = 0
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- class sensirion_uart_svm4x.commands.StopMeasurement[source]
Leaves the measurement mode and returns to the idle mode.
- CMD_ID = 1
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- class sensirion_uart_svm4x.commands.ReadMeasuredValuesAsIntegers[source]
Read measurement data as integers. This command is named get_signals in the datasheet.
- CMD_ID = 3
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_svm4x.commands.ReadMeasuredRawValues[source]
Read measuremed raw values. This command is named get_signals_raw in the datasheet.
- CMD_ID = 3
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_svm4x.commands.GetTemperatureOffsetForRhtMeasurements[source]
Gets the T-Offset for the temperature compensation of the RHT algorithm. This command is named get_temperature_offset in the datasheet.
- CMD_ID = 96
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_svm4x.commands.GetVocTuningParameters[source]
Gets the currently set parameters for customizing the VOC algorithm. This command is named get_voc_parameters in the datasheet.
- CMD_ID = 96
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_svm4x.commands.GetNoxTuningParameters[source]
Gets the currently set parameters for customizing the NOx algorithm. This command is named get_nox_parameters in the datasheet.
- CMD_ID = 96
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_svm4x.commands.StoreNvData[source]
This command stores all parameters previously set with the commands set_temperature_offset_for_rht_measurements, set_voc_tuning_parameters and set_nox_tuning_parameters to the non-volatile memory of SVM4x. These parameters will not be erased during reset and will be used by the corresponding algorithms after start-up. To reset the storage to factory settings the master has to set all parameters to the default values followed by a subsequent call of the store_nv_data command. This command is named store_input_parameters in the datasheet.
- CMD_ID = 96
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- class sensirion_uart_svm4x.commands.SetTemperatureOffsetForRhtMeasurements(t_offset)[source]
Sets the T-Offset for the temperature compensation of the RHT algorithm.
- CMD_ID = 96
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- class sensirion_uart_svm4x.commands.SetVocTuningParameters(voc_index_offset, learning_time_offset_hours, learning_time_gain_hours, gating_max_duration_minutes, std_initial, gain_factor)[source]
Sets parameters to customize the VOC algorithm. This command is only available in idle mode. This command is named set_voc_parameters in the datasheet.
- CMD_ID = 96
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- class sensirion_uart_svm4x.commands.SetNoxTuningParameters(nox_index_offset, learning_time_offset_hours, learning_time_gain_hours, gating_max_duration_minutes, std_initial, gain_factor)[source]
Sets parameters to customize the NOx algorithm. This command is only available in idle mode. This command is named set_nox_parameters in the datasheet.
- CMD_ID = 96
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- class sensirion_uart_svm4x.commands.GetVocState[source]
Gets the current VOC algorithm state. Retrieved values can be used to set the VOC algorithm state to resume operation after a short interruption, skipping initial learning phase. This command is only available during measurement mode.
- CMD_ID = 97
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_svm4x.commands.SetVocState(state)[source]
Set previously retrieved VOC algorithm state to resume operation after a short interruption, skipping initial learning phase. This command is only available in idle mode.
- CMD_ID = 97
- 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.
- class sensirion_uart_svm4x.result_types.SignalTemperature(temperature_raw)[source]
Compensated ambient temperature in degrees celsius.
- property value
- class sensirion_uart_svm4x.result_types.SignalHumidity(humidity_raw)[source]
Compensated ambient humidity in %RH.
- property value