DHT11 Woes

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

It is definitely not your code. Look somewhere else.

@dhenry
?

@amites
Have you tried this library and code - Arduino Playground - 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)

A quote from the playground article:

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?

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

running the library from Arduino Playground - 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

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

I've tried 2 different DHT11's and get the same result

Where did you get them?

Pete

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

quick diagram attached

dht11.png

the sensors came from hong kong via eBay

Thought so. That is probably what is wrong.

Pete

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).

Borrowed a friends DHT11 -- plugged it in same result

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

still nada...

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

Please post the non-working code

borrowed a friends Duemilanove and tried the same hookup

same result

most recent library I tested is from ADAfruit at GitHub - adafruit/DHT-sensor-library: Arduino library for DHT11, DHT22, etc Temperature & Humidity Sensors

though I added at line 33

     Serial.print("h = ");
    Serial.println(h);
    Serial.print("t = ");
    Serial.println(t);

which spits out the result of

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 **

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?

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

The temperatures are in Celsius so if you expect Fahrenheit (don't know) they are way off :wink:

IN the datasheet there is a line or two about how to calibrate the thing.

hi
I also got the issue with one sensor coming form china on a small board ... they changed the pins order ... so you should look at the wiring, that my 2cents...