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 Module Replace SHT11 SHT15
DHT22 AM2302 Digital Temperature And Humidity Sensor Module Replace SHT11 SHT15 $3.12
End Date: Saturday Oct-27-2018 0:40:56 PDT
Buy It Now for only: $3.12
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: Tuesday Nov-6-2018 19:01:31 PST
Buy It Now for only: $4.99
AM2320 Digital Temperature Humidity Sensor I2C SHT10 SHT11 Arduino DHT11 DHT22
AM2320 Digital Temperature Humidity Sensor I2C SHT10 SHT11 Arduino DHT11 DHT22 $4.39
End Date: Saturday Oct-27-2018 20:17:24 PDT
Buy It Now for only: $4.39
DHT22 AM2302 Digital Temperature and Humidity Sensor Replace SHT11 SHT15
DHT22 AM2302 Digital Temperature and Humidity Sensor Replace SHT11 SHT15 $2.88
End Date: Tuesday Nov-6-2018 19:10:21 PST
Buy It Now for only: $2.88
DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15
DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT11 SHT15 $2.64
End Date: Wednesday Nov-7-2018 19:06:30 PST
Buy It Now for only: $2.64
DHT22 AM2302 Digital Temperature and Humidity Sensor Module
DHT22 AM2302 Digital Temperature and Humidity Sensor Module $3.44
End Date: Wednesday Nov-14-2018 2:08:26 PST
Buy It Now for only: $3.44
1PC DHT22 AM2302 Digital Temperature Humidity Sensor Replace Arduino SHT11SHT15
1PC DHT22 AM2302 Digital Temperature Humidity Sensor Replace Arduino SHT11SHT15 $5.25
End Date: Friday Oct-19-2018 2:55:26 PDT
Buy It Now for only: $5.25
new AM2320B AM2320 DHT22 AM2302 Temperature Humidity Sensor AM2301 SH10 11 15 21
new AM2320B AM2320 DHT22 AM2302 Temperature Humidity Sensor AM2301 SH10 11 15 21 $2.89
End Date: Sunday Nov-4-2018 1:09:14 PST
Buy It Now for only: $2.89
1pcs DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT15
1pcs DHT22 AM2302 Digital Temperature And Humidity Sensor Replace SHT15 $3.16
End Date: Thursday Nov-8-2018 0:23:47 PST
Buy It Now for only: $3.16
1PCS DHT11 DHT22 AM2320 AM2302 Digital Temperature Humidity Wemos Sensor M85
1PCS DHT11 DHT22 AM2320 AM2302 Digital Temperature Humidity Wemos Sensor M85 $0.99
End Date: Saturday Nov-10-2018 7:36:53 PST
Buy It Now for only: $0.99

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