Public Member Functions | Public Attributes | Private Member Functions
DHT22.sensor Class Reference

List of all members.

Public Member Functions

def __init__
def bad_checksum
def cancel
def humidity
def missing_message
def sensor_resets
def short_message
def staleness
def temperature
def trigger

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

Detailed Description

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 ------------+

Definition at line 10 of file DHT22.py.


Constructor & Destructor Documentation

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.

Definition at line 35 of file DHT22.py.


Member Function Documentation

def DHT22.sensor._cb (   self,
  gpio,
  level,
  tick 
) [private]
Accumulate the 40 data bits.  Format into 5 bytes, humidity high,
humidity low, temperature high, temperature low, checksum.

Definition at line 89 of file DHT22.py.

def DHT22.sensor.bad_checksum (   self)
Return count of messages received with bad checksums.

Definition at line 208 of file DHT22.py.

def DHT22.sensor.cancel (   self)
Cancel the DHT22 sensor.

Definition at line 235 of file DHT22.py.

def DHT22.sensor.humidity (   self)
Return current relative humidity.

Definition at line 197 of file DHT22.py.

Return count of missing messages.

Definition at line 216 of file DHT22.py.

Return count of power cycles because of sensor hangs.

Definition at line 220 of file DHT22.py.

Return count of short messages.

Definition at line 212 of file DHT22.py.

def DHT22.sensor.staleness (   self)
Return time since measurement made.

Definition at line 201 of file DHT22.py.

def DHT22.sensor.temperature (   self)
Return current temperature.

Definition at line 193 of file DHT22.py.

def DHT22.sensor.trigger (   self)
Trigger a new relative humidity and temperature reading.

Definition at line 224 of file DHT22.py.


Member Data Documentation

Definition at line 48 of file DHT22.py.

Definition at line 48 of file DHT22.py.

Definition at line 48 of file DHT22.py.

Definition at line 48 of file DHT22.py.

Definition at line 48 of file DHT22.py.

Definition at line 48 of file DHT22.py.

Definition at line 92 of file DHT22.py.

Definition at line 48 of file DHT22.py.

Definition at line 92 of file DHT22.py.

Definition at line 48 of file DHT22.py.

Definition at line 92 of file DHT22.py.

Definition at line 48 of file DHT22.py.

Definition at line 48 of file DHT22.py.

Definition at line 48 of file DHT22.py.

Definition at line 48 of file DHT22.py.

Definition at line 48 of file DHT22.py.

Definition at line 48 of file DHT22.py.

Definition at line 48 of file DHT22.py.

Definition at line 48 of file DHT22.py.

Definition at line 92 of file DHT22.py.

Definition at line 92 of file DHT22.py.

Definition at line 48 of file DHT22.py.


The documentation for this class was generated from the following file:


cob_hand_bridge
Author(s): Mathias L├╝dtke
autogenerated on Thu Jun 6 2019 20:43:57