Skip to main content

dhtsensor

Simplifies reading temperature and humidity data from a DHT11/22 sensor using pigpio

Requirements

pip install pigpio

Install

pip install dhtsensor

Quickstart

# Create a new Sensor object for a DHT22 temperature and humidity sensor
# GPIO to read from: 21
# GPIO that powers the sensor: 20
from dhtsensor.sensor import Sensor
s = Sensor(pi, 21, powered_by=20)

# Turn on power to the sensor
s.activate()

# Get temperature and humidity measurement from the sensor
# Do not call read_once repeatedly! Use .read instead
reading = s.read_once()

# Temperature and humidity as separate variables
temp, rh = s.read_once()

# Read from the sensor 10 times, with a 5-second interval between reads
# Outputs a list of 10 Reading objects
reading = s.read(10, interval=5)

Acknowledgment

pigpio Python examples

Contact

kentkawashima@gmail.com

License: MIT License

Download files

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

Source Distribution

dhtsensor-0.2.0.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file dhtsensor-0.2.0.tar.gz.

File metadata

  • Download URL: dhtsensor-0.2.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.6

File hashes

Hashes for dhtsensor-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7402474db8e9023c5ceb47b69a6d571deed773030e49953894649fd1a33a4038
MD5 3840fd5b7d3e734cda3b0fdc57d12d3c
BLAKE2b-256 dacf32c3d05655330734edeb386bef9bbdbe0364fb31ab747c04f04f22025878

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 file

0.1.0

1 file

Supported by

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