Skip to main content

A library to drive a AHT10 or AHT20 temperature, humidity sensor over I²C

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 py_AHTx0

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

sudo pip3 install py_AHTx0

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 py_AHTx0

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.2.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.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_AHTx0-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 7852c1bc87f1f519bfd5fbde5f3dc7f6ed54a9cc97c885feb1244f9b13f2dada
MD5 677e1b8658101154287cd82a15ab0922
BLAKE2b-256 de4c258c7c44fa686502bc2bf2171824b6443eaf6e5ea1d1c73a702a41cc4ec7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_AHTx0-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 585cb76c130c46d4a8ae1bb4943446a47b784093b9ddbb34c5e9a71cf6a377e2
MD5 95e3ed832ef8323f1b38a2dd4b0a14a7
BLAKE2b-256 067877f703b6efc7c2f5952fadff4d38b693b76c579e5917ee740f4c0714e443

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