Arduino Real Time Clock

Home/Arduino Projects/Arduino Real Time Clock

Arduino Real Time Clock

Building an an Arduino real time clock with a 1.8″ color TFT display (ST7735) is very easy. The project displays the current date and time along with the temperature. It also displays then minimum and maximum temperature. All you need to do is to follow the steps we show in this video. The cost of the project is very low as well. You can build this project with around 10$. Impressive isn’t it? That’s the power of Arduino and open software. The parts needed are these:

Parts Needed in order to build an Arduino real time clock:

1. Arduino Uno:

2. DS3231 RTC module:

3. 1.8″ Color TFT:

4. Small Breadboard:

5. Wires:

Code of the project

The code of the project is very simple and it is described in the video. In the .zip file that I share, you can find both version of the code, with temperature in Degrees C and degrees F.

Download the code



  1. Craig October 30, 2015 at 5:13 pm - Reply


    My son and I just built this project – and we love it. However, now we want to compartmentalize it – add an external power supply and a case of some sort.

    Would you have any recommendations on how to proceed with that?

    Thank you!

  2. Eddy December 16, 2015 at 12:55 pm - Reply

    Hi Craig your project is nice I liked it but when I down load to the arduino I only see black screen,I am using 1.8 tft display from banggood .please can you help me….thanks Eddy

    • Nick December 18, 2015 at 11:43 am - Reply

      Hello Eddy,

      I had the same black screen when I had the I2C wires connected the wrong way. Please check all your connections carefully!

  3. Stuart Smith December 22, 2015 at 2:53 pm - Reply

    Hi there.
    I have just received the 2 tft colour displays I ordered from China.
    I am trying to build the Arduino real time clock with this display. But I am stuck on compiling the code for this.
    Please could you send to me the complete code with all of the libraries compiled in the code. As I have downloaded all of the files but I keep getting errors. If it is possible for you to email me the full code so that I can enter it into the arduino without having to make any changes to it.
    I am new at this. I have successfully made the pong clock and a binary clock from the instructables site. But I find it very hard with my disabilities to compile the codes for projects like this. Too many errors come up when entering codes.
    I would be very grateful If you could help me. I see that you have many projects to make on the internet. I will try to build most of these in time.
    So I am sorry to say that this will not be the last you hear from me. Ha ha.
    Thanking you kindly for your time.
    Kindest regards.

  4. Stroke February 16, 2016 at 9:03 am - Reply


    Very interesting project. I have interfaced the RTC however its giving me time as:
    4 October 2014

    And clock stars every time as:

    Kindly guide me how to fix this.

    • Nick February 16, 2016 at 6:44 pm - Reply

      You have to set the current date and time. Watch the video carefully in order to see how to do it.

  5. Steve Tripoli March 17, 2016 at 9:48 pm - Reply

    Hello Stroke, I was able to reformat the date.
    New formated line… dateString = dateString+String(now.month())+”/”+String(;
    Original line ………….dateString = dateString+String(”/”+String(now.month());
    But I can’t get it out of 24hr time, any help…

  6. Steve Tripoli March 17, 2016 at 10:38 pm - Reply

    Well I finally got the clock to display 12hr time. Here is what I added to Educ8s code.

    switch (hours.toInt())
    case 13:hours=1;break;
    case 14:hours=2;break;
    case 15:hours=3;break;
    case 16:hours=4;break;
    case 17:hours=5;break;
    case 18:hours=6;break;
    case 19:hours=7;break;
    case 20:hours=8;break;
    case 21:hours=9;break;
    case 22:hours=10;break;
    case 23:hours=11;break;
    case 24:hours=12;break;
    hours = String(hours);
    Also I changed the format of the date to
    dateString = dateString+String(now.month())+”/”+String(;

    I hope this helps someone.

    • vikas goyal December 3, 2016 at 5:20 pm - Reply

      exit status 1
      ‘hours’ was not declared in this scope

      this error is occurring

  7. sidnei July 4, 2016 at 8:41 pm - Reply

    hello, love watching your videos, already much learned, I set some of his projects, the latter was that the RTC, but he lags mine, in two days it ta 5 late seconds jo rode several other RTC, other codes but all delays, tems an opinion.

  8. Robert October 1, 2016 at 12:45 pm - Reply

    Greetings …I’m new to Arduino
    I am unable to import your code into the Arduino Library correctly …it will not compile properly …any suggestion …I would like to try some of your very interesting projects I’ve tried to run both …Ds 3231 with ST7735 160 x 120 ….also the LCD Keypad Shield….not having any luck!!!!
    I think I’m have a problem getting the code into the Arduous library ….I can get the Lcd’s and TFT to run a test pattern everything is connected correctly …I can’t seem to get the clock to work….The clock is set with the correct time….I can see it in the serial monitor….

    if you have time…. any direction would be appreciated….

  9. rene October 9, 2016 at 6:30 pm - Reply

    please if anyone knows how to modify and explain in a video leave the link and leave here I have difficulty in compiling the libraries code sodaq not he came out with ne nowhere to load them and even go, agradeceria detailed yuda as and modify step by step to understand how this works, thanks in advance.
    my email:

  10. bill October 12, 2016 at 9:21 pm - Reply

    you never say where the lib files are.
    like = #include “Sodaq_DS3231.h”

  11. gesto November 25, 2016 at 3:52 pm - Reply

    Can you build this very interesting project using another – perhaps bigger -screen ? This screen is out of stock .

  12. Daniel March 22, 2017 at 4:58 am - Reply

    Hello sir, I enjoy your video, they are good and instructive. I am always wandering how I could do a finish project. I can not put a pc, an Arduino Uno, a breadboard, a ds3231 wiht all the cables in a box. Then you are asking for a box. Well, you certainly solved that problem by now. I am wondering, how do you transpose all that breadboard and dss3231 into one integrated board on which I presume i would need to solder the lcd. If you could lighten my way, I would appreciate. Thank you.

  13. Ryan March 22, 2017 at 9:26 pm - Reply

    Arduino: 1.8.1 (Windows 10), Board: “Arduino/Genuino Uno”

    C:\Users\Hidden Name\Documents\Arduino\RTC_TFT_Display\RTC_TFT_Display.ino:4:26: fatal error: Sodaq_DS3231.h: No such file or directory

    #include “Sodaq_DS3231.h”


    compilation terminated.

    Multiple libraries were found for “Adafruit_GFX.h”
    Used: C:\Users\Hidden Name\Documents\Arduino\libraries\Adafruit_GFX
    Not used: C:\Users\Hidden Name\Documents\Arduino\libraries\arduino_376175
    Multiple libraries were found for “Adafruit_ST7735.h”
    Used: C:\Users\Hidden Name \Documents\Arduino\libraries\Adafruit-ST7735
    Not used: C:\Users\Hidden Name\Desktop\Arduino Folder\libraries\Adafruit-ST7735
    Not used: C:\Users\Hidden Name\Desktop\Arduino Folder\libraries\Adafruit-ST7735
    Not used: C:\Users\Hidden Name\Desktop\Arduino Folder\libraries\Adafruit-ST7735
    Not used: C:\Users\Hidden Name\Desktop\Arduino Folder\libraries\Adafruit-ST7735
    exit status 1
    Error compiling for board Arduino/Genuino Uno.

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

  14. Daniel April 15, 2017 at 8:20 pm - Reply

    Hi i love your videos and I learn a lot from them… i Just building small project for my aquarium. Using Arduino nano ds3231 1 5v relay 20.4 lcd and 2 float switch to control ATO and display time and date position of float switches and 12v water pump but i stack with the code how to usuing ds3231 control led light to switch on at 21 and turn off at 7am.. i got pwm led driver but i dont know how to set time to control led… any help please…
    Cant wait to see more videos about Nextion lcd display. Thanks

  15. Aldrin December 27, 2017 at 7:09 am - Reply

    Thanks very much. First time to finish a working project. Next up, ESP32 with Nextion display 🙂

  16. Ray February 13, 2018 at 10:47 am - Reply

    hi i cant download the code…


  17. gregor36 February 17, 2018 at 11:46 pm - Reply

    how to adjust the temperaturę
    displays 0
    and should display -1

Leave A Comment