Arduino Clock With DS3231 and LCD1602

This project is part of a bigger one but it can be a standalone project. It's basically a clock with two buttons for setting the time and date.

It doesn't look that great on the breadboard with all those wires but it does the job and it can be simplified by using a I2C display, but I'll cover that subject in a future instructable.

The operation mode is quite simple, you have two buttons, the first one, linked to the pin 8 on arduino is used to select the parameter (date, hour minute ...) and at the end to save the new date. The second button, which is attached to pin 9 on arduino, is used to increment the selected parameter and at the end to cancel data you have just entered (don't save) in case you're not happy with it.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Parts Needed:

1. Arduino UNO R3 or compatible board

2. DS3231 RTC (Real Time Clock) module

3. CR2032 battery, if the module doesn't come with one

4. LCD 1602 display

5. 50K ohm variable resistor for adjusting the contrast of the 1602 LCD

6. 2 buttons for adjusting the date and time

7. Two 10K ohm resistors for button pins pulldown

8. Jumper wire for connecting the parts

9. Breadboard

Step 2: Assemble the Scheme

Since I'm sure you can't make the connection based on the first photo of the project, here's the scheme for it.

Step 3: Write the Code:

You can find the code for this project here, in the attached file. Feel free to modify it to suit your needs. The code is explained inside the .ino file. Any suggestions is welcome.

Also the library I used is attached. Other libraries of DS3231 might not work.

2 People Made This Project!


  • Assistive Tech Contest

    Assistive Tech Contest
  • Reuse Contest

    Reuse Contest
  • Made with Math Contest

    Made with Math Contest

10 Discussions


7 months ago

Here's a tip for anyone trying to make this... If you try to use the Serial monitor with this project, it will make the LCD display garbage as soon as you issue the Serial.begin(9600); This because the Serial interface uses pin 1 and 2, and we are using it here to drive the LCD. I changed the lcd( to: LiquidCrystal lcd(7, 6, 5, 4, 3, 0); and moved the wires from Pin 2 to 3 and 1 to 0. Then I was able to use the Serial monitor to display the RTC temperature.


12 months ago

In the initialisation, before the setup there is an error in the 7th line "LiquidCrystal lcd(1, 2, 4, 5, 6, 7);"
the correct pin setup is "LiquidCrystal lcd(7, 6, 5, 4, 2, 1);"
Thanks for the tutorial

2 replies

Reply 7 months ago

Thanks!!! I was scratching my head!!!

Ionut Razvanxyden7351

Reply 12 months ago

thanks for the heads-up, after a close inspection of the scheme and the assembly photo I realized that I have made the wrong connection in the included scheme, so if you follow it you must make the initialization as you said it.


9 months ago on Introduction

Thank you! A noobee to Aurdino and the basic ACCURATE clock with LCD and time set were fundamental to moving my project forward. Have learned a lot in a few short weeks (like all 3231 RTCs are not the same in regards to time keeping accuracy). With your working code, I can step back and learn what the code is doing. Note to others: you will want to delete any previous DS3231 library and follow the tip to use the library as mentioned in instructions, as there will be an error defining the SDA/SCL pins. You will need to correct the pin setup order as mentioned below for the LCD to (7,6,5,4,2,1)

Ionut RazvanRichardS492

Answer 1 year ago

I did but it's not finished, I used a 1602 LCD with a I2C adapter and also a OLED 128x64 with I2C interface. I'll make an instructable with both since it's almost the same. If you want more information feel free to ask, I'll do my best to answer.

I used the library for I2C LCD available here:

it should work with your display.

It can be used in many projects, but my project is an indoor greenhouse, automated and monitored with arduino.