Introduction

Documentation Status Discord Build Status

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

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install adafruit-circuitpython-am2320

To install system-wide (this may be required in some cases):

sudo pip3 install adafruit-circuitpython-am2320

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install adafruit-circuitpython-am2320

Usage Example

See am2320_simpletest.py in the examples folder.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Documentation

For information on building library documentation, please check out this guide.

Table of Contents

Simple test

Ensure your device works with this simple test.

examples/am2320_simpletest.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import time
import board
import busio
import adafruit_am2320

# create the I2C shared bus
i2c = busio.I2C(board.SCL, board.SDA)
am = adafruit_am2320.AM2320(i2c)

while True:
    print("Temperature: ", am.temperature)
    print("Humidity: ", am.relative_humidity)
    time.sleep(2)

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 – The busio.I2C object to use. This is the only required parameter.
  • address (int) – (optional) The I2C address of the device.
relative_humidity

The measured relative humidity in percent.

temperature

The measured temperature in celsius.

Indices and tables