Skip to main content

A library to drive a AHT10 or AHT20 temperature, humidity sensor over I2C

Project description

Introduction

Python library using smbus2 for the Adafruit AHT10 or AHT20 Humidity and Temperature Sensor

Based on original solution from Adafruit repo: https://github.com/adafruit/Adafruit_CircuitPython_AHTx0

Dependency lightweight

Dependencies

This library depends on:

  • smbus2

Installing from PyPI

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

pip3 install pyAHTx0

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

sudo pip3 install pyAHTx0

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install pyAHTx0

Usage Example

import py_AHTx0

# aht10 - init
port = 1
address = 0x38

aht10_sensor = py_AHTx0.AHTx0(port, address)

while True:
    print(aht10_sensor.temperature)
    print(aht10_sensor.relative_humidity)
    time.sleep(2)

Documentation

calibrate() → bool

Ask the sensor to self-calibrate. Returns True on success, False otherwise

property relative_humidity: int

The measured relative humidity in percent.

reset() → None

Perform a soft-reset of the AHT

property status: int

The status byte initially returned from the sensor, see datasheet for details

property temperature: int

The measured temperature in degrees Celsius.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_AHTx0-0.1.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_AHTx0-0.1.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file py_AHTx0-0.1.1.tar.gz.

File metadata

  • Download URL: py_AHTx0-0.1.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.11

File hashes

Hashes for py_AHTx0-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1a4d5aa99c835b6ba514ea2de97ca6573cb43abb72193cc737f4e3865de4cc96
MD5 4c389421661e31cc0cd9803de378eb4c
BLAKE2b-256 c57a4aaa04cb38024f47fd7212fd42f4fae623b0d14da65938526431178bed84

See more details on using hashes here.

File details

Details for the file py_AHTx0-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: py_AHTx0-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.11

File hashes

Hashes for py_AHTx0-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a50677eac181ce5a4b84ba51b304867627b2f2b3b08ef4e76864fd577ea6fdbe
MD5 3b4ef0658c6e8ad491295f76ed17f279
BLAKE2b-256 bc0335fb98b2c4eee1ad88e0374eaa991d4f45f7579ebdb3f3753a5b5fc177b3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page