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, address=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 heater¶
The current sensor heater mode
- property humidity_resolution¶
The current relative humidity resolution in % rH.
Possibles values:
“0.020%”
“0.014%”
“0.010%”
“0.007%”
- property measurements¶
both
temperature
andrelative_humidity
, read simultaneously
- property relative_humidity¶
The current relative humidity in % rH
- 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 temp_resolution¶
The current temperature resolution in Celsius.
Possibles values:
“0.040”
“0.025”
“0.016”
“0.012”
- property temperature¶
The current temperature in degrees Celsius