API Documentation

SHT3X

Sht3xDevice

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

class sensirion_i2c_sht3x.device.Sht3xDeviceBase(channel)[source]

Low level API implementation of SHT3X

__init__(channel)[source]
property channel
measure_single_shot_high_repeatability()[source]

Single shot measurement with high repeatability

Return temperature_ticks

Temperature ticks. Convert to degrees celsius by -45 + 175 * value / 65535

Return humidity_ticks

Humidity ticks. Convert to relative humidity by 100 * value / 65535

measure_single_shot_high_repeatability_clock_stretching()[source]

Single shot measurement with high repeatability and clock stretching enabled

Return temperature_ticks

Temperature ticks. Convert to degrees celsius by -45 + 175 * value / 65535

Return humidity_ticks

Humidity ticks. Convert to relative humidity by 100 * value / 65535

measure_single_shot_medium_repeatability()[source]

Single shot measurement with medium repeatability

Return temperature_ticks

Temperature ticks. Convert to degrees celsius by -45 + 175 * value / 65535

Return humidity_ticks

Humidity ticks. Convert to relative humidity by 100 * value / 65535

measure_single_shot_medium_repeatability_clock_stretching()[source]

Single shot measurement with medium repeatability and clock stretching enabled

Return temperature_ticks

Temperature ticks. Convert to degrees celsius by -45 + 175 * value / 65535

Return humidity_ticks

Humidity ticks. Convert to relative humidity by 100 * value / 65535

measure_single_shot_low_repeatability()[source]

Single shot measurement with low repeatability

Return temperature_ticks

Temperature ticks. Convert to degrees celsius by -45 + 175 * value / 65535

Return humidity_ticks

Humidity ticks. Convert to relative humidity by 100 * value / 65535

measure_single_shot_low_repeatability_clock_stretching()[source]

Single shot measurement with low repeatability and clock stretching enabled

Return temperature_ticks

Temperature ticks. Convert to degrees celsius by -45 + 175 * value / 65535

Return humidity_ticks

Humidity ticks. Convert to relative humidity by 100 * value / 65535

start_measurement_0_5_mps_high_repeatability()[source]

Start periodic measurement mode with 0.5 mps and high repeatability.

start_measurement_0_5_mps_medium_repeatability()[source]

Start periodic measurement mode with 0.5 mps and medium repeatability.

start_measurement_0_5_mps_low_repeatability()[source]

Start periodic measurement mode with 0.5 mps and low repeatability.

start_measurement_1_mps_high_repeatability()[source]

Start periodic measurement mode with 1 mps and high repeatability.

start_measurement_1_mps_medium_repeatability()[source]

Start periodic measurement mode with 1 mps and medium repeatability.

start_measurement_1_mps_low_repeatability()[source]

Start periodic measurement mode with 1 mps and low repeatability.

start_measurement_2_mps_high_repeatability()[source]

Start periodic measurement mode with 2 mps and high repeatability.

start_measurement_2_mps_medium_repeatability()[source]

Start periodic measurement mode with 2 mps and medium repeatability.

start_measurement_2_mps_low_repeatability()[source]

Start periodic measurement mode with 2 mps and low repeatability.

start_measurement_4_mps_high_repeatability()[source]

Start periodic measurement mode with 4 mps and high repeatability.

start_measurement_4_mps_medium_repeatability()[source]

Start periodic measurement mode with 4 mps and medium repeatability.

start_measurement_4_mps_low_repeatability()[source]

Start periodic measurement mode with 4 mps and low repeatability.

start_measurement_10_mps_high_repeatability()[source]

Start periodic measurement mode with 10 mps and high repeatability.

start_measurement_10_mps_medium_repeatability()[source]

Start periodic measurement mode with 10 mps and medium repeatability.

start_measurement_10_mps_low_repeatability()[source]

Start periodic measurement mode with 10 mps and low repeatability.

start_art_measurement()[source]

Start ART (accelerated response time) measurement

Note

After issuing the ART command the sensor will start acquiring data with a frequency of 4Hz.

read_measurement()[source]

Read out data after a “start measurement” or “start art measurement” command has been issued.

Return temperature_ticks

