This is a CircuitPython driver for the AM2320 temperature and humidity sensor.

  • Author(s): Limor Fried

Implementation Notes


Software and Dependencies:

class adafruit_am2320.AM2320(i2c_bus: I2C, address: int = 92)

A driver for the AM2320 temperature and humidity sensor.

  • i2c_bus (I2C) – The I2C bus the AM2320 is connected to. This is the only required parameter.

  • address (int) – (optional) The I2C address of the device. Defaults to 0x5C

Quickstart: Importing and using the AM2320

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

import board
import adafruit_am2320

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

i2c = board.I2C()   # uses board.SCL and board.SDA
am = adafruit_am2320.AM2320(i2c)

Now you have access to the temperature using temperature attribute and the relative humidity using the relative_humidity attribute

temperature = am.temperature
relative_humidity = am.relative_humidity
property relative_humidity: float

The measured relative humidity in percent.

property temperature: float

The measured temperature in Celsius.