Skip to content

How to setup DS1302 RTC module with Keypad + Arduino + LCD



Hello everyone,

In this tutorial we gonna make a project suggested by one of the viewers, which is setting up the DS1302 Real Time Clock module using a Keypad, we’re using a LCD screen to show the date and time, also helps us to set them up.

The functioning is quiet simple, the LCD is continuously showing the current time and date, when we press “*” button, it let us to set the date and time and then it shows the new value until you change them again. The code is also simple and easy to understand you can put it in your future project as I did when I made an alarm clock.

Before you start this project I recommend always to start by knowing well every module (otherwise you’ll waste a lot of time) then combine them until you get to your goal, by doing this you can easily spot a problem and find the solution, here you can check every module I used with its own tutorial:

Watch the video above for more explanations.



Wiring:

Wiring
RTC DS1302 + Keypad + LCD i²c wired with Arduino Uno board

This is the wiring you can add or not that 1k resistor it depends if you have the same problem as I got (see in RTC tutorial)

Libraries:

Here below you can download all the libraries I’ve used:



Code:

And here’s the code I’ve used to download, or check below:

The code is very easy to understand, it’s not very optimized though… beginner level.

 

Yassine View All

Automation and Electrical Engineer, Electronics amateur trying to share my little projects.

11 thoughts on “How to setup DS1302 RTC module with Keypad + Arduino + LCD Leave a comment

  1. Hi, this looks like a great project for what I a working on. On line 21 of the code, I was wondering why you defined all of the LDC pins instead of just the SCL and SDAT pins? Without connections to them on the Arduino, does that work? I haven’t wired this up to find out yet. This is just something I noticed.

  2. Hi, I just wired it up. I tried to compile it and it threw a couple errors. I changed LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin); to LiquidCrystal_I2C lcd(I2C_ADDR,16,2);

    I also deleted lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE); it seemed the library didn’t recognize it.

    After that it compiled without errors, but after I upload the coade, nothing displays on the LCD screen. I have double checked the wiring and everything looks good.

    • Hello, it seems you have a library problem… I recommend changing all LCD functions to your current library functions or change your library. You cannot use library functions with some other library.

Leave a Reply

Discover more from SURTR TECHNOLOGY

Subscribe now to keep reading and get access to the full archive.

Continue reading