Microchip | The Embedded Control Solutions Company Register Login
Browse All
 1 Code Snippets

DHT11 Driver for C18(Generic)


Basic generic driver for DHT11 Humidity & Temperature sensors.

About this Code Example

This example coded on one of our development kits but can be fit any MCU with small change as we make it work on lots of other MCUs as well. This example uses PIC18F4520 with 20Mhz crystal. Check main.c for more information.

This code uses CRC code from sensor to check correctness of reading. Thus if you get weird values from sensors. Do not forget to calibrate it. Check its datasheet as it says.

Step one: Keep the DHT sensor at the condition of Temperature 50~60 Celsius, humidity <10%RH for 2 hours;
Step two: Keep the DHT sensor at the condition of Temperature 20~30Celsius, humidity >70%RH for 5 hours.


Release History

  • Jun 21, 2013

    Version: 1.0.0


Download Contact the Developer

*Required Fields

  • Current Version:1.0.0
  • Created:Jun 21, 2013
  • Updated:Feb 26, 2015
  • Downloads:5728
  • MPLAB Version:MPLABX v1.80
  • C Compiler:MPLABX C18 v3.45
  • Development Tools:Expkits EX8, Generic
  • Supported Devices:PIC18F4520, Generic

Corporate News


Stay Connected

Stay up to date with the latest news from Microchip Technology.