Arduino clock with DS3231 and ST7735 color display

In the last Arduino project I built a simple real time clock using DS1307 RTC and ST7735 TFT display (link is below) and in this project I’m going to show how to build a real time clock with RTC chip temperature monitor using Arduino, DS3231 RTC and the same display (ST7735 TFT).
The ST7735 TFT is a color display which has a resolution of 128×160 pixel and it communicates with the master device using SPI (Serial Peripheral Interface) protocol.

The DS3231 is more accurate than the DS1307 due to its built-in temperature sensor. It also (the DS3231) keeps time running even if the main power source is down (with the help of 3V battery). It also uses I2C interface to communicate with the master device which is in this case the Arduino.

To see how to interface Arduino with ST7735 TFT display, visit the following post:
Arduino ST7735 1.8″ TFT display example

To see how to interface Arduino with DS1307 RTC and ST7735 color TFT display, take a look at this post:
Arduino Real time clock with ST7735 color TFT and DS1307

Hardware Required:

  • Arduino board
  • ST7735S (ST7735R) TFT screen
  • DS3231 module   —->  DS3231 datasheet
  • 5 x 1k ohm resistor
  • 2 x push button
  • 3V coin cell battery
  • Breadboard
  • Jumper wires

Arduino with ST7735S TFT display and DS3231 RTC module

Arduino clock with ST7735 display and DS3231 RTC circuit:
The image below shows project circuit schematic diagram.

The ST7735S shown in project circuit diagram has 8 pins: (from right to left): RST (reset), CE (chip enable), DC (or D/C: data/command), DIN (data in), CLK (clock), VCC (5V or 3.3V), BL (back light) and Gnd (ground).

Arduino DS3231 ST7735 color TFT circuit

Normally the ST7735 display works with 3.3V only, but many boards of this display have a built-in 3.3V regulator (AMS1117 3V3) like the one shown in the circuit diagram. This regulator supplies the display controller with 3.3V from 5V source.

All Arduino UNO board output pins are 5V, connecting a 5V pin directly to the ST7735 display board may damage its controller circuit. To avoid that, I connected each control line of the display to the Arduino board through 1k ohm resistor.

So, the ST7735 display is connected to the Arduino board as follows (each one through 1k resistor):
RST pin is connected to Arduino digital pin 8,
CS pin is connected to Arduino digital pin 9,
D/C pin is connected to Arduino digital pin 10,
DIN pin is connected to Arduino digital pin 11,
CLK pin is connected to Arduino digital pin 13.

The DS3231 RTC module SDA (serial data) and SCL (serial clock) pins are respectively connected to Arduino A4 and A5 pins (ATmega328P hardware I2C module pins).

The two push buttons which are connected to Arduino digital pins 6 and 7 are for setting time & date of the clock.

Arduino clock with ST7735 display and DS3231 RTC code:
The following Arduino code requires 3 libraries from Adafruit Industries:
Adafruit ST7735 display library
Adafruit graphics library             —->  direct link
Adafruit RTC library                   —->  direct link

After the download, go to Arduino IDE —> Sketch —> Include Library —> Add .ZIP Library … and browse for the .zip file (previously downloaded).
The same thing for the other library files.

So, in the code there are total of 4 libraries, they’re included as follows:

The ST7735 TFT display is connected to Arduino hardware SPI module pins (clock and data), the other pins which are: RST (reset), CS (chip select) and DC (data/command) are defined as shown below:

And the two push buttons are defined in the code as:

Functions used in the code:
bool debounce (): this function is for button B1 debounce, returns 1 if button is debounced.

void RTC_display(): displays day of the week, date and time on the display.

byte edit(byte parameter): this function is for setting the real time clock, returns the edited parameter.

Rest of code is described through comments.

Full Arduino code:

The following video shows my protoboard circuit:


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

3 thoughts on “Arduino clock with DS3231 and ST7735 color display”

  1. Hi, I built your project and it works very well.
    Now I wish I could rotate the screen horizontally.
    Could you give me some instructions on how to do it?
    Thank you.

  2. Hi again
    Fixed the problem
    It must have been a power issue

    I connected the UNO to an external power supply and the display works perfectly.
    Thanks for the great project

  3. Hi
    I built this project following all of the instructions.
    It works brilliantly!! So its a big thumbs up and well done.
    I only have one issue is that the display on the day and the date seems to flash like its throbbing.
    Have i done something wrong?

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