PIC18F4550 + 20×4 LCD + DS1307 RTC + DHT22 Sensor – CCS C

Real time clock with relative humidity and temperature sensing
PIC18F4550 with DS1307 RTC and DHT22 sensor hardware circuit

This topic shows how to build a real time clock with relative humidity and temperature sensing using PIC18F4550 microcontroller, DS1307 RTC and DHT22 sensor where all data are displayed on 20×4 LCD display. The 20×4 LCD has 20 columns and 4 rows which is good enough for this project. The compiler used to program the microcontroller is CCS PIC C PCWHD.
To see how to interface PIC18F4550 with DS1307 take a look at the following topic:
Real time clock with PIC18F4550 and DS1307 RTC – CCS C

And to see how to interface PIC18F4550 with DHT22 (AM2302) take a look at this topic:
Interfacing PIC18F4550 with DHT22 sensor – CCS C compiler

Required components:

  • PIC18F4550 microcontroller
  • DS1307 RTC
  • DHT22 (AM2302 – RHT03) sensor
  • 20×4 LCD display
  • 3V Coin cell battery
  • 32.768KHz crystal oscillator
  • 2 x 10K resistors
  • 4.7K resistor
  • 10K Potentiometer
  • 2 Buttons
  • +5V Power Supply
  • Protoboard
  • Jumper Wires

AM2302 or RHT03 sensors can be used instead of the DHT22 sensor.

Project circuit:
PIC18F4550 DS1307 DHT22 circuit

In this project PIC18F4550 microcontroller internal oscillator is used (8MHz) and MCLR pin function is disabled.

CCS C code:
The C code below was tested with CCS C compiler version 5.051.

Interfacing PIC18F4550 with DS1307 and DHT22 Project Video:


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

1 thought on “PIC18F4550 + 20×4 LCD + DS1307 RTC + DHT22 Sensor – CCS C”

  1. I was gratified to see this program and I wanted to say thank-you! I am not a programmer but it is a hobby for now. I love microelectronics and programming though, and I am hoping to learn new stuff all the time.

Leave a Comment

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.

Scroll to Top