adafruit_sht4x
¶
Python library for Sensirion SHT4x temperature and humidity sensors
Author(s): ladyada
Implementation Notes¶
Hardware:
Adafruit SHT40 Temperature & Humidity Sensor (Product ID: 4885)
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- class adafruit_sht4x.CV¶
struct helper
- classmethod add_values(value_tuples)¶
Add CV values to the class
- classmethod is_valid(value)¶
Validate that a given value is a member
- class adafruit_sht4x.Mode¶
Options for
power_mode
- class adafruit_sht4x.SHT4x(i2c_bus, address=68)¶
A driver for the SHT4x temperature and humidity sensor.
- Parameters
Quickstart: Importing and using the SHT4x temperature and humidity sensor
Here is an example of using the
SHT4x
. First you will need to import the libraries to use the sensorimport board import adafruit_sht4x
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA sht = adafruit_sht4x.SHT4x(i2c)
You can now make some initial settings on the sensor
sht.mode = adafruit_sht4x.Mode.NOHEAT_HIGHPRECISION
Now you have access to the temperature and humidity using the
measurements
. It will return a tuple with thetemperature
andrelative_humidity
measurementstemperature, relative_humidity = sht.measurements
- property measurements¶
both
temperature
andrelative_humidity
, read simultaneously
- property mode¶
The current sensor reading mode (heater and precision)
- property relative_humidity¶
The current relative humidity in % rH. This is a value from 0-100%.
- reset()¶
Perform a soft reset of the sensor, resetting all settings to their power-on defaults
- property serial_number¶
The unique 32-bit serial number
- property temperature¶
The current temperature in degrees Celsius