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.
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:
- Adafruit AM2320 Temperature & Humidity Sensor (Product ID: 3721)
Software and Dependencies:
- Adafruit CircuitPython firmware for the ESP8622 and M0-based boards:
- https://github.com/adafruit/circuitpython/releases
- Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
-
class
adafruit_am2320.
AM2320
(i2c_bus, address=92)¶ A driver for the AM2320 temperature and humidity sensor.
Parameters: -
relative_humidity
¶ The measured relative humidity in percent.
-
temperature
¶ The measured temperature in celsius.
-
-
exception
adafruit_am2320.
AM2320DeviceNotFound
¶ Indicates that a device couldn’t be found.
-
exception
adafruit_am2320.
AM2320Exception
¶ Base class for exceptions.
-
exception
adafruit_am2320.
AM2320ReadError
¶ indicates that valid data could not be read from the sensor.
This may be due to a regular I2C read failure, or due to a checksum mismatch.