Temperature and Humidity sensor DHT-22


Also known as RHT-22, RHT-03 and AM2302, the DHT-22 is a small size, compact, dual temperature and humidity sensor. I purchased it to replace the DHT-11 in my uRADMonitor radiation monitor station.

Specs:
Model RHT03
Power supply 3.3-6V DC
Output signal digital signal via MaxDetect 1-wire bus
Sensing element Polymer humidity capacitor
Operating range humidity 0-100%RH; temperature -40~80Celsius
Accuracy humidity +-2%RH(Max +-5%RH); temperature +-0.5Celsius
Resolution or sensitivity humidity 0.1%RH; temperature 0.1Celsius
Repeatability humidity +-1%RH; temperature +-0.2Celsius

Datasheet: here

Here are some variants created by my readers

Vanja’s DHT22 board
vanja_dht22 vanja_dht22-2 DHT22 Eagle SCH

Source code:
DHT-22, Atmega8 with 16Mhz
DHT-22, Atmega8 with 8Mhz

This article has 18 Comments

  1. Hi my friend.
    I have been made Temperature and humidity unit from your site with atmega8 and DHT22.
    My problem is that the unit do not works correct. On the LCD display I do not have correct screen. On screen I have like a China’s letter.
    Please would you like to tell me how I need to put setup to program my atmega8 /because I have option to put max 8MHz exterrnal crystal/ and to send me HEX file for atmega8.
    Best Regards
    Vanja Halulic
    vhalulic@comcast.net

  2. @Vanja, for 8MHz you need to change the F_CPU in the source code. This is why your LCD doesn’t display correctly.

  3. Dear Vanja , I have added the code for 8MHz, including the recompiled HEX, see the end of the article.

  4. Hello.
    Congratulations for your great job.
    I have some doubts about the code.
    I have programed ATmega8 with assembler, but I am not used to doing it with C.
    In code/sensors/dht22.h, it says:

    #define THERM_PIN PINC
    #define THERM_DDR DDRC
    #define THERM_PORT PORTC

    #define THERM_DQ PC0
    /* Utils */
    #define THERM_INPUT_MODE() THERM_DDR&=~(1<<THERM_DQ)
    #define THERM_OUTPUT_MODE() THERM_DDR|=(1<<THERM_DQ)
    #define THERM_LOW() THERM_PORT&=~(1<<THERM_DQ)
    #define THERM_HIGH() THERM_PORT|=(1<<THERM_DQ)
    #define THERM_READ() ((THERM_PIN&(1<<THERM_DQ))? 1 : 0)

    What exactly are you doing here?
    Thank you for your help.

  5. Hello, I flash your GMD.Hex file, and all work, but if I compile from source code, LCD is show “temp: ? and humi:?”
    What I do wrong?

    P.S. sorry for my bad english.
    If you can, send my source code on mail: sanychlxg@mail.ru

  6. Hello, I flash your GMD.Hex file, and all work, but if I compile from source code, LCD is show “temp: ? and humi:?”
    What I do wrong?

    P.S. sorry for my bad english.
    If you can, send *me source code on mail: sanychlxg@mail.ru

  7. Hello, thanks for your great work. I have some questions.
    I flash your release hex, and all good work, but if I compile from source code, I see on LCD: Temp:? and Humi:?/
    What I do wrong?

  8. Thanx a lot. I work on Linux in Eclipse.
    if this help:
    in Project settings->C/C++ Build->Settings->Tool Settings->AVR C Linker->General->Other Arguments “-Wl,-u,vfprintf -lprintf_flt -lm”
    in Project settings->C/C++ Build->Settings->Tool Settings->AVR C Linker->Libraries->Libraries Path “/usr/avr/lib/avr5”
    in`s work for me. Thanx again. You realy help me)))

  9. I’m glad it helped, and thanks for the Eclipse settings – Others might find that useful.

  10. Great Work.
    I am having a problem in making the circuit…in Proteus 8.1….where hd44780 has a bus for D0-D7…how do we interface it with atmega8 and display it on the lcd..plz help.

Leave a Reply