Temperature ticks. Convert to degrees celsius by -45 + 175 * value / 65535

Return humidity_ticks

Humidity ticks. Convert to relative humidity by 100 * value / 65535

Note

After the read out command fetch data has been issued, the data memory is cleared, i.e. no measurement data is present.

stop_measurement()[source]

Stop the periodic measurement mode.

Note

Upon reception of this command the sensor will abort the ongoing measurement and enter the single shot mode.

enable_heater()[source]

Enable the heater

Note

The SHT3x is equipped with an internal heater, which is meant for plausibility checking only. The temperature increase achieved by the heater depends on various parameters and lies in the range of a few degrees centigrade.

After a reset the heater is disabled (default condition).

disable_heater()[source]

Disable the heater

read_status_register()[source]

Read out the status register

Return status_register

The contents of the status register

Note

The status register contains information on the operational status of the heater, the alert mode and on the execution status of the last command and the last write sequence.

clear_status_register()[source]

Clear (set to zero) all flags (Bit 4) in the status register.

soft_reset()[source]

Perform a soft reset.

Note

A system reset of the SHT3x can be achieved in multiple ways: - Soft reset: use this command - I2C general call: all devices on the I2C bus are reset by sending the command 0x06 to the I2C address 0x00 - Reset pin: send a pulse to the dedicated nReset pin. The nReset pin has to be pulled low for a minimum of 1 µs to generate a reset of the sensor. - Hard reset: Power down (incl. pulling SDA, SCL and ADDR low)

During the reset procedure the sensor will not process commands.

class sensirion_i2c_sht3x.device.Sht3xDevice(channel)[source]

Driver class implementation of SHT3X

sht3x

Access to base class

__init__(channel)[source]
measure_single_shot(measurement_repeatability, is_clock_stretching)[source]

Single shot measurement with the specified properties

Parameters
  • measurement_repeatability – The repeatability of the periodic measurement

  • is_clock_stretching – Toggle clock stretching

Return a_temperature

Converted from ticks to degrees celsius by -45 + (175 * value / 65535)

Return a_humidity

Converted from ticks to relative humidity by 100 * value / 65535

start_periodic_measurement(measurement_repeatability, messages_per_second)[source]

Start the periodic measurement measurement mode.

This is a convenience method that selects the correct measurement command based on the provided arguments.

Parameters
  • measurement_repeatability – The repeatability of the periodic measurement

  • messages_per_second – The messages per second of the periodic measurement

blocking_read_measurement()[source]

This is a convenience method that combines polling the data ready flag and reading out the data. As the minimal measurement interval is 2s and we sleep for 100ms we iterate at most 200 times. Note that this is blocking the system for a considerable amount of time!

Return a_temperature

Converted from ticks to degrees celsius by -45 + (175 * value / 65535)

Return a_humidity

Converted from ticks to relative humidity by 100 * value / 65535

read_status_register()[source]

Read the contents of the status register

Return a_status_register

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_i2c_sht3x.commands.StatusRegisterT(int_value: int = 0)[source]
command_status = BitField(offset=1, width=1)
system_reset_detected = BitField(offset=4, width=1)
new_data_available = BitField(offset=6, width=4)
heater_status = BitField(offset=13, width=1)
class sensirion_i2c_sht3x.commands.MeasureSingleShotHighRepeatability[source]

Single shot measurement with high repeatability

CMD_ID = 9216
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
class sensirion_i2c_sht3x.commands.MeasureSingleShotHighRepeatabilityClockStretching[source]

Single shot measurement with high repeatability and clock stretching enabled

CMD_ID = 11270
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
class sensirion_i2c_sht3x.commands.MeasureSingleShotMediumRepeatability[source]

Single shot measurement with medium repeatability

CMD_ID = 9227
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
class sensirion_i2c_sht3x.commands.MeasureSingleShotMediumRepeatabilityClockStretching[source]

Single shot measurement with medium repeatability and clock stretching enabled

CMD_ID = 11277
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
class sensirion_i2c_sht3x.commands.MeasureSingleShotLowRepeatability[source]

Single shot measurement with low repeatability

