CircuitPython STTS22H Library

stts22h

CircuitPython Driver for the STTS22H Temperature Sensor

  • Author(s): Jose D. Montoya

class stts22h.STTS22H(i2c_bus: busio.I2C, address: int = 0x3C)[source]

Driver for the STTS22H Sensor connected over I2C.

Parameters:
i2c_bus : I2C

The I2C bus the STTS22H is connected to.

address : int

The I2C device address. Defaults to 0x3C

Raises:

RuntimeError – if the sensor is not found

Quickstart: Importing and using the device

Here is an example of using the STTS22H class. First you will need to import the libraries to use the sensor

import board
import stts22h

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()  # uses board.SCL and board.SDA
stts = stts22h.STTS22H(i2c)

Now you have access to the attributes

temp = stts.temperature
property high_limit : bool

The bit is automatically reset to ‘0’ upon reading the STATUS register. :return: value if the temperature exceeds the high limit

property low_limit : bool

The bit is automatically reset to ‘0’ upon reading the STATUS register. :return: value if the temperature went under the low limit

property output_data_rate : str

Sensor output_data_rate

Mode

Value

stts22h.ODR_25_HZ

0b00

stts22h.ODR_50_HZ

0b01

stts22h.ODR_100_HZ

0b10

stts22h.ODR_200_HZ

0b11

property temperature : float

The temperature sensor in Celsius :return: Temperature

property temperature_high_limit : float

Temperature High Limit

property temperature_low_limit : float

Temperature Low limit