Temperature and humidity measurement with DHT11

doit 011

This article describes temperature and humidity measurement with DHT11 sensor connected to TR module. Circuit diagram is very simple. You need only power supply for sensor and one wire for data line. This line has to be “pull-uped” – sensor has open colector output.

Attached source code reads data every second. Then data are sent out of module via RF. As receiver, you can use E03-TR example (TR module has to be inserted in CK-USB-0X) and IQRF IDE terminal, or you can use RF-UART conversion source code (UART_LINK.c) and any serial terminal. If you prefer simple solution, use the GW-USB-05.

Source code is written as “Ready To Use”. You have to only call readDHT11 routine and check returned flag.

#define OK  			0 - OK
#define NO_PULLUP		1 - bad wiring, missing pull-up
#define NO_ACKNOWLEDGE_0	2 - ACK "0" does not come
#define NO_ACKNOWLEDGE_1	3 - ACK "0" does not come
#define NO_DATA_0		4 - timeout for reading log.0 
#define NO_DATA_1		5 - timeout for reading log.1
#define NO_CRC			6 - checksum error

Following picture shows interconnection between DHT11 and IQRF TR module.


Post sent by Tomáš Novotný.


Download Attachments

  • pdf DHT11.pdf
    DHT11 datasheet
    File size: 846 KB Downloads: 10223
  • pdf DHT11-TR-SCH.pdf
    Circuit diagram
    File size: 12 KB Downloads: 2823
  • zip dht11.zip
    TR module source code package
    File size: 10 KB Downloads: 5439

3 thoughts on “Temperature and humidity measurement with DHT11

  1. Madhu

    hi i just want a dht11 source code and also interfacing code and schematic to run in pic c and proteus
    (dht11 with pic16f877a)

    thank you in advance

  2. Pingback: Using the DHT11/DHT22 Temperature/Humidity Sensor with a FRDM Board | MCU on Eclipse

  3. Bootsy

    so I’ve got one of the dht11 break out boards with the 10k resistor already integrated and I’m having a difficult time because first and foremost..the data only became true on my serial monitor once I swapped the 5v and GND from what the board shows and any tutorial you might find will tell you… That’s not my issue tho.. Well, perhaps it is but I mean I was setting up to work on my code and I almost want to say I seen a spark come from the 9v battery that comes with some of the kits for the Arduino Uno… Anyway.. I believe it’s pulling/shorting my controller out immediately upon plugging the last wire in and yes I even tried it still powered up because I thought the board was shot until I pulled the wires. Yes they are cheap but that defeats the purpose of attending electronics engineering classes if I can’t figure out the issue. I understand it’s a capacitor type component, my question is the type they use in these are not sealed cans or dipped but two flat layers with an absorbent material in the middle.. There was a little trace of greenish powdery substance in the back side of the capacitor across about 3 of the strips that look like capacitive touch pads, inside on the actual sensing component and cleaned it of but the plating is missing on one of the strips.. Would this cause a short and continuity between signal and the nc pin?


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.