CMD_ID = 9238
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
class sensirion_i2c_sht3x.commands.MeasureSingleShotLowRepeatabilityClockStretching[source]

Single shot measurement with low repeatability and clock stretching enabled

CMD_ID = 11280
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
class sensirion_i2c_sht3x.commands.StartMeasurement05MpsHighRepeatability[source]

Start periodic measurement mode with 0.5 mps and high repeatability.

CMD_ID = 8242
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.StartMeasurement05MpsMediumRepeatability[source]

Start periodic measurement mode with 0.5 mps and medium repeatability.

CMD_ID = 8228
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.StartMeasurement05MpsLowRepeatability[source]

Start periodic measurement mode with 0.5 mps and low repeatability.

CMD_ID = 8239
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.StartMeasurement1MpsHighRepeatability[source]

Start periodic measurement mode with 1 mps and high repeatability.

CMD_ID = 8496
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.StartMeasurement1MpsMediumRepeatability[source]

Start periodic measurement mode with 1 mps and medium repeatability.

CMD_ID = 8486
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.StartMeasurement1MpsLowRepeatability[source]

Start periodic measurement mode with 1 mps and low repeatability.

CMD_ID = 8493
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.StartMeasurement2MpsHighRepeatability[source]

Start periodic measurement mode with 2 mps and high repeatability.

CMD_ID = 8758
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.StartMeasurement2MpsMediumRepeatability[source]

Start periodic measurement mode with 2 mps and medium repeatability.

CMD_ID = 8736
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.StartMeasurement2MpsLowRepeatability[source]

Start periodic measurement mode with 2 mps and low repeatability.

CMD_ID = 8747
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.StartMeasurement4MpsHighRepeatability[source]

Start periodic measurement mode with 4 mps and high repeatability.

CMD_ID = 9012
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.StartMeasurement4MpsMediumRepeatability[source]

Start periodic measurement mode with 4 mps and medium repeatability.

CMD_ID = 8994
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.StartMeasurement4MpsLowRepeatability[source]

Start periodic measurement mode with 4 mps and low repeatability.

CMD_ID = 9001
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.StartMeasurement10MpsHighRepeatability[source]

Start periodic measurement mode with 10 mps and high repeatability.

CMD_ID = 10039
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.StartMeasurement10MpsMediumRepeatability[source]

Start periodic measurement mode with 10 mps and medium repeatability.

CMD_ID = 10017
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.StartMeasurement10MpsLowRepeatability[source]

Start periodic measurement mode with 10 mps and low repeatability.

CMD_ID = 10042
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.StartArtMeasurement[source]

Start ART (accelerated response time) measurement

CMD_ID = 11058
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.ReadMeasurement[source]

Read out data after a “start measurement” or “start art measurement” command has been issued.

CMD_ID = 57344
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
class sensirion_i2c_sht3x.commands.StopMeasurement[source]

Stop the periodic measurement mode.

CMD_ID = 12435
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.EnableHeater[source]

Enable the heater

CMD_ID = 12397
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.DisableHeater[source]

Disable the heater

CMD_ID = 12390
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.ReadStatusRegister[source]

Read out the status register

CMD_ID = 62253
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
class sensirion_i2c_sht3x.commands.ClearStatusRegister[source]

Clear (set to zero) all flags (Bit 4) in the status register.

CMD_ID = 12353
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.SoftReset[source]

Perform a soft reset.

CMD_ID = 12450
pack()[source]
tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
class sensirion_i2c_sht3x.commands.Repeatability(value)[source]

An enumeration.

LOW = 0
MEDIUM = 1
HIGH = 2
class sensirion_i2c_sht3x.commands.Mps(value)[source]

An enumeration.

EVERY_TWO_SECONDS = 0
ONE_PER_SECOND = 1
TWO_PER_SECOND = 2
FOUR_PER_SECOND = 4
TEN_PER_SECOND = 10

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_i2c_sht3x.result_types.SignalTemperature(temperature_ticks)[source]

Converted from ticks to degrees celsius by -45 + (175 * value / 65535)

property value
class sensirion_i2c_sht3x.result_types.SignalHumidity(humidity_ticks)[source]

Converted from ticks to relative humidity by 100 * value / 65535

property value