PIC16F887 Microcontroller with DHT22 digital sensor – CCS C

This is an example for interfacing the microcontroller PIC16F887 with DHT22 (RHT03 – AM2302) digital relative humidity and temperature sensor with CCS C code and Proteus simulation.

Read DHT22 datasheet to understand what I’m going to do because every thing about the sensor is in its datasheet which can be downloaded from the following link:
DHT22 Datasheet

Required Components:

  • PIC16F887 Microcontroller
  • DHT22 or compatible Sensor
  • 1602 LCD screen
  • 10K Potentiometer
  • 4.7K ohm resistor
  • 0.1µF Ceramic capacitor (Optional but recommended)
  • +5V Power source
  • Breadboards
  • Jumper wires

PIC16F887 DHT22 sensor hardware circuit

Interfacing PIC16F887 microcontroller with DHT22 digital sensor circuit:

PIC16F887 DHT22 sensor circuit

In this example the internal oscillator of the microcontroller is used and MCLR pin is configured as a digital input pin (no clear circuit required).

PIC16F887 Microcontroller with DHT22 digital sensor C code:
This is the C code of our example, it has been tested with CCS PIC C compiler version 5.051.

The following video shows simulation using Proteus of PIC16F887 and DHT22 sensor:

C Code, HEX and simulation files can be downloaded from this link:
Simulation Download

Leave a Reply

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