Pages: [1] 2   Go Down
Author Topic: DHT11 Woes  (Read 1750 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have a DHT11 plugged in and feeling silly

long story short I have tried 3 different libraries (1 on arduino.cc, 1 on adafruit, 1 on github)
and Serial.print for the raw data received from the sensor and always 0's or 255 (255 might have been a fluke since it only showed once on the github library)

errors reported have mostly been timeout errors, with general fault and invalid value thrown into the mix at various configurations

so far it's all been attempted through various digital ports on the Arduino

DHT11 has 4 pins
  • 1 = power
  • 2 = signal (tried port 1-13) (with 10k jumper from power)
  • 3 = dummy
  • 4 = ground

still a greenhorn at writing Arduino code and this is the first sensor I've tried plugging in -- any ideas what I might be missing or data that I haven't reported that would be helpful in finding what direction to be looking?

thanks in advance
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It is definitely not your code. Look somewhere else.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 224
Posts: 13917
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@dhenry
?

@amites
Have you tried this library and code - http://www.arduino.cc/playground/Main/DHTLib/ - it has been tested with DHT22 and DHT11 on duemillanove, UNO and MEGA.

Be aware that the DHT11 needs 2 seconds between sampling (google for datasheet)
Logged

Rob Tillaart

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

Switzerland
Offline Offline
Faraday Member
**
Karma: 111
Posts: 5255
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A quote from the playground article:

Quote
There have been reports that some sensors have pin 3 and 4 reversed, probably as a quality control/manufacturing issue. If you have issues, consider grounding both pins 3 and 4.

Have you tried that?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just tried grounding pins 3 &4 together -- same result

running the library from http://www.arduino.cc/playground/Main/DHTLib/
it returns bGlobalErr = 1 (Start condition not met)

if I disable that section then it spits out Error 3: DHT Checksum Error


beginning suspect the Arduino Uno I'm working with may be faulty as I've tried 2 different DHT11's and get the same result


any other ideas to debug are appreciated
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 111
Posts: 5255
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you make a picture of your wiring and post it?
Logged

Offline Offline
Edison Member
*
Karma: 49
Posts: 1676
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I've tried 2 different DHT11's and get the same result
Where did you get them?

Pete
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the sensors came from hong kong via eBay -- going to borrow one from a friend shortly

quick diagram attached


* dht11.png (7.31 KB, 161x318 - viewed 11 times.)
Logged

Offline Offline
Edison Member
*
Karma: 49
Posts: 1676
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
the sensors came from hong kong via eBay
Thought so. That is probably what is wrong.

Pete
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have been playing with the DHT11 sensors the past couple days and had much the same problem initially.  I ended up having the pins reversed, (ie 1 for 4). The label facing AWAY from you, pin 1 is on left.

Would assume you tried already, but it worked for me.

I have the DHT11 (chinese versions).
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Borrowed a friends DHT11 -- plugged it in same result

even tried turning it around in the protoboard on an off chance

still nada...
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 224
Posts: 13917
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Do other sensors work properly?
Have you used other arduino pins?

Please post the non-working code
Logged

Rob Tillaart

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

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

borrowed a friends Duemilanove and tried the same hookup

same result

most recent library I tested is from ADAfruit at https://github.com/adafruit/DHT-sensor-library

though I added at line 33
Code:
    Serial.print("h = ");
    Serial.println(h);
    Serial.print("t = ");
    Serial.println(t);


which spits out the result of
Code:
DHTxx test!
Read failh = 0.00
t = 0.00
Failed to read from DHT
h = 0.00
t = 0.00
Humidity: 0.00 % Temperature: 0.00 *C
h = 0.00
t = 0.00

same result with 3 different DHT11 sensors

this one is starting to really bug me


** EDIT: added debugging code & result **
« Last Edit: December 04, 2012, 05:05:33 pm by amites » Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 224
Posts: 13917
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you can patch the library and make the 5 databytes that should be received public to see if any signal is coming in and print them.

If you have a scope you should be able to detect the 40 bits

Just checking - you have connected the DHT11-datapin to a digitalpin of the arduino? (Once seen in another thread)

Which board are you using?
Logged

Rob Tillaart

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

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

**UPDATE**

I was using wire with a thin layer of insulation that I couldn't see -- thus no signal

now getting readings that come back way off from possible but progress
Logged

Pages: [1] 2   Go Up
Jump to: