adafruit_am2320

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

  • Author(s): Limor Fried

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_am2320.AM2320(i2c_bus, address=92)

A driver for the AM2320 temperature and humidity sensor.

Parameters:
  • 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
relative_humidity

The measured relative humidity in percent.

temperature

The measured temperature in Celsius.