Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apexskier/am2302
Python module for the AM2302 temperature/humidity sensor on a Raspberry Pi.
https://github.com/apexskier/am2302
am2302 humidity-sensor iot raspberry-pi sensor temperature-sensor
Last synced: about 6 hours ago
JSON representation
Python module for the AM2302 temperature/humidity sensor on a Raspberry Pi.
- Host: GitHub
- URL: https://github.com/apexskier/am2302
- Owner: apexskier
- Created: 2014-02-05T20:35:36.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2017-01-06T17:03:14.000Z (almost 8 years ago)
- Last Synced: 2024-10-31T22:47:21.477Z (7 days ago)
- Topics: am2302, humidity-sensor, iot, raspberry-pi, sensor, temperature-sensor
- Language: C
- Homepage:
- Size: 215 KB
- Stars: 11
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Python DHT-Raspberry Pi module
This module enables access to the [AM2302 wired digital temperature and
humidity sensor](https://www.adafruit.com/products/393) from a Raspberry Pi.
It's been adapted from [Adafruit's C
code](http://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging/software-install).It may work with both the DHT11 and DHT22 sensors as well, though this is
untested.Get it with `pip install am2302_rpi`. The [BCM2835 C
Library](http://www.open.com.au/mikem/bcm2835/index.html) is required and the
root user must be used to access the GPIO pins.## am2302_ths
Both methods return floats, or None if the sensor can't be read. The sensor
can only be read once every few seconds.### get_temperature(pin)
Reads the current temperature from a sensor attached to the specified pin.
### get_humidity(pin)
Reads the current humidity from a sensor attached to the specified pin.
## am2302_rpi
This module provides a class *Sensor* which periodically polls the sensor
to keep track of the current temperature without waiting for it.It has the following methods available.
### __init__(pin)
Create a new sensor object instance with `s = am2302_rpi.Sensor(4)`.
### get()
Get the last read temperature.
### get_last_time()
Get the time of the last successful read.
### off()
Turn the timer off by cancelling it's internal ticker. Make sure you call this
before exiting.## TODO
Clean up the sensor object properly.