DHT11 or DHT22 Temperature and Humidity Sensors with the Propeller?
Drone
Posts: 433
I picked up a couple of DHT11 temperature and humidity sensors (can be had for around three to five USD each; a bit more with a breakout board. But the sensor's native pin-outs are 0.1" spaced as-is).
I would like to interface these sensors with the Propeller. Has anyone done this before?
The DHT11 and higher-performance but more expensive DHT22 (apparently from China) are very popular with the Arduino and PIC Community.
I've searched the Propeller Forum and ObEx and have not found anything that addresses these seemingly very popular parts.
The sensor uses a digital pulse-width method to distinguish between 1's and 0's in the 40 bit data output. The interface is via a single wire with a pull-up resistor (5V and 3.3V compatible). Note, the protocol is not the same as the Maxim/Dallas one-wire specification. The DHTxx modules are not individually addressable.
Here's the best of what I can find about how these parts work so-far:
* Data Sheet for DHT11 Temperature and Humidity sensor (likely translated from Chinese, but half-way decent):
http://www.robotshop.com/PDF/dht11.pdf
* A good explanation of the protocol in a project interfacing a DHT11 to a PIC16F628A:
http://embedded-lab.com/blog/?p=4333
Thanks for any feedback or suggestions...
Best Regards, David
I would like to interface these sensors with the Propeller. Has anyone done this before?
The DHT11 and higher-performance but more expensive DHT22 (apparently from China) are very popular with the Arduino and PIC Community.
I've searched the Propeller Forum and ObEx and have not found anything that addresses these seemingly very popular parts.
The sensor uses a digital pulse-width method to distinguish between 1's and 0's in the 40 bit data output. The interface is via a single wire with a pull-up resistor (5V and 3.3V compatible). Note, the protocol is not the same as the Maxim/Dallas one-wire specification. The DHTxx modules are not individually addressable.
Here's the best of what I can find about how these parts work so-far:
* Data Sheet for DHT11 Temperature and Humidity sensor (likely translated from Chinese, but half-way decent):
http://www.robotshop.com/PDF/dht11.pdf
* A good explanation of the protocol in a project interfacing a DHT11 to a PIC16F628A:
http://embedded-lab.com/blog/?p=4333
Thanks for any feedback or suggestions...
Best Regards, David
Comments
SensirionPst120406a - Archive [Date 2012.04.06 Time 15.26].zip
Thanks Kevin! The SHT-11 uses a clocked two-wire protocol, while the DHT-11/22 uses a one-wire protocol. But I'll read the SHT-11 data sheet and have a look at your code to see if I can pick up some pointers.
Regards, David
If you are clever, you can transform the equations to remove the use of floats.
I use this method, along with Sensirion_Full to read the sensor, then process the measurements. This adjustment is only accurate for 3.3v.
Both temperature and relative humidity are returned multiplied by 1000. For example, a reading of 98.675 will be returned as 98675.
When I save the data, I save it like this, or I write the integer string, a decimal point, then the decimal string to a file.
I'm pretty sure these equations are accurate. I spent a good while tweaking them so that I could remove the floats and maintain precision.
I actually haven't compared this to a method using floats in the propeller, but I did compare the equations in Excel.