SparkFun will be closed on Tuesday, November 5th to support our team in being able to go out and vote! Orders placed after 2 pm MT Monday, November 4th will ship on Wednesday, November 6th. Thanks for your patience and understanding.
The RHT03 (also known by DHT-22) is a low cost humidity and temperature sensor with a single wire digital interface. The sensor is calibrated and doesn't require extra components so you can get right to measuring relative humidity and temperature.
ESP8266
This sensor is also used with the ESP8266 Internet of Things Tutorial [ https://learn.sparkfun.com/tutorials/internet-of-things-experiment-guide ].
Particle Photon
This sensor used with the RedBoard Photon's Tutorial [ https://learn.sparkfun.com/tutorials/sparkfun-inventors-kit-for-photon-experiment-guide ].
Raspberry Pi
This sensor is also used in the Raspberry Pi Web of Things Kit [ https://www.sparkfun.com/products/13832 ].
If a board needs code or communicates somehow, you're going to need to know how to program or interface with it. The programming skill is all about communication and code.
Skill Level: Rookie - You will need a better fundamental understand of what code is, and how it works. You will be using beginner-level software and development tools like Arduino. You will be dealing directly with code, but numerous examples and libraries are available. Sensors or shields will communicate with serial or TTL.
See all skill levels
If it requires power, you need to know how much, what all the pins do, and how to hook it up. You may need to reference datasheets, schematics, and know the ins and outs of electronics.
Skill Level: Competent - You will be required to reference a datasheet or schematic to know how to use a component. Your knowledge of a datasheet will only require basic features like power requirements, pinouts, or communications type. Also, you may need a power supply that?s greater than 12V or more than 1A worth of current.
See all skill levels
We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.
Based on 33 ratings:
1 of 1 found this helpful:
Very easy to setup and use. I used the DHT library.
URL: https://github.com/adafruit/DHT-sensor-library
4 of 4 found this helpful:
I've purchased 40-50 of these over a couple years and don't remember any failures. Some have been outside through the summer, some not. I'll post an update if I notice any.
1 of 1 found this helpful:
I'm using this as part of a Raspberry pi based weather station. Using the Adafruit library, it worked perfectly the first time.
1 of 1 found this helpful:
Have been using one of these for some months now, measuring humidity and temp in a environment with great fluctuations. Works perfect.
1 of 1 found this helpful:
The Temperature readings seem fine, but the Humidity values are always 98-100% after 6 month of use.
4 of 7 found this helpful:
This is a great part and will yield a high quality temperature and humidity reading with none of the typical problems associated with analog readings, because you don't read analog. It communicates over a single wire interface to the CPU. Unless you want to write a driver for the communications and data parsing, you need to get one to use this part. Sadly, as I've found with a lot of the stuff sold by Sparkfun, their software is often incomplete and the support is tough to work with. I have some notable "Shelfware", such as the WiFly shield which I spend lots of time with and never got working correctly because Sparkfun did not release or support a working library for it, and when pressed, told me they would not support the library on GitHub that they refer you to. Coding a whole WiFi solutions was more than I bargained for when purchasing the part. Beware, just cause they show you a video of a working example does not mean that you will be able to download working code!
In the case of this RHT03, Arduino to the rescue. As I've found on other occasions, the quality of software available on the Arduino website is superior. There is a driver and application note for this part. Copy and paste the code, follow the instructions, wire it up and you'll be getting nice readings.
Seriously Sparkfun, I've been down this road before. As founder of Measurement Computing (sold to NI in 2005), I understand electronics and support. It is just suicide to offer a product and represent that you support it, and that means having working software, then not do so. I suspect you are losing a lot of follow-on business from customers who can't solve their problem with your buggy software, or move on and solve it with someone else, like I have with the WiFi. The folks at Spark Labs solved the arduino/wifi problem with a 100% supported and working solution, and that's where I buy them.
Sparkufn, I like your variety and the quality of the hardware is always great, but the software... You need to do a better job, especially after the sale.
Thanks for the feedback. We are working to release more example code and hookup guides for our products. There are some products with holes in the code base. This can be caused by a number of factors. We do try to correct this when possible. Thanks and happy hacking.
It's a nice little module, but it has some drawbacks. I'm using it for a home built chiller and it works well enough. The cons are that the temp accuracy isn't great and that it isn't Dallas 1-wire, which I didn't notice when I bought it. Software support is available, but complicated. Overall, convenient, but not a perfect solution.
0 of 1 found this helpful:
Well I didn't get the driver to read a single input/output scheme yet.
Nice little sensor, readings seem consistent. Only downside is that it does take a solid few seconds to update reading values.
I have used the HIH4030 which is slightly more expensive, but it seems to be pretty sensitive as far as damage. It got wet and never really came back. It has analog output that can be used with a 1-Wire DS2438, which is nice. The RHT03 requires a pin, so you have that going on for limitations, but as far a accuracy and durability in a grow-tent environment, its pretty good. I recommend the PIETTETECH_DHT library.
Ran fine at 3.3v with a pro mini. Internal update rate is ~2 sec so don't expect a quick response...
I wanted to use the RHT03 with an Arduino Uno, so I looked for published libraries. I first tried a library I found on an Arduino Playgound web page: https://github.com/RobTillaart/Arduino/tree/master/libraries/DHTlib. I could not get it to work. Then I tried a alternative mentioned in the above web page: https://github.com/ringerc/Arduino-DHT22. This worked well.
I ordered two of these and they seem to be performing reasonably well. I am seeing temperature spikes every 4-5 hours for some unknown reason. I'm using a Particle Photon and the library provided by Particle. Has anyone seen this type of anomaly when using these?
We have a great tech team that can help you out, please contact them here - https://www.sparkfun.com/technical_assistance
these have not failed me to this day
This sensor was easy to integrate with my particle photon with support libraries created by piettetech (https://github.com/piettetech/PietteTech_DHT). No calibration was required and the readings seemed accurate.
I hooked the sensor to cable and placed it in a shaded area. Using several of the example programs for the Arduino I still got the same poor results. The temperature readings were off by as much as 14 degrees F and the humidity readings are consistently off by 10%. The temperature readings are not linear so I can't use a constant to correct it. Waste of time and money.
Sorry to hear you had issues. Please contact us to setup a return for the part - https://www.sparkfun.com/technical_assistance
The DHT library made it a snap to begin acquiring readings. I had a working temperature and humidity monitor in less than an hour, and most of that time was related to piping the output onto a 16x2 serial display.
The data string, coming out of this sensor, has not the typical one-wire format and needs to be decoded. Each pulse (40 total, 16 for Humidity, 16 for Temperature, 8 for Checksum) needs to be converted from pulse-width to digital high/low. It's not terrible difficult, but requires some programing. I'm using a dedicated PIC12F1840 loaded with a "serial converter", which makes it easier to integrate the sensor with other serial port communication projects.
Work great no problems, and good documentation.
Works well and seems accurate. I will be ordering a few more soon
Interface is a little tricky, but seems to be reliable once you figure it out. Temperature calibration seems to be good - within a half degree F at 78 compared to several different standards. My complaint is with the humidity calibration. I have two units, and they are reading within two percentage points of each other: 28.2 and 29.9%, which is good. Unfortunately, this is about 10 percentage points low compared to a dew point reading and three other trusted RH sensors: 37, 37.4, 38, and 40%. One of these readings, the 37.4, is from a Sparkfun SHT15 breakout. Granted it is 4 times the cost, but it seems to meet its advertised spec. Based on my evaluation, the DHT22 is a long way off from the +/- 2% it claims. And yes, I have already tried the recommended "reconditioning" process. So if you are looking for accuracy, pay the price. If a ballpark reading is ok, the price of the RHT03 is pretty attractive.
Now that I am set up to make comparisons with the SHT15, I'll see if there is some way to compensate the errors of the SHT15 in software so as to get a more accurate reading across a range of conditions. If so, I'll let you know.
I'm using it to measure temperature in my living room. Works great.
As part of a project to learn about my Raspberry Pi 3B, I bought a RHT03 Temperature and Humidity Sensor from Sparkfun. From online resources, I was able to download the requisite Python code to read the sensor outputs. The sensor was easy to connect. So far, the output matches a couple of other humidity sensors and thermometers I own, so it meets my needs.
I also connected a 16x2 LCD display so it can display the Temperature and Humidity at a glance, instead of using a keyboard, mouse, and PC monitor.
I'm reading it with Arduino Uno
Updates at a seemingly random interval (using the provided example code) but the readings are fairly accurate. Recommend SimpleDHT library instead.
The library is very bad. It fails to update about 99% of the time. Found some other libraries by googling...but at that rate I might as well have just bought a better sensor for 1/3 the price somewhere else. I bought from SparkFun so it would 'Just Work'...and it didn't.
I've used several of these in different projects, and they have all worked as intended with high accuracy.
It works fine most of the time. But when a sudden temperature change happens, the check sum of the data is constantly been wrong, but the temperature data still looks reasonable. Not perfect.
Simple to install, sample code works well. Flexible, no problems.
Simple device. Does what it says. No problems. :D
I really liked it because it was easy to add to my project, and it was simple to retrieve its data via my Arduino code. This is a great sensor.
Easy to wire and has library pre-written. Was up and reading temp, humidiity and heat index in a room in my house in a few minutes. Ended up setting up a small fan array in my window wired to the l293d motor driver that pushes or pulls air at various rates based on temperature and humidity ranges. Was very fun to create! Will be purchasing a few more for some other projects I have in mind. Thanks!
Easy to use. Code is already posted online. Just modify as needed.
Ran into issues using the example code and library on mesh particle devices (argon, boron) and had luck with DHT22Gen3_RK particle library. Might be applicable for other particle devices that do not allow the applications to fully disable interrupts.
-------------------- Tech Support Tips/Troubleshooting/Common Issues --------------------
Example Tutorial
Garage Lab Tutorial: Humidity and Temperature Sensor with Arduino http://garagelab.com/profiles/blogs/tutorial-humidity-and-temperature-sensor-with-arduino
Multiple RHT03/DHT22 Sensors on Arduino
Theoretically, you should be able to add more than one RHT03/DHT22 sensor to an Arduino. The sensor uses only one I/O pin. By connecting additional RHT03/DHT22 sensor to another I/O pin, redefining the pin to the respective RHT03/DHT22 sensor, and calling new instances of the RHT03/DHT22 library, you should be able to theoretically have multiple RHT03/DHT22 sensors on Arduino. I haven't fully tested this out with multiple sensors but I was able to compile a modified example for two sensors without any issues.
Here's an example with Multiple Sensors with Arduino for illustration => [ http://diy-scib.org/blog/multiple-dht-humidity-sensors-arduino ].
Awesome data sheet!!
Now I know how to use it...
If you want to download better datasheet, please click this website to download
http://www.humiditycn.com/fl1_1.html
I have optimized the datasheet. The model RHT03 and DHT22 are for one same product.
By the way, please buy from Sparkfun.
You can always google search datasheets. What I hate are the broken code links I have run into, or broken pictures which show newly updated boards while sparkfun still sells the older version. That is always fun when trying to figure out pinouts >=-. I even took the time to inform sparkfun about it once and they told me it wasn't their problem and that it was the arduino site's.... I gave them the correct link that they needed to change and everything (after wasting 2 hours of my time i wanted to help others)... and they said Nope and blamed arduino... Great customer service at sparkfun... I buy from here because I can usually get most of my components under one shipping fee instead of splitting it between the mouse and key site. I can google search it and waste my time at a cheaper price. At least they try(no sarcasm in this sentence).
Also notice the time distance between these posts? It has been broken for over a year.
Just tried a whole lot of different libraries and this is the one that works the best so far : http://learn.adafruit.com/dht
I just tried it and had it running in less than 10 minutes, including download time. Thanks much.
When moving between rooms, humidity sensor stabilized to new value in a couple of seconds. Temp took more like a couple of minutes. Strange.
Thank you for pointing this out, works very well.
Nice sensor. I've been using it to monitor
a greenhouse for about two months. The wet
environment doesn't seem to have harmed it.
Temperature is accurate, and humidity seems
about right - I think I believe this more
than I do the other humidity sensors in
there. I'll be buying more.
How did you mount the sensor? I am planning on buying / using it, but am trying to figure out how I am going to protect my arduino from the elements while letting this device retrieve accurate readings (which I don't think would be possible from inside a waterproof otterbox case.
Nice little hook-up guide here:
http://garagelab.com/profiles/blogs/tutorial-humidity-and-temperature-sensor-with-arduino
I was using NetHoncho's library, and was getting only maybe one out of ten readings correct. The rest were sync timeout errors.
I modified his library to retry up to 70 times instead of 35 times, and that did the trick. Look for this line in his lib:
if (retryCount > 35) //(Spec is 50 us, 352 == 70 us)
-- and change it to this --
if (retryCount > 70) //(Spec is 50 us, 352 == 70 us)
Thanks for the lib NetHoncho! Works great now.
It does't exsit RHT03 or DHT22 version. RHT03 and DHT22 are two different names for one same product.
We have three names for this product, the names are RHT03 DHT22 AM2302. So, be noted that you are using the same product.
I have asked our engineer to recheck if RHT03/DHTT22 could work under 3.3V DC this morning, the answer is RHT03/DHT22 could work properly under power supply of 3.3V DC.
I think you have to check if the power supply at RHT03's power pin is >=3.3V DC.
Don't bother trying to run the RHT03 at less than 5 volts.
It doesn't report the humididty correct at the 3.46 I said it was giving me values at..
Glenn
I just found the same thing to be true that the RHT03 version does not work for 3.3V. They do work for the 5V..
I am going to contact sparkfun tec support and see if they have the DTH22 version hanging around so I can complete my project 3.3v.
By the way did some testing and the DTH22 reports back at 3.1 volts just not sure how accurate didn't have anything handy to check the temp or humidity against.
I created an Arduino library for the DHT22 http://goo.gl/uy1fV
Version 0.4 has been uploaded. This version verifies the checksum.
Now the project has a home at Git Hub
http://github.com/nethoncho/Arduino-DHT22
NetHoncho:
I have a AM2301 which is pretty much the same thing and was trying forever to get it to work by modifying the DHT11 code but was still have issues with the timing. Tried out your library and worked without a hitch.
Hello!
I am trying to interface DHT22 with ATmega128RFa1 but having an issue. I am suspecting that the sensor is not responding to the MCU's request signal. After I send the request signal to the sensor, I wait for 10 ms for the sensor to detect the request. Then the sensor should respond driving the signal from low to high, right? I guess I am not getting this correct. Are there any other things that I should be considering besides timing?
Any help would be appreiciated. Cheers!!
Pretty good sensor for temperature and humidity. Successfully interfaced it to an 8051 port pin. Had to use a logic analyzer for accurate timing constraints and implementation. However, it's easy to work with ... Check out the project if you'd like to see this interfaced with an 8051 using SDCC compiler. https://github.com/pswapnil/ZigBeeTempSensor
Everyone who hates the one-wire interface raise your hand! Especially when they have 4 pins anyway. You can have I2C for that.
I purchased it and I want to use it with Arduino Due but it is not work, with same program and same connection it works well with UNO. I used 3.3volt as input .. with same power it works with arduino DUE... any suggestion????
Here's another implementation for reading out the sensor:
https://github.com/liyanage/maxdetect-rht03-humidity-sensor/
I'm running it on a Spark Core board and I have a Google Drive spreadsheet that automatically pulls and logs the values every 10 minutes. I'll be hooking it up to a solid state relay to control a humidifier next.
I'd like to use this sensor in a very high humidity, 70%RH at minimum I figure .. I saw in the datasheet that it says
Avoid using the sensor under dew condition.
Does this mean that this sensor should only be used for a short amount of time under very "dewey" conditions?Thanks!
It means that the sensor shouldn't be exposed to liquid water. If you're above the dew point and water won't be condensing onto the sensor you should be fine.
Hello, Has anyone used this sensor on TelosB / Tmote Sky nodes? Thanks
Some notes:
the DHT library works best.
The humidity sensor on this thing appeared to have crapped out after two weeks worth of use - simply reads 99.9% for the RH.
This communication scheme is also pretty sensitive to electrical noise. I had a DC motor running in it's vicinity, and it was pretty much un-readable.
The datasheet states that the RHT03 can be used with 3.3 to 6V. Is anyone successful in using RHT03 sensors with 3.3V power? I have a breadboard prototype with multiple RHT03 sensors and an Arduino Pro Mini powered via an FTDI Basic board. The sketch is a modification of the DHT library from Adafruit. When using a 5V/16Mhz Arduino Pro Mini the sketch outputs apparently valid humidity and temperature values for all sensors. However, after replacing the Pro Mini with the 3.3V/8MHz version (Vcc = 3.26V actual) the software reports values of 0.0 for humidity and temperature for all sensors. I have tried: 1) using 1K, 10K or no pullup resistors, 2) 100nF caps across sensor Vcc-GND, or none, 3) connecting both sensor pins 3 & 4 to GND. With any of these changes the reported values remain at 0.0. Maybe the signal timing needs to be tweaked for 3.3V??
Any reason why this sensor indicates 20% humidity (outside), while different weather stations shows 60% humidity for the same location? Temperature is correct.
Does anyone know where I can find an Eagle library for this part? Thanks!
Try this one: github:EagleWorks/eagle/lbr/RHT03_DHT-22_AM2302.lbr. Includes upright as well as right-angle packages and a simple header type package for the AM2302 (wired version of DHT-22, says the interwebs). Note that this is built up from the somewhat iffy datasheet (mixed units, missing measurements). It seems to match up with the photos of the actual product, so I'm fairly confident that you can use it 'as is'.
Nice one!
So do you have to connect the null pin to anything? I'm confused what this is for. Trying to learn electronics.
Nope, can (perhaps even should) leave that one unconnected to anything..
Had 2 of these sensors sitting around for a project I just now started getting time to make, and ATM I'm able to get acceptable values at @3.3v using a FreeSOC mini, the only issue I have is that my calculated checksum value is does not match the broadcast-ed check sum value,
Hi, i have this sensor in my bath. the problem is that the humidity changed with a small wind and it take time to make it stable again. do you know way? thanks kobi.
I have been really impressed with this sensor. I did not believe they could possibly deliver the datasheet's quoted accuracy at this price. You can spend thousands on a lab-grade hygrometer and they still only claim 2% accuracy. How can this do it for $10? So I tried to test and compare six of them for my myself. I do not claim to be an expert or that this experiment is flawless, but if anyone is interested my write up is at http://www.kandrsmith.org/RJS/Misc/calib_dht22.html These are just the results I got for my devices. At the level of errors I am seeing, the fault could just as likely be in my experiment as in the devices themselves.
I still do not really believe the 2% absolute accuracy claim from 0-100%, but they are amazingly good for the price and come surprisingly close to that. The maximum errors I have measured are about 6% RH, with typical errors of 2-3% RH. I see quite a strong temperature dependence of at least 2% RH over the temperature range I have tested so far but am still working on that. I have not done any long term tests, but on timescales of a few weeks I find repeatability in the range 0.5-1% RH.
Hi All, I trying to read from DHT22 sensor. Now I get following code: 4 198 0 246 192 CRC code is right, temperature is right but humidity is wrong (4 and 198 means 1222). In my opinion it seems that there are a shit error in the High Humiditi data (4) instead of 2. But how is it possibile if I get the right CRC code? please, help me. I'm using voltage supply of 3.3V.
Hi - I'm trying to get this going on an OMAP3 system using a standard GPIO. I can't find any code base that isn't Rpi or Arduino. Does anyone have any code that can be used on a general linux system?
Thanks!
It looks like a tiny breadboard!
few observations to those who are experiencing random errors (sync timeout, bus hang etc.) with any of Arduino libraries:
several weeks of tests led me to the single conclusion - this chip is very sensitive to poor contacts. Where the standard i2c devices work smoothly, DHT22 fails on the same connectors. Have no oscilloscope, can't explain why.
If you want to use this with Raspberry Pi, Gordon over at wiringpi.com has added maxdetect support to his wiringpi arsenal. I got this working today fairly easily with that. http://wiringpi.com/dev.
Here is the quick program. Make sure to compile with something like "gcc rht.c -o rht -lwiringPi -lwiringPiDev"
Also note that I had to take out the chevrons in the #include lines for some reason to get those headers to show up
I purchased this sensor a few weeks ago. I was able to get up and running in a short amount of time using a UNO and the RHT03 library from adafruit. However, it appears that only the first few reads of the sensor are accurate. The sensor seems to be self heating at about 0.5 degrees C every 30 seconds. I am only reading every 30 seconds thinking that increasing the time between reads would reduce the self heating. Any suggestions?
Matt
Is this device support UART/USART communication?? may i connect this device with Xbee??
Anyone have any luck getting this to run with a Raspberry Pi? If so please share you code and schematic.
Thx Rich
I try this sensor with NetHoncho library but it always return Checksum error. I change the setup, with/without resistor, reading 40 instead of 41 and always the same result.
It works for me with the code from arduino playground http://playground.arduino.cc/Main/DHTLib I just change the delay to 2000 and move this to the begining of the loop, and remove the code for the DHT11
How do I use this sensor in Arduino 1.0.1 ?
I have had the RHT03 working for about 3 months, but now the humidity reads 1.0% but the temperature is working correctly. Has the device gone bad? Has anyone else had this problem?
As a beginner, it's been a bit of a pain for me to get this thing working with an Arduino Uno R3. The datasheet and example code are hard to follow, but the discussion here has been quite helpful.
If you're coming up with code to read data from the sensor yourself, consider that the timings mentioned in the datasheet are not quite right. Basically, what you can count on is that the zero-bit pulse is a fair bit shorter than the one-bit pulse. If you're code makes too many assumptions about the timing, you might get out of sync with the incoming signal.
Here's my code for my Uno. YMMV, of course. It prints out humidity and temp readings every 5 seconds to the serial console. Seems reliable on my system; no failures in the last couple hours it's been running.
Does this work OK outdoors?
Great sensor although the datasheet is something out of a science fiction novel written in engrish. nethoncho / Arduino-DHT22 is a great resource to get you up and running in seconds. Watch out for the legs, very delicate!
Works nicely with my Uno R3 and compares really well to my wall mount commercial product I used to check the values with but when running with small (remote mounted) battery which is being charged by small solar panel, the values begin to deviate quite a lot with the voltage.
Any ideas how to stabilize this component without a small nuclear plant for steady supply?
IMHO: I would NOT use this sensor for outdoor humidity because dew will be seen by the sensor and degrade it's readings. Many commercial weather stations have this as a small foot note in their documentation. Which seems to be kind of silly, "Don't put your outdoor humidity sensor "outdoors" because it may see dew and degrade it performance"!?!?! What? How stupid is that? What does this all mean? If you use THIS sensor outdoors, after some period of time your humidity/dew point values will start to go wacky and have to be compensated for. (Speaking from experience with a commercial weather station.) After reviewing the other humidity sensors on SF, it seems they do not have this problem. Thus use this sensor indoors only.
NOTE: In the data sheet it males a reference to dew conditions: (7) Other attentions * Avoid using the sensor under dew condition.
Had some trouble getting this sensor to work with my Uno. I finally was able to get it to work by using this library: http://arduino.cc/playground/Main/DHTLib I did have to change the baud rate to 9600.
I then attached the sensor to 3.3V, Gnd, and Digital Pin 5
I did not need a resistor or capacitor to allow this sensor to return reasonable results without error.
Sensor is not not working further than 120cm. Sensor works in about 80cm temperature & humidity are correct. But any cable further to 120cm doesn't work. The cable itself is Ok - tested with Serial LCD. It works. What can be the problem?
I spent about 9 hours bashing my head against this sensor (or, well, the wall while trying to get this sensor working) before finally getting it going. Write-up and sample code here
Key lessons:
Running into a bit of trouble hooking one of these up to an UNO. I've tried the NetHoncho and adafruit libs with no result. The NetHoncho lib gives me an "ACK time out"
Any thoughts on how to continue ?
It took me a while to get it going, but I've written it up and provided some sample code: http://blog.ringerc.id.au/2012/01/using-rht03-aliases-rht-22.html
Just got one of these,
Temperature reading seems accurate. RH is way off. at least 20% off.
What could I have done wrong? Is the sensor bad? I'm reading it with check-sum, so it is not likely a data interpretation issue.
From reading other comments it seems like I am not the only one seeing this type of behavior. Is this just a crappy sensor? the datasheet does indicate that it goes to as much as +- 5% at the edges, but +- 20% is utterly useless.
Any ideas?
It works almost perfect but.....
The temperature reports good results but the humidity is a little bit strange. It reports 29,70 29,80 29,90 30,00 99,99 I looks to me that there is some timing error or is it that I destroyed the sensor when I tryed out the 1K resistor as pullup instead of the 4K7 ? //Mats
Not sure why the example code for this product is in Microsoft Word (.doc) RTF format which can likely lead to corrupted characters and formatting issues? Why not share it using a Github Gist?
Here's an example of working code with the Arduino. The example polls every 6 seconds or so, and gives you humidity and temperature readings.
http://sheepdogguides.com/arduino/ar3ne1humDHT11.htm
Works a treat!
I got two of these few days ago. During the weekend I wanted to see how it worked. Connected pin 1 to 5V, pin 2 with 1K resistor to 5V, pin 3 and 4 to GND. Connected an oscilloscope to pin 2 and briefly brought pin2 to ground. I can see the rising edge, but just a flat solid 5V (i.e. high bit). I tried to pilot it using a digital line from a Flyport, but got same results. I tried to use the second RHT03 that I got, same behavior. Looks like they are not working. Any suggestions on what I'm doing wrong or how can I check if they are working? Thanks a lot.
The handshake to get the RHT03's to send data is the following.
The pin hook-up you have is right, the only difference is that I leave pin 3 floating, but it sounds like GND is necessary if using 3.3V.
Start with data pin HIGH
Set data pin LOW
wait ~18 ms
Set data pin HIGH
wait 40 us
At this point the RHT03 will start sending data.
I used ikalogic's analyzer to playback the above handshake to test my RHT03's. I have purchased three, so far, and all of them work and continue to work.
Thank you PharoahsMummy. I don't have a digital analyzer, but I do have an oscilloscope that triggers on the rising edge of the signal. I tried setting the data pin low for over 100ms to allow the RHT03 to recognize the start signal, but after the rising edge I don't see any response. The signal remains high. Does the low signal has to be exactly 18ms and if it is more or less won't work? This is not what the doc says, but I can try as soon as I find a little bit of time for my hobby :-)
Thanks a bunch.
The initial LOW does not have to be exact, the datasheet states minimum of 1ms, I usually go 18ms because it seems to work for the DHT22, DHT11 and RHT03. The pull high and wait for 40us needs to be exact, the data sheet says 20-40us. This pulse needs to be within 20-40us long or the RHT03 will ignore the request.
Well understood, but the 40us wait is to release control to the RHT03. With the oscilloscope, after I have have put the pin 2 to ground for 100ms and pulled it back up, I should see some set of high-low pulses... while instead I see nothing, but a high signal. Do you agree, there is something wrong or there are other things I should be checking? Thanks you very much for your council.
Yes, you are right, pulling the data pin high is to allow the RHT03 to pull it low and the RHT03 should do that approx 20-40us after the data pin goes high.
I would try the following, connect pin1 to power (5v), pin2 to data pin (plus 1k resistor to power), pin3 no connection and pin4 to ground. Start with the data pin high and set low for no more then 20ms, then bring high. The data pin should show signs of activity. If not something might be wrong with the RHT03.
Thank you PharoahsMummy for your kind support. I think I sorted this out. It was not how long I was pulling down the data pin. It was the fact that my PIC was starting to ask for data too early. What happens is that the RHT03 not only do not respond to that inquiry, but will never respond in the future to any inquiry. The only way is to reset it, i.e. cut the power and the re-establish it. Instead if the PIC waits a couple of seconds (may be more, I've not measured exactly), then the RHT03 works beautifully. The data sheet mention this "When power is supplied to sensor, don't send any instruction to the sensor
within one second to pass unstable status.". What it does not mention is that, if you do, the RHT03 will never respond again. Bitchy device :-)
I'm having a fair amount of problems with this product.
I'm using this library:
http://arduino.cc/playground/Main/DHTLib
And I'm trying to pull the information from the DHT22, and send it to a Pachube feed, once a minute.
I split up the calls for the current temperature and humidity. Each request is 30 seconds apart. However, I'm still getting a rate of around 45% checksum errors. I'm also occasionally getting spurious temperatures in the 55f(12c) range. My lab is pretty steady around 74-79f.
I've only had the chip for a week (today), and I'd really like to get this project completed (I've already gotten a couple requests for new unit builds). Am I asking too much of the sensor? Does anyone know of a method for reducing errors?
I'm using a resistor on the dataline, as specified. I put in a filtering cap, but didn't see any improvement with the error rate.
I ported the code above to be used with a PICs. I have found that the timings provided in the original code is not quite right.
If you have access to a logic probe/analyzer, take a look at the data line, I find that the values provided in DHTLib over shoot (over sleep) the first bit of the humidity data, causing every other byte to be off by one bit. Make your mcu print out the binary values of the 5 bytes captured from the RHT03. I use this method in conjunction with a probe to help determine what is going on.
When I get home later tonight, I will post a sequence of events and delays that have to happen to successfully read the RHT22 every time. I use the same sequence to read a DHT22, DHT11 and the RHT03 available here.
just got this device and was reading through your p-code (thank you) and saw that you've got an RHT03_PIN and an RHT03_PIN_DIR... but i'm not really sure what the DIR pin is for. do you use the RHT03_PIN_DIR pin to control the i/o or is it just for debugging?
The RHT03_PIN_DIR is used to control the RHT03_PIN's direction (input/output). Since this device uses a single I/O pin for communication, the code has to know when to send data and when to receive data.
Here is what I use to read a DHT22, DHT11, and RHT03, 99% accuracy.
RHT03_PIN - set 1 for high (5v), 0 for low (0v)
RHT03_PIN_DIR - set 1 for input, 0 for output
The above is the initial state used before and after gathering data from RHT03
=Pseudo code=
Init:
RHT03_PIN = 1; # Set output high
RHT03_PIN_DIR = 0; # Set direction to output
Start:
RHT03_PIN = 0; # Set output low
delay_ms(18); # Delay for 18 milliseconds
RHT03_PIN = 1; # Set output high
delay_us(40); # Delay for 40 microseconds
RHT03_PIN_DIR = 1; # Set direction to input
delay_us(40); # Delay for 40 microseconds
I was never able to get the sensor that I had running at 3.3v but Thomas sent me photos of the RHT03 running at 3.3v, I will assume it is something with the batch.
I will use the two I have up for a 5v project and wait for the a new batch to arrive and try the new batch at 3.3v. Looks like Sparkfun only has one left at the moment so shouldn't be too long
I got my sensor just a few days ago. It was marked in enclosure as RHT03.
It was not working until I decided to open it up and I found that the pin nr 4 is the unconnected and the nr 3 is the GND!! I was following this guide: http://www.ladyada.net/learn/sensors/dht.html
The sensor works with 3.3V for me, as you can see on the pictures. One picture shows the connection of only pins 1(3.3V) , 2(Data) and 3(GND). Other picture shows the data line on oscilloscope and the bits "produced" by the sensor :-)
It's bad the incomplete documentation of Chinese sensors/components :-( -- I am now an unhappy SparkFun costumer because I took a lot of time to get the sensor working and now I have an "incomplete" sensor because I had to cut off and remove the plastic enclosure.
http://www.flickr.com/photos/43558168@N00/6134478453/sizes/l/in/photostream/
http://www.flickr.com/photos/43558168@N00/6134478765/sizes/l/in/photostream/
Thanks for the heads up. I thinking the production side of things might be a bit rough. The sensors I have do work at 5V with pin 4 being ground. I spent about 8 hrs trying all the suggestions and anything else I read about to get those two to work at 3.3v no luck at anything less than 3.9 volts for the humidity to report correctly. Temp worked above 3.42 volts.
I am going to order a few more. This package is perfect for what I am doing and I like the price to.
I contacted Sparkun and asked for a new sensor, since I almost destroyed the other to discover the problem of exchanged pins -- they just sent me a new one as I expected.
Hmmm, the true is that I didn't yet verified the temperature and humidity against another calibrated sensor/monitor... I think I am getting high values of humidity and that they are incorrect -- I will verify and if so, then I will move to 5V as you say! thanks ;-)
Got the new shipment of RHT03 and I got them to work fine on 3.3 volts.
I had ordered 3 ea.
I unplugged the original RHT03(from above) then plugged in the new. it worked.
so plugged in the second it did not.
So reading your GND issue above i connected both pin 3 and 4 to GND and it worked.
Plugged the original back in with pin 3 and 4 connect to GND and it worked.
Problem solved at least for me.
So to recap at 5 volts the device works with pin 4 to GND at 3.3volts the device works with pin 3 and 4 hooked to GND.
I wont even pretend to know why.
Thanks
Glenn
I have now 2 units of RHT03 which I am running at 3.3V (GND at pin 3).
I am using a fluke multimeter and another one from unknown brand, to verify the temperature readings by the RHT03. On both two RHT03 I have, I read more 2,4ºC from value reading on multimeters!! -- I am not happy with RHT03 sensor :-(
Thomas
I understand what you are saying that they should be one and the same but they are not. The ones I am calling DHT22 were bought from sparkfun at the first of the year and match the picture above and will run at 3.18 volts(battery was getting low) and report correctly.
The one I am calling RHT03 has that with the MaxDetect logo on the bottom of it and were bought in July from sparkfun. It will not run at 3.31 or 3.46 volts correctly, measured at the vcc pin for the sensor.
I checked voltage using an ideal 61-361 meter.
I even reset up the original bread board that I had, and used sparkfun's FTDI break out board for power. the 5 volt version the RHT03 and DHT22 works, for the 3.3 volt version only the DHT22 work. I then hooked up a lipo for power putting it through a N4001 diode the voltage was 3.46 and the temp was right but the humidity was a little over double on the RHT03 the DHT22 reported correctly. I am using a ATMEL ATMega328P with ardiuno boot loader on some PCB I had made and the bread boards using Ben Adams version 4 DHT22 library.
The Temp and Humidity values are checked against a sensiron SHT15 on another bread board using a arduino boot loaded Atmega32p with the sensiron SHT15 library.
I have 3 more PCB boards that I need to populate and run at 3.3 volts so I am looking for some DHT22, I am going to use the RHT03 that I have for some green house controls I am going to make but they will be run at 5 volts so wont be an issue.
Plain and simple I can't get the last shipment to run at the same voltage the original ones I bought run at using the same set up...
It does't exsit RHT03 or DHT22 version. RHT03 and DHT22 are two different names for one same product.
We have three names for this product, the names are RHT03 DHT22 AM2302. So, be noted that you are using the same product.
I have asked our engineer to recheck if RHT03/DHTT22 could work under 3.3V DC this morning, the answer is RHT03/DHT22 could work properly under power supply of 3.3V DC.
I think you have to check if the power supply at RHT03's power pin is >=3.3V DC.
To add one more final thing I found that the RHT03 does seem to work at 3.46 volts, Close to the upper end of where my 3.3 volt LCD is not going to be happy. I hope they fix this issue and get the sensor back to what the DHT22 was doing.
Glenn
Thanks, Babcoccl, all good now - had a bad 5v connection. Accuracy within 0.5 degree C; pretty good for $10.
Cheers; Dave
I wonder if this can be adapted to the Peet Bros weather stations?
Thanks to NetHoncho for the library and code - a great help. Have hooked the sensor up as suggested but just get this error: "Requesting data... ACK time out". Does anyone have any ideas how to overcome this?
Cheers;
Dave
A few things I did to get mine up and running with NetHoncho's library:
1. Make sure my ground bus was indeed grounded (oops)
2. Remove the 4.7k resistor between Vcc and ground (not needed)
3. Make sure I had Vcc hooked up to 5V rather than 3.3V, @ 3.3V I get the ACK time out.
Hope this helps and thanks to NetHoncho for making a great library!
Can anyone help me?
I have try to follow the connection on data sheet.
But the Data pin always high.
What can I do for testing? Thank You.
Contact techsupport@sparkfun.com.
Can I place multiple DHT22s on the same wire and address them individually?
I know Maxim can handle this and I'd like to minimize the pins used for this on my Arduino as I'd like to put as many as 10 on my system, but I don't see where it states this capability for this version of 1-wire.
As the units do not appear to have individual serial numbers or addresses (like Maxim 1-wire devices) you can't do it without some trickery.
I can think of a way to do it, however, with a minimum of 3 pins, off the top of my head.
That would be a 2-wire serial-in, parallel-out shift register circuit (to provide multiple control lines) plus one input pin on the MCU to read the DHT22's responses.
Could I read the output from this sensor with just an XBee, without connecting an Arduino or microcontroller?
I've never played w/ an XBee, but from what I understand about them they basically just replicate the state 2 pins on the far end. If that is a correct understanding, then yes, you could read a remote DHT22 using an XBee.
It might be tricky since I think the XBee is more focused on serial communication and the DHT22 doesn't exactly work that way, but I think it might be doable.
Hey,
How does this compare to Sensiron's offerings? I have a SHT21 and a DHT22 on my desk connected to a PIC.
The temperatures are within a degree of each other, but the RH is ~30% out (SHT reads 34%, DHT reads 65%).
Obviously there is a price difference between the two but both claim to be calibrated etc.
Neither has undergone recent soldering, so I would have thought the humidity sensor has settled.
Any ideas?
Steaky
PICAXE 18M2 - Has anyone interfaced this sensor to this, who can give me a leg up as to how to do the communications code please? Pity its not Ascii or something more standard
Why not use C51 or AVR microcomputer to collect signal from DHT22, it's more simple.
This fits in this, yes?
The pins are .1" spacing. The data sheet is a bit misleading on this.
Also the pins are flat (not square) and do not make good contact in a standard female header (very loose).
I have modified the spacing to 2.54mm in the datasheet, our engineer overlook this detail, thanks.
Customers can download new datasheet at
http://www.humiditycn.com/fl1_1.html
Regarding the pins, DHT22(RHT03) is designed to be soldered on circuit board, so the pins are flat. Connection with female header was not under considered when our engineer designed DHT22(RHT03).
So we can't change the pins now.
Thanks for your kind advice, fellows.
Ouch! A bit worse than misleading if you design a circuit board to the data sheet (says 2mm instead of 2.54mm or 0.1").
Thomas Liu - if you read this, can you fix the data sheet?
I made some code and have been polling this with my ARMmite at 1 s intervals (using C, not BASIC). But while at first it seemed to work correctly, now it is returning 0 as the checksum (still giving numbers that seem correct for the Humidity and Temp though).... Odd.
I think you have to reset intervals from 1 s to 2 s at least, then it will be all right.
Hmm... When did this come in?
I estimate sometime in November 2010.
Is there any ETA on this item?
It's going to take a while to dig through there... from the datasheet:
If you want to download better datasheet, please click this website to download
http://www.humiditycn.com/fl1_1.html
I have optimized the datasheet. The model RHT03 and DHT22 are for one same product.
By the way, please buy from Sparkfun.
The first time I saw it, I thought it was a pico breadboard with just 3 rows of 5 holes (and some mysterious slots)!
Do you think these could be used outside?
Yes, DHT22 could be used outside. But it needs a cover to protect it from rain & exposure to sunshine.
when do you expect these units to be in stock?
They are on order, but shipping is slow. That's the best I can say right now as shipping isn't reliable in terms of time frame. But they are on order.
Is this item currently in stock?
No, sorry, we're backordered on them right now.
Is the interface compatible with 1-wire interface? The data sheet discusses the 1 data line, but it isn't clear that it is 1-wire as defined by Maxim/Dallas. Does anyone know?
Based on the example code (which is almost as hilarious as the datasheet), this part is NOT compatible with the Maxim 1-wire interface. Plus it's not an addressable device, so it can't share the 1-wire communication line with other devices either.
It's not the Maxim protocol, just a single wire interface. I'm changing the description to be more clear.