Hello folks, Where can I find the sketch for the DHT 11 to use on my Arduino Uno please? All i want to do is use it to sense the temperature and humidity and display it on an lcd screen. When i first started using the Arduino IDE the code was included in the Sensors section, then I later updated the IDE and that code was gone .I have searched high and low but cannot find it.I have tried various sketches I found online but when I look at the serial monitor it is just gibberish rubbish. I am not smart enough to write my own sketch sadly ! Hope someone can help.Manynthanks

check - http://playground.arduino.cc/Main/DHT11Lib -

or if you want to be prepared for the future ;)


Hey thank you friend .I will try those in the morning .I really appreciate it. I just wish I was clever enough to write these things myself. I mean, I am far from being thick but it just seems so complex. Cheers

Writing your own libraries will come after doing enough projects with repeating code.

If you have remarks / questions about the DHT libraries feel free to ask.

detailed usage at :http://www.elecrow.com/wiki/index.php?title=DHT11 hope it helps

well ,I finally found the time to try the code you were kind enough to show me for the DHT11 sensor with my arduino uno. I copied the code and clicked Verify but all i get is error messages.One of those errors says DHT11LIB_VERSION WAS NOT DECLARED IN THIS SCOPE Another error message says CHK WAS NOT DECLARED IN THIS SCOPE and so on ....I am baffled.It is WAAYYY over my head. I just want the DHT11 to send the temperature and humidity to my lcd screen ...or even just to the serial monitor for now. I cannot understand how the code that worked has vanished from the examples section in the IDE .It worked everytime I played with it. I am using windows 7 64 bit by the way if that matters. I have scoured the internet for DHT11 code and tried various ones but not one of them works .i am tearing my hair out . :( :( i give in .

Hi Leema,

I’ve just faced a similar situation few days ago, same sensor and same library (DHT11).

First of all don’t give up. It is only matter of patience and time. Sooner or later you’ll achieve anything you wish.

Second, about DHT11 sensor and related library, other than all typical mistakes importing libraries, based on my experience (I should say my mistakes), try to double check that:

  • the .cpp and .h files are actually named dht11.ccp and dht11.h
    reason: only after 2 days I realized I named them dht.xx instead of dht11.xx
    and of course the compiler could not find the files.

  • once it will run (it will run!!) be sure also the right serial port on serial monitor is set. The sketch is not set on the “typical” 9600 rate. To bear in mind in case you see all strange symbols… :slight_smile:

Also be sure the name of the folder is DHT11.

The sketch is written to work exactly with these names so… don’t twist with them. Try the example sketch as it is, only afterwards, once you are happy it is working, start play changing…

Let us now how it goes…

Hi folks , I have finally figured things out ! I got the DHT11. to work with my UNO again . It turned out I was placing the files in the wrong place .Just stumbled across the answer really but I have now learned something by trial and error. Thanks again for all the help . I am now determined to learn how to write my own code and stuff.It will be a VERY long hard road by. I will do it. All the best !