AM2302 Digital Temperature and Humidity DHT22 Sensor

dht22

The DHT22 is the big brother to the DHT11 Humidity Sensor.  The DHT22 is more accurate, more stable and has a larger temperature range.

Requires 4.7k resistor

http://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging

I've had lots of issues reading the humidity which is why the code is so long. It takes a parameter HumidyPin which is the pin the sensor is attached to. I now have 2 sensors attached to the system hence why it's a parameter. It's hard coded for a type 22 sensor

The code uses the Adafruit humidity application

def pdshumidity(HumidityPin):
    if debug:
        print("Reading Humidity")
    LoopCount=0
    if debug:
        print('Trying Humidity = loop count ' + str(LoopCount))
        print("          Starting try for Humidity")
    output = subprocess.check_output(["/home/pi/pds/Adafruit_DHT", "22", str(HumidityPin)]);
    if debug:
        print("          Finished trying Hunmidity")

    matches = re.search("Hum =\s+([0-9.]+)", output)

    if debug:
        print("          Trying to find matches")

    while (not matches):
        output = subprocess.check_output(["/home/pi/pds/Adafruit_DHT", "11", str(HumidityPin)]);
        matches = re.search("Hum =\s+([0-9.]+)", output)
        LoopCount = LoopCount+1
        if debug:
            print('     Humidity loop count ' + str(LoopCount))
        if (LoopCount > 1):
            if debug:
                print('     Humidity sleeping due to failure ' + str(LoopCount))
            time.sleep(10)
        if (LoopCount > 20):
            humidity = 0
            matches = 1
    humidity = float(matches.group(1))
    if debug:
        print("          Humidity check finished")

    return humidity
Temperature Humidity Sensor DHT11 DHT22 AM2302B AM2301 AM2320 Arduino AM2302
Temperature Humidity Sensor DHT11 DHT22 AM2302B AM2301 AM2320 Arduino AM2302 $2.97
End Date: Monday Oct-28-2019 2:31:55 PDT
Buy It Now for only: $2.97
1pcs DHT22 Digital Temperature Humidity Sensor AM2302 Measure Module SHT15 TE907
1pcs DHT22 Digital Temperature Humidity Sensor AM2302 Measure Module SHT15 TE907 $5.75
End Date: Thursday Oct-31-2019 17:16:24 PDT
Buy It Now for only: $5.75
1Pcs DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15
1Pcs DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15 $2.04
End Date: Wednesday Oct-30-2019 4:59:10 PDT
Buy It Now for only: $2.04
DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15 Arduino
DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15 Arduino $2.18
End Date: Tuesday Oct-29-2019 19:01:35 PDT
Buy It Now for only: $2.18
DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15 Arduino
DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15 Arduino $5.75
End Date: Tuesday Nov-5-2019 12:51:38 PST
Buy It Now for only: $5.75
DHT22 AM2302 Temperature Humidity Sensor Digital Replace SHT11 SHT15 For Arduino
DHT22 AM2302 Temperature Humidity Sensor Digital Replace SHT11 SHT15 For Arduino $3.27
End Date: Thursday Oct-31-2019 2:01:45 PDT
Buy It Now for only: $3.27
DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15 Arduino
DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15 Arduino $2.93
End Date: Friday Oct-25-2019 8:14:53 PDT
Buy It Now for only: $2.93
DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15 Arduino
DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15 Arduino $5.70
End Date: Wednesday Nov-6-2019 23:51:07 PST
Buy It Now for only: $5.70
AM2302 DHT22 Digital Temperature Humidity Sensor Module for Arduino Uno R3
AM2302 DHT22 Digital Temperature  Humidity Sensor Module for Arduino Uno R3 $3.40
End Date: Sunday Oct-27-2019 8:12:50 PDT
Buy It Now for only: $3.40
1PCSDHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15
1PCSDHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15 $2.28
End Date: Monday Nov-4-2019 0:37:11 PST
Buy It Now for only: $2.28

« Previous12345...910

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>