API Documentation
SFX6XXX
Sfx6xxxDevice
The class Sfx6xxxDeviceBase implements the low level interface of the sensor. The class Sfx6xxxDevice extends the Sfx6xxxDeviceBase. It provides additional functions to ease the use of the sensor.
- class sensirion_uart_sfx6xxx.device.Sfx6xxxDeviceBase(channel)[source]
Low level API implementation of SFX6XXX
- property channel
- set_setpoint(setpoint)[source]
Set the flow setpoint as a physical value which is used by the flow controller as reference input.
- Parameters
setpoint – The new setpoint.
- get_setpoint()[source]
Get the current flow setpoint as a physical value.
- Return setpoint
The current setpoint.
- read_measured_value()[source]
The command returns the latest measured flow as physical value.
- Return measured_value
The latest measured flow.
- read_averaged_measured_value(measurements)[source]
The command returns the average of given number of flow measurement as physical value. A single measurement has a duration of 1ms, so the command response time depends on the given number of measurements to average.
- Parameters
measurements – number of measurements to average (1..100)
- Return averaged_measured_value
The averaged flow measurement.
- set_setpoint_and_read_measured_value(setpoint)[source]
This command is a combination of the two commands set_setpoint (0x00) and read_measured_value (0x08). It is intended for process data exchange (setpoint and flow) and saves a lot of protocol overhead compared to separate command usage.
- Parameters
setpoint – The new setpoint as physical value.
- Return measured_value
The latest measured flow as physical value.
- set_user_controller_gain(gain)[source]
Set the user controller gain.
- Parameters
gain – The user controller gain to set.
- get_user_controller_gain()[source]
Get the user controller gain.
- Return gain
The current user controller gain.
- set_user_init_step(init_step)[source]
Set the init step of flow controller.
- Parameters
init_step – the user init step to set.
- get_user_init_step()[source]
Get the user init step of flow controller.
- Return init_step
The current user init step.
- measure_raw_flow()[source]
Return the measured raw flow ticks from the sensor.
- Return flow
Measured raw flow in ticks.
- measure_raw_thermal_conductivity_with_closed_valve()[source]
Perform a thermal conductivity measurement and return the measured raw tick value. The valve is automatically closed during the measurement.
- Return thermal_conductivity
Measured raw thermal conductivity in ticks.
- measure_temperature()[source]
Return the temperature of flow sensor.
- Return temperature
Measured temperature [°C].
- get_number_of_calibrations()[source]
Get the number of calibrations, i.e. how many calibration the device memory is able to hold.
- Return number_of_calibrations
Number of calibrations.
- get_calibration_validity(index)[source]
Check whether there exists a valid calibration at a specific index or not.
- Parameters
index – The index to check whether there is a valid calibration or not.
- Return validity
Whether there exists a valid calibration at the specified index or not.
- get_calibration_gas_id(index)[source]
Get the gas ID of a specific calibration index.
- Parameters
index – The calibration index to read the requested information from.
- Return gas_id
The read gas ID.
- get_calibration_gas_unit(index)[source]
Get the gas unit of a specific calibration index.
- Parameters
index – The calibration index to read the requested information from.
- Return prefix
Medium unit prefix, see appendix for encoding.
- Return unit
Medium unit, see appendix for encoding.
- Return timebase
Timebase, see appendix for encoding.
- get_calibration_fullscale(index)[source]
Get the fullscale flow of a specific calibration index.
- Parameters
index – The calibration index to read the requested information from.
- Return fullscale
The read fullscale flow in the unit of the corresponding calibration.
- get_current_gas_id()[source]
Get the gas ID of the currently active calibration.
- Return gas_id
The read gas ID.
- get_current_gas_unit()[source]
Get the gas unit of the currently active calibration.
- Return prefix
Medium unit prefix, see datasheet for encoding.
- Return unit
Medium unit, see datasheet for encoding.
- Return timebase
Timebase, see datasheet for encoding.
- get_current_fullscale()[source]
Get the fullscale flow of the currently active calibration.
- Return fullscale
The read fullscale flow in the unit of the corresponding calibration.
- set_calibration(calibration_number)[source]
This command stops the controller, changes the used calibration of the flow controller and starts the controller. The selected calibration is stored and also used after a power-on or reset.
- Parameters
calibration_number – The calibration number to activate.
- get_calibration()[source]
Get the actual set calibration number of flow controller.
- Return calibration_number
The current activated calibration number.
- set_calibration_volatile(calibration_number)[source]
This command stops the controller, changes the used calibration of the flow controller and starts the controller. The selected calibration is not stored to a non volatile memory.
- Parameters
calibration_number – The calibration number to activate.
- set_slave_address(slave_address)[source]
Sets the SHDLC slave address of the device.
- Parameters
slave_address – The new slave address to set.
- get_slave_address()[source]
Gets the SHDLC slave address of the device.
- Return slave_address
The current slave address of the device.
- set_baudrate(baudrate)[source]
Sets the SHDLC baudrate of the device.
- Parameters
baudrate – The new baudrate in bit/s. Allowed values are 9600, 19200, 38400, 57600 and 115200 (default)
- get_baudrate()[source]
Gets the SHDLC baudrate of the device.
- Return baudrate
Current baudrate in bit/s.
- get_product_type()[source]
Gets the product type from the device.
- Return product_type
String containing the product type.
- get_product_name()[source]
Gets the product name from the device.
- Return product_name
String containing the product name.
- get_article_code()[source]
Get the article code of the device. This information is also contained on the product label.
- Return article_code
The article code as an ASCII string.
- get_serial_number()[source]
Gets the serial number of the SFx6xxx sensor.
- Return serial_number
String containing the serial number of the SFx6xxx sensor.
- 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.
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_sfx6xxx.commands.StatusCode(value)[source]
An enumeration.
- SUCCESS = 0
- DATA_SIZE_ERROR = 1
- UNKNOWN_COMMAND_ERROR = 2
- PARAMETER_ERROR = 4
- I2C_NACK_ERROR = 41
- I2C_MASTER_HOLD_ERROR = 42
- I2C_CRC_ERROR = 43
- SENSOR_DATA_WRITE_ERROR = 44
- SENSOR_MEASURE_LOOP_NOT_RUNNING_ERROR = 45
- INVALID_CALIBRATION_INDEX_ERROR = 51
- SENSOR_BUSY_ERROR = 66
- COMMAND_NOT_ALLOWED_IN_CURRENT_STATE = 67
- FATAL_ERROR = 127
- class sensirion_uart_sfx6xxx.commands.SetSetpoint(setpoint)[source]
Set the flow setpoint as a physical value which is used by the flow controller as reference input.
- CMD_ID = 0
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- class sensirion_uart_sfx6xxx.commands.GetSetpoint[source]
Get the current flow setpoint as a physical value.
- CMD_ID = 0
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.ReadMeasuredValue[source]
The command returns the latest measured flow as physical value.
- CMD_ID = 8
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.ReadAveragedMeasuredValue(measurements)[source]
The command returns the average of given number of flow measurement as physical value. A single measurement has a duration of 1ms, so the command response time depends on the given number of measurements to average.
- CMD_ID = 8
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.SetSetpointAndReadMeasuredValue(setpoint)[source]
This command is a combination of the two commands set_setpoint (0x00) and read_measured_value (0x08). It is intended for process data exchange (setpoint and flow) and saves a lot of protocol overhead compared to separate command usage.
- CMD_ID = 3
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.SetUserControllerGain(gain)[source]
Set the user controller gain.
- CMD_ID = 34
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- class sensirion_uart_sfx6xxx.commands.GetUserControllerGain[source]
Get the user controller gain.
- CMD_ID = 34
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.SetUserInitStep(init_step)[source]
Set the init step of flow controller.
- CMD_ID = 34
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- class sensirion_uart_sfx6xxx.commands.GetUserInitStep[source]
Get the user init step of flow controller.
- CMD_ID = 34
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.MeasureRawFlow[source]
Return the measured raw flow ticks from the sensor.
- CMD_ID = 48
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.MeasureRawThermalConductivityWithClosedValve[source]
Perform a thermal conductivity measurement and return the measured raw tick value. The valve is automatically closed during the measurement.
- CMD_ID = 48
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.MeasureTemperature[source]
Return the temperature of flow sensor.
- CMD_ID = 48
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.GetNumberOfCalibrations[source]
Get the number of calibrations, i.e. how many calibration the device memory is able to hold.
- CMD_ID = 64
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.GetCalibrationValidity(index)[source]
Check whether there exists a valid calibration at a specific index or not.
- CMD_ID = 64
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.GetCalibrationGasId(index)[source]
Get the gas ID of a specific calibration index.
- CMD_ID = 64
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.GetCalibrationGasUnit(index)[source]
Get the gas unit of a specific calibration index.
- CMD_ID = 64
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.GetCalibrationFullscale(index)[source]
Get the fullscale flow of a specific calibration index.
- CMD_ID = 64
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.GetCurrentGasId[source]
Get the gas ID of the currently active calibration.
- CMD_ID = 68
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.GetCurrentGasUnit[source]
Get the gas unit of the currently active calibration.
- CMD_ID = 68
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.GetCurrentFullscale[source]
Get the fullscale flow of the currently active calibration.
- CMD_ID = 68
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.SetCalibration(calibration_number)[source]
This command stops the controller, changes the used calibration of the flow controller and starts the controller. The selected calibration is stored and also used after a power-on or reset.
- CMD_ID = 69
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- class sensirion_uart_sfx6xxx.commands.GetCalibration[source]
Get the actual set calibration number of flow controller.
- CMD_ID = 69
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.SetCalibrationVolatile(calibration_number)[source]
This command stops the controller, changes the used calibration of the flow controller and starts the controller. The selected calibration is not stored to a non volatile memory.
- CMD_ID = 70
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- class sensirion_uart_sfx6xxx.commands.SetSlaveAddress(slave_address)[source]
Sets the SHDLC slave address of the device.
- CMD_ID = 144
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- class sensirion_uart_sfx6xxx.commands.GetSlaveAddress[source]
Gets the SHDLC slave address of the device.
- CMD_ID = 144
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.SetBaudrate(baudrate)[source]
Sets the SHDLC baudrate of the device.
- CMD_ID = 145
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- class sensirion_uart_sfx6xxx.commands.GetBaudrate[source]
Gets the SHDLC baudrate of the device.
- CMD_ID = 145
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.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_sfx6xxx.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_sfx6xxx.commands.GetArticleCode[source]
Get the article code of the device. This information is also contained on the product label.
- CMD_ID = 208
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_uart_sfx6xxx.commands.GetSerialNumber[source]
Gets the serial number of the SFx6xxx sensor.
- CMD_ID = 208
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData 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.