Go Down

Topic: DHT11 Temp and Humidity Sensor (Read 15076 times) previous topic - next topic

waterboy550

I am trying to use the DHT11(http://www.robotshop.com/dfrobot-dht11-temperature-and-humidity-sensor-2.html) with my Arduino Duemilanova. I have found some code that some poeple have had some success with. Here is a link to that (http://sheepdogguides.com/arduino/ar3ne1humDHT11.htm). I however keep getting the error: "Error 1: DHT start condition 1 not met." I have the sensor plugged into analog 0, I have also tried analog pin 0-5 while changing the code to the correct 14-19 pin. Anyone have experience with this sensor and this code or any other code that has been successful with these sensors?

pwillard

#1
Feb 01, 2011, 06:49 pm Last Edit: Feb 01, 2011, 06:53 pm by pwillard Reason: 1
My first question:  Why ANALOG Zero? This device communicates digitally and does not perform any analog interfacing.

http://www.micro4you.com/files/sensor/DHT11.pdf

Nuelectronics also has some code for this:
http://www.nuelectronics.com/download/projects/sensor_pde/dht11.pde

And some additional info here(which appears to be a fix for the reference code you mentioned):
http://linux-utils.blogspot.com/2010/10/dht11-arduino-with-virtualwire.html






waterboy550

I've looked at a few of those links and haven't had much success. I'll have more time to troubleshoot this issue tomorrow. If anyone else has some knowledge about these sensors that would be great! I'll post my results soon, hopefully  :)

waterboy550

I have the sensor connected to the following things. Vcc to 5V, ground to ground, and data line to ADC0. Do I need to connect the ground and the Arduino ground?

waterboy550

SOLVED:
Use this code (http://sheepdogguides.com/arduino/ar3ne1humDHT11.htm)

Make the corrections on this site (http://linux-utils.blogspot.com/2010/10/dht11-arduino-with-virtualwire.html)

Also the ground on the sensor does need to be connected to the Arduino's ground!!!!

Thanks for all the help!!!!

pwillard

Quote
Also the ground on the sensor does need to be connected to the Arduino's ground!!!!


Just out of curiosity... what did you connect the ground to?

carl47

#6
Apr 18, 2011, 08:06 am Last Edit: Apr 18, 2011, 08:19 am by carl47 Reason: 1
Quote
Just out of curiosity... what did you connect the ground to?


Of course the ground must be connected to arduino earth.

They have a three pin connector which fits very neatly next to a bare 328 socket -pin 21(VCC) -pin 22(GND) -pin 23(PC0)

I have a question about this sensor available at:

http://littlebirdelectronics.com/collections/df-studio/products/dht11-temperature-and-humidity-sensor


 Using the code at:

 
http://www.dfrobot.com/image/data/DFR0067/DHT11_TEST.zip


  The read sequence gets 5 bytes. The last byte is the check sum.

  The first 4 bytes are:
  "8bit integral RH data + 8bit decimal RH data + 8bit integral T data + 8bit decimal T data".
 
  The first two bytes are humidity. The first byte is the whole number(20 to 90).
  The next byte is the decimal fraction but its always 0.
 
  The same with the the two bytes for temperature(0 to 50).

  Why bother providing the second byte in each case if its always 0?

  The Resolution is stated as 1 digit so the decimal fraction is useless?

robtillaart

@waterboy
I recently created a library for both DHT11 & DHT 22, might be usefull, see - http://arduino.cc/playground/Main/DHTLib
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

carl47

#8
Apr 19, 2011, 06:30 am Last Edit: Apr 19, 2011, 06:32 am by carl47 Reason: 1
@robtillaart

With the example code I gave above I get:

Quote
Ready
Current humdity = 70.0%  temperature = 23.0C


With your class I get:

Quote
DHT11 TEST PROGRAM
LIBRARY VERSION: 0.3.2



Read sensor: OK
Humidity (%): 70.00
Temperature (oC): 23.00
Temperature (oF): 73.40
Temperature (K): 296.15
Dew Point (oC): 17.25
Dew PointFast (oC): 17.23


I like your class and I will use it in my project.

Any thoughts on the extra byte matter that I brought up?

robtillaart

Quote
Why bother providing the second byte in each case if its always 0?

   The Resolution is stated as 1 digit so the decimal fraction is useless?

Quote
Why bother providing the second byte in each case if its always 0?

   The Resolution is stated as 1 digit so the decimal fraction is useless?


In the DHT22 these bytes are used and contain data. The protocol to transmit the data is the same for DHT11 and DHT22, however the meaning/interpretation of the bytes transported differs.

For the DHT11 one can just skip byte 2 and 4 as they are not used. It would save 40% of the communication if they were not sent

If you have remarks or comments to improve the DHT lib,  please PM me .
Rob
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

carl47

Thanks for your answer Rob.

I understand now.

cheers   :)

Go Up