Public Member Functions | |
def | __init__ (self, pi, gpio, LED=None, power=None) |
def | bad_checksum (self) |
def | cancel (self) |
def | humidity (self) |
def | missing_message (self) |
def | sensor_resets (self) |
def | short_message (self) |
def | staleness (self) |
def | temperature (self) |
def | trigger (self) |
Public Attributes | |
bad_CS | |
bad_MM | |
bad_SM | |
bad_SR | |
bit | |
cb | |
CS | |
gpio | |
hH | |
high_tick | |
hL | |
LED | |
MAX_NO_RESPONSE | |
no_response | |
pi | |
power | |
powered | |
rhum | |
temp | |
tH | |
tL | |
tov | |
Private Member Functions | |
def | _cb (self, gpio, level, tick) |
A class to read relative humidity and temperature from the DHT22 sensor. The sensor is also known as the AM2302. The sensor can be powered from the Pi 3V3 or the Pi 5V rail. Powering from the 3V3 rail is simpler and safer. You may need to power from 5V if the sensor is connected via a long cable. For 3V3 operation connect pin 1 to 3V3 and pin 4 to ground. Connect pin 2 to a gpio. For 5V operation connect pin 1 to 5V and pin 4 to ground. The following pin 2 connection works for me. Use at YOUR OWN RISK. 5V--5K_resistor--+--10K_resistor--Ground | DHT22 pin 2 -----+ | gpio ------------+
def DHT22.sensor.__init__ | ( | self, | |
pi, | |||
gpio, | |||
LED = None , |
|||
power = None |
|||
) |
Instantiate with the Pi and gpio to which the DHT22 output pin is connected. Optionally a LED may be specified. This will be blinked for each successful reading. Optionally a gpio used to power the sensor may be specified. This gpio will be set high to power the sensor. If the sensor locks it will be power cycled to restart the readings. Taking readings more often than about once every two seconds will eventually cause the DHT22 to hang. A 3 second interval seems OK.
|
private |
def DHT22.sensor.bad_checksum | ( | self | ) |
def DHT22.sensor.humidity | ( | self | ) |
def DHT22.sensor.missing_message | ( | self | ) |
def DHT22.sensor.sensor_resets | ( | self | ) |
def DHT22.sensor.short_message | ( | self | ) |
def DHT22.sensor.staleness | ( | self | ) |
def DHT22.sensor.temperature | ( | self | ) |
def DHT22.sensor.trigger | ( | self | ) |