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
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: Friday Apr-24-2020 19:41:14 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: Sunday Apr-5-2020 13:51:38 PDT
Buy It Now for only: $5.75
1PC DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15
1PC DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15 $1.77
End Date: Saturday May-2-2020 0:05:19 PDT
Buy It Now for only: $1.77
1Pcs DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15
1Pcs DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15 $1.84
End Date: Tuesday Apr-14-2020 3:40:30 PDT
Buy It Now for only: $1.84
DHT22 Digital Temperature Humidity Sensor AM2302 Module + PCB Cable Arduino Q32
DHT22 Digital Temperature Humidity Sensor AM2302 Module + PCB Cable Arduino Q32 $4.99
End Date: Friday Apr-17-2020 20:01:31 PDT
Buy It Now for only: $4.99
1pc AM2302 DHT22 Temperature And Humidity Sensor Module For Raspberry Pi Arduino
1pc AM2302 DHT22 Temperature And Humidity Sensor Module For Raspberry Pi Arduino $2.97
End Date: Thursday Apr-23-2020 19:39:29 PDT
Buy It Now for only: $2.97
AM2302 DHT22 Digital Temperature And Humidity Sensor Module Replace SHT15 SHT11
AM2302 DHT22 Digital Temperature And Humidity Sensor Module Replace SHT15 SHT11 $3.02
End Date: Friday Apr-17-2020 4:04:45 PDT
Buy It Now for only: $3.02
1PCS DHT22 AM2302 Digital Temperature and Humidity Sensor Replace SHT11 SHT15
1PCS DHT22 AM2302 Digital Temperature and Humidity Sensor Replace SHT11 SHT15 $0.70
End Date: Monday Apr-13-2020 6:13:06 PDT
Buy It Now for only: $0.70
AM2302 DHT22 Digital Temperature And Humidity Sensor Module Replace SHT15 SHT11
AM2302 DHT22 Digital Temperature And Humidity Sensor Module Replace SHT15 SHT11 $7.59
End Date: Sunday Apr-12-2020 22:57:56 PDT
Buy It Now for only: $7.59
5 Pack AM2302 Basic DHT22 Digital Temparature and Humidity Sensor
5 Pack AM2302 Basic DHT22 Digital Temparature and Humidity Sensor $19.29
End Date: Wednesday Apr-15-2020 18:39:48 PDT
Buy It Now for only: $19.29

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