Arduino DS3231 RTC Clock With LCD

Published

Introduction: Arduino DS3231 RTC Clock With LCD

About: I am a college student who loves to make things and share them. If you would like to support my projects, check out the help page on my website above for my Amazon Wish List and other ways to help. Thank-you!

To familiarize myself with a DS3231 RTC (real time clock), I built a simple arduino based 24 hour clock. It has 3 buttons with the following functions: press any button to enter the time setting mode, increase and decrease the time in minutes with two of the buttons, and set the clock with the third button. You can checkout a video of it working at vimeo.com/andrewideas/simplearduinoclock.

Materials Required:

  • An arduino development board (I used an Uno)
  • A standard 16x2 HD44780 based LCD display
  • A DS3231 based RTC (I got mine on Amazon)
  • Three push buttons
  • Three resistors (~10K ohm)
  • A potentiometer (~10K ohm)
  • A breadboard
  • Several jumper wires

Step 1: Wiring

Refer to the drawing for wiring instructions. The buttons are connected to pins A0, A1, and A2. The RTC uses pin A5 for SCL and pin A4 for SDA. The potentiometer varies the contrast on the LCD and the LCD uses digital pins 2 through 7.

Step 2: Programming

Use the arduino IDE to upload my sketch to your arduino.

My code was partly based on the code provided here. And, of course, my code is explained in its comments.

You can download the sketch from this instructable.

Step 3: Continuing on With Your Life

You did it! Unless you didn't- in which case comment below and I'll do my best to help you out. Otherwise, go on ahead and do even greater things!

As a student, I do not always have the finance to fund projects. I love making and sharing things with the world, but sometimes supplies are expensive. There is by no means any pressure, but if you like my work and want to help show appreciation and offset the cost of some of my projects, I have an Amazon Wishlist where you can donate items or gift-cards. You also check out my complete list of ways to help at arwhitus.weebly.com/help.html.

Thanks!

3 People Made This Project!

Recommendations

  • Water Contest

    Water Contest
  • Creative Misuse Contest

    Creative Misuse Contest
  • Oil Contest

    Oil Contest

18 Discussions

I have all the wiring and coding right, and the LCD lights up and the potentiometer works perfectly. The problem is that the time doesn't show up on the LCD screen, and it only shows a blank screen with squares. Suggestions?

1 reply

If your LiquidCrystal library isn't working, this would explain the LCD not displaying anything, getting the library loaded in your IDE and in your sketch should solve this.

Also I can't seem to upload the BasicClock.ino to my library and sketch. It says library not found. Maybe there is an updated version or I can use a different ds3231 library for it?

1 reply

On my installation of the Arduino IDE the Wire and LiquidCrystal libraries were both included. Check out https://www.arduino.cc/en/Guide/Libraries for help checking if you have these, and if not you should be able to use the library manager to install them. Thanks!

good day, can i use this as a stopwatch with lap times?

5 replies

Hey, this project was designed to be a clock rather than a stopwatch. However, you could use a similar hardware design and make use of the RTC to keep good time and print the output to the LCD.

Thanks!

thank you for your reply,
however i'm new to this and trying to learn arduno, can guide me,
thank you

This doesn't include a rtc, but an rtc is not as important in a stopwatch application anyway.

http://fritzing.org/projects/arduino-lcd-stopwatc...

It is a simple stopwatch, and if you want to incorporate an rtc simply connect it to I2C like I did and use the setRTCTime() and readRTCTime() methods to access the time from the rtc. From there, you should be able to use arithmetic to calculate the passing of time.

Best of luck!

having trouble and not sure how the time should look in the code i just get a back lit screen doesn't respond to the potentiometer anyone that can help me.

thanks

1 reply

The format for the parameters of setRTCTime() is (sec, min, hr, day of week, day of month, month, year)

For example: setRTCTime(0, 3, 23, 4, 15, 7, 17);

Hope this helps!

your instructable is very awsome

i am a very very new in arduino big world ,,,

and i need help in my second or third arduino project.
...
i need to build a code that repeat it self every 24 hour "every day"
without RTC module

Example like:
at 9 clock "pin 3 High"
at 11 clock "pin 4 High"
at 18 clock "pin 5 High"
at 20 clock "pin 6 High"
at 22 clock "pin 7 High"

and repeat that commands every 24 hour ""every day"
can you help me with that

2 replies

Thanks for the kind words!

Without an RTC you will run the risk of loosing time accuracy over time, but you can accomplish something what you are asking about by using the delay function. I quickly wrote up a sketch to do what I think you are describing and put it on my site at: http://andrewideas.weebly.com/arduino-delay-pract...

Hopefully you can use this code to work on your project, but bear in mind I have not tested it. None the less, it should be a good starting point for you. Thanks!

Many many thanks for you AndrewIdeas , and I am very happy for your concern

i will test it and feed you by results