adafruit_ahtx0
¶
CircuitPython driver for the Adafruit AHT10/AHT20 Temperature & Humidity Sensor
Author(s): Kattni Rembor
Implementation Notes¶
Hardware:
Adafruit AHT20 Temperature & Humidity Sensor breakout: (Product ID: 4566)
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_ahtx0.AHTx0(i2c_bus: I2C, address: int = 56)¶
Interface library for AHT10/AHT20 temperature+humidity sensors
- Parameters:
Quickstart: Importing and using the AHT10/AHT20 temperature sensor
Here is an example of using the
AHTx0
class. First you will need to import the libraries to use the sensorimport board import adafruit_ahtx0
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA aht = adafruit_ahtx0.AHTx0(i2c)
Now you have access to the temperature and humidity using the
temperature
andrelative_humidity
attributestemperature = aht.temperature relative_humidity = aht.relative_humidity