adafruit_htu31d
¶
Python library for TE HTU31D temperature and humidity sensors
Author(s): ladyada, Jose D. Montoya.
Implementation Notes¶
Hardware:
Adafruit HTU31 Temperature & Humidity Sensor Breakout Board (Product ID: 4832)
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_htu31d.HTU31D(i2c_bus: I2C, address: int = 64)¶
A driver for the HTU31D temperature and humidity sensor.
- Parameters:
Quickstart: Importing and using the device
Here is an example of using the
HTU31D
class. First you will need to import the libraries to use the sensorimport board import adafruit_htu31d
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA htu = adafruit_htu31d.HTU31D(i2c)
Now you have access to the
temperature
andrelative_humidity
attributestemperature = htu.temperature relative_humidity = htu.relative_humidity
- property humidity_resolution: Literal['0.020%', '0.014%', '0.010%', '0.007%']¶
The current relative humidity resolution in % rH.
Possibles values:
“0.020%”
“0.014%”
“0.010%”
“0.007%”
- property measurements: Tuple[float, float]¶
both
temperature
andrelative_humidity
, read simultaneously
- reset() None ¶
Perform a soft reset of the sensor, resetting all settings to their power-on defaults