MicroPython SHTC3 Library

shtc3

MicroPython Driver for the Sensirion SHTC3 Temperature and Humidity Sensor

  • Author(s): Bryan Siepert, Jose D. Montoya

class micropython_shtc3.shtc3.SHTC3(i2c, address: int = 0x70)[source]

Driver for the SHTC3 Sensor connected over I2C.

Parameters:
i2c : I2C

The I2C bus the SHTC3 is connected to.

address : int

The I2C device address. Defaults to 0x70

Raises:

RuntimeError – if the sensor is not found

Quickstart: Importing and using the device

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

from machine import Pin, I2C
from micropython_shtc3 import shtc3

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

i2c = I2C(1, sda=Pin(2), scl=Pin(3))
sht = shtc3.SHTC3(i2c)

Now you have access to the attributes

temperature, relative_humidity = sht.measurements
property measurements : tuple[float, float]

Take sensor readings. Temperature and Relative Humidity

property operation_mode : str

Sensor operation_mode

Mode

Value

shtc3.SLEEP

0xB098

shtc3.WAKEUP

0x3517

property power_mode : str

Sensor power_mode

Mode

Value

shtc3.NORMAL

0x7866

shtc3.LOW_POWER

0x609C

property relative_humidity : float

The current relative humidity in % rH. This is a value from 0-100%.

property temperature : float

The current temperature in degrees Celsius