Digital Clock Using TM1637 Display and RTC PCF8563 (2024)

evive Arduino IDE Tutorials

  1. Getting Started with evive
  2. evive – Plug and Play: Part 1
  3. evive – Plug and Play Part 2
  4. Getting Started with Arduino IDE
  5. Arduino Sketch: Structure and Flow
  6. Arduino IDE: Variables
  7. Arduino IDE: Arithmetic Operators
  8. Arduino IDE: Comparison or Relational Operator
  9. Arduino IDE: Boolean or Logical Operators
  10. Arduino IDE: Conditional (if-else-if) Statements
  11. Arduino IDE: for Loop
  12. Arduino IDE: while Loop
  13. How to Install evive Library in Arduino IDE
  14. Getting Started with TFT Display
  15. Print Variables on evive TFT Display Line by Line
  16. How to Manipulate Text on evive TFT Display | Arduino IDE
  17. How to Draw Shapes on TFT Display
  18. Digital I/O Pins and LEDs in evive
  19. Digital Input Tutorial on evive with Arduino IDE
  20. How to use a Tactile Switch with evive
  21. How to use evive’s Slide Switch | Arduino IDE
  22. evive’s Analog Input Pins to Read Data | Arduino IDE
  23. How to configure the HC05 Bluetooth Module using AT Commands
  24. How to generate Analog Output at Digital Pins using PWM
  25. Using the 5-Way Navigation Key on evive | Arduino IDE
  26. Servo Motor with evive | Arduino IDE
  27. Working with Touch Sensors in Arduino IDE with evive
  28. Working with the Real Time Clock (RTC) on evive | Arduino IDE
  29. Using a Digital Capacitive Touch Sensor with evive
  30. Interrupts In evive: Explained with Example
  31. Hex Keyboard Interfacing with evive
  32. HC-SR04 Ultrasonic Sensor Tutorial with evive | Arduino IDE
  33. Light Sensor (LDR) with evive | Arduino IDE
  34. Introduction to Using a Key Switch Module KY-004 with evive
  35. Intrface Raindrop Sensor with evive | Arduino IDE
  36. Interfacing the KY-011 2-Color LED Module with evive
  37. Interfacing KY-009 RGB Module with evive
  38. Driving a Unipolar Stepper Motor with Arduino and evive
  39. How to Interface the GY-521 Module with evive
  40. Digital Clock Using TM1637 Display and RTC PCF8563
  41. Working with the KY-003 Hall Magnetic Sensor using evive
  42. Interfacing LM-35 Temperature Sensor with evive
  43. Controlling a Water Pump with evive

Digital Clock Using TM1637 Display and RTC PCF8563 (1)

Description

Learn how to create a digital clock using the TM1637 4-digit display and the RTC PCF8563 real-time clock module.

  • Software Used: Arduino IDE
  • Difficulty Level: Beginners
  • Category: evive Arduino IDE, Tutorial

Introduction

In this tutorial, we will be making a digital clock using the “TM1637” 4-digit display and the “RTC PCF8563” real-time clock module. First, we will get “Hour” and “Minute” from real-time clock module and then we will use these hours and minutes to display timing on TM1637 4-digital display.

TM1637 4-digit Display

TM1637 is used to drive seven segments display, there are many modules available that countain TM1637 chip to form a 4-digit numerical display module.

Features

  • Use either the raw segment value or decimal number
  • Set either the whole display or any digit independently
  • Control the brightness
  • Pure software implementation

Pin Description

TM1637 4-digit display has 4 pins

  • VCC
  • GND
  • CLK (clock pin for I2C communication )
  • DIO ( Data Input output pin )

Circuit Diagram

  • Connect ‘VCC’ of ‘TM1637’ module to ‘VCC’ of evive
  • Connect ‘GND’ of ‘TM1637’ module to ‘GND’ of evive
  • Connect ‘CLK’ of ‘TM1637’ module to pin number 2 ofevive( Yellow wire in circuit diagram given below)
  • Connect ‘DIO’ of ‘TM1637’ modue to pin number 3 of evive(White wire in circuit diagram given below)

Steps for Setting Time

  • First connect evive to the computer ( using USB A -B cable ), then upload the code which is given below.
  • Then move slid switch-1 to the “UP” position and use Potentiometer-1 and Potentiometer-2 to set the Hour and minute as shown above.
  • Potentiometer-1 and Potentiometer-2 are connected internally to analog pins A9 and A10 of evive respectively, they will give digital readings (from 0 to 1023), and we will use the map function to convert them (from 0 to 59 and 0 to 12) for minutes and hour.
  • After setting the time using potentiometer-1 and potentiometer-2, move slid switch-1 to the “Down” position, this will start to display timing on the TM1637 4-digit display module.

Arduino Code

/* * evive * this tutorial demonstarte digital clock using TM1637 display and RTC PCF8563 * * 25 may 2018 * by punit chotaliya */#include <Wire.h> #include <Rtc_Pcf8563.h>#include <TM1637Display.h>#define CLK 2 // connect ClK to pin number 2#define DIO 3 // connect DIO to pin number 3//initialized the real time clockRtc_Pcf8563 rtc;TM1637Display display(CLK, DIO); // creating object named as display int time_set_sw = 40; // when slid switch-1 is in "up" position it is connected to pin number 40 int hour_val = 0, minute_val = 0; // declaring variable for storing hour and minute valueint hour_pot = A9; //Potentiometer-1 is connected to A9int minute_pot = A10; //Potentiometer-2 is connected to A10uint8_t clear_segment[] = { // declaring array for clearing 0x00, 0x00, 0x00, 0x00 }; //display void Set_Time() //This function is used to set time with help of slide switch and potentiometers.{ set_Brightness(40); // this functon set brightness while (digitalRead(time_set_sw)) // while slid switch is in "up" position execute while loop { hour_val = map(analogRead(hour_pot), 0, 1023, 0, 23); // to map analog values read to hours minute_val = map(analogRead(minute_pot), 0, 1023, 0, 59); // to map analog values read to minutes display.showNumberDecEx((hour_val * 100) + minute_val, 0x80 >> 1, 1, 4, 0); // dispaying value of hour and minutes on display /*Serial.print(hour_val); Serial.print(":"); Serial.println(minute_val);*/ } rtc.setTime(hour_val, minute_val, 0); //Blinks Time once it is set through above steps. clearSegment(); delay(50); display.showNumberDecEx((hour_val * 100) + minute_val, 0x80 >> 1, 1, 4, 0); // delay(50); clearSegment(); delay(50); display.showNumberDecEx((hour_val * 100) + minute_val, 0x80 >> 1, 1, 4, 0);}void clearSegment() //To clear all segments of display{ display.setSegments(clear_segment);}void set_Brightness(int value) // Enter any value from 0-100 for varying brigthness of display from 0% to 100%{ display.setBrightness(map(value, 0, 100, 0, 7));}void setup(){ //Serial.begin(9600); clearSegment();}void loop(){ if (digitalRead(time_set_sw)) { Set_Time(); } rtc.getTime(); set_Brightness(80); // In order to use ":" on display we need atleast a 3 digit number to be passed in argument of function below. // For that hour and minutes value obtained from RTC are stored in a number which can be either 3 or 4 digit. The number is made such that MSB digits have hour value and //Lsb digits have minute values. display.showNumberDecEx((rtc.getHour() * 100) + rtc.getMinute(), 0x80 >> 1, 1, 4, 0);}

Libraries Used in the Code

  • rtc_pcf8563 library (click here to download)
  • TM1637 library (click here to download)

Expected Result

Conclusion

This tutorial demonstrated how to make a digital clock using the “TM1637” 4-digit display and the “RTC PCF8563” real-time clock module. We connected the TM1637 4-digit display to the evive and used the potentiometers and slide switch to set the hour and minute. We then used the map function to convert the analog readings from potentiometers to digital values and uploaded the Arduino code to display the time on the 4-digit display. The libraries used in the code were the rtc_pcf8563 and TM1637 libraries. By the end of this tutorial, we had a working digital clock.

Table of Contents

Company

  • About Us
  • Blog
  • Partners and Distributors
  • Terms and Conditions
  • Privacy Policy
  • Careers

Community

Products

  • Quarky Addon Kits
  • evive - STEM Kit
  • PictoBlox Software
  • Dabble App

School Programs

  • Atal Tinkering Labs
  • STEM Innovation Lab

Impact Programs

Learning Resources

  • Education Center

Product Documentation

  • Quarky Kits
  • evive Kits
  • PictoBlox Software
  • Dabble App
  • Arduino with PictoBlox

Get in Touch

  • Contact Us
  • Book a Demo
  • Request a Quote

Follow Us

Digital Clock Using TM1637 Display and RTC PCF8563 (6)

Digital Clock Using TM1637 Display and RTC PCF8563 (7)

Dabble App - One App. Infinite Control.

Digital Clock Using TM1637 Display and RTC PCF8563 (10)

Digital Clock Using TM1637 Display and RTC PCF8563 (11)

Copyright 2024 – Agilo Research Pvt. Ltd. All rights reserved – |Privacy Policy

Digital Clock Using TM1637 Display and RTC PCF8563 (2024)

FAQs

What is a 4 digit 7 segment display digital clock? ›

Introduction: 4 Digit Seven Segment Display Digital Clock

This circuit displays time and raises the time by 1 minute every 60 seconds using a coded timer. The circuit utilizes a pushbutton that raises the time by 1 each press to allow the user to set the time to the real time.

How to use TM1637 with Arduino? ›

Connecting the TM1637 to an Arduino is very easy. There are only four wires to connect: two for power and two for controlling the display. Begin by connecting the VCC pin to the Arduino's 5V output and the GND pin to ground. Connect the CLK and DIO pins to the Arduino's digital pins 3 and 4, respectively.

How many times does a digital clock show the same digits? ›

How many times a day does a digital clock have all four digits the same? For both 12 and 24 hour clocks,that will happen 3 times a day: 12 hour: 00:00, 11:11 AM, 11:11 PM; 24 hour: 00:00, 11:11, 22:22.

What are the digits on a digital clock? ›

A digital clock uses two digits to display hours, two digits to display minutes and two digits to display seconds, e.g. 10:23:42.

How do I get a 7-segment display? ›

To produce a display, wire the COM terminal to logic 1 or a high signal and wire the individual segments to logic 0 or ground. The following is an example of displaying 1 using the CA model. In the CC model, the COM terminal combines all the cathode connections of the segments.

How does a 7-segment display work? ›

The displays consist of 7 separate segments, hence the name. Each of the segments have two different states; on and off. Different combinations of 'turned on' segments are going to result in different numbers and letters.

How to make a digital clock using Arduino and LCD? ›

16x2 LCD is connected with arduino in 4-bit mode. Control pin RS, RW and En are directly connected to arduino pin 2, GND and 3. And data pin D0-D7 is connected to 4, 5, 6, 7 of arduino. A buzzer is connected with arduino pin number 13 through a NPN BC547 transistor having a 1 k resistor at its base.

Can Arduino output a clock signal? ›

You can use one of the PWM pins on Arduino to output a PWM signal. If you want a constant clock, you need to set the duty cycle of the PWM to be 0.5, i.e. 50%.

How Arduino convert analog-to-digital? ›

The Arduino has a built-in analog-to-digital converter (ADC) that measures the value of analog signals. The ADC converts the analog voltage into a digital value.

How does TM1637 work? ›

How the TM1637 Module Works. In this module, you can only establish communication with two pins, including the DIO and CLK pins. Plus, you can send or receive data on this module from these two pins. Hence, you will send the numbers you want to display on the TM1637 interface in a serial data form.

What is the price of TM1637? ›

Quantity: Price: Rs. 26.00/- Buy Now!

What is TM1637 module? ›

The TM1637 4 Bits Digital Tube LED Display Module is an affordable solution for displaying the output data of your Arduino project. Though the data displayed is restricted by numbers still it allows users to display some characters too like A, B, C etc.

What is 7-segment digital numbers? ›

A 7-segment display is a visual indicator used to display numerical digits and some characters. It consists of seven LED segments arranged in a specific pattern, with each segment representing one of the digits from 0 to 9.

What is a 7-segment display device? ›

A seven-segment display is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix displays. Seven-segment displays are widely used in digital clocks, electronic meters, basic calculators, and other electronic devices that display numerical information.

What is the digital clock display? ›

Display. The display of a digital clock shows the time that has been calculated by its other parts. Digital clock displays use either Light Emitting Diodes (LED) or Liquid Crystal Display (LCD) to light up the numerals on the display.

Top Articles
Latest Posts
Article information

Author: Tuan Roob DDS

Last Updated:

Views: 5849

Rating: 4.1 / 5 (42 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Tuan Roob DDS

Birthday: 1999-11-20

Address: Suite 592 642 Pfannerstill Island, South Keila, LA 74970-3076

Phone: +9617721773649

Job: Marketing Producer

Hobby: Skydiving, Flag Football, Knitting, Running, Lego building, Hunting, Juggling

Introduction: My name is Tuan Roob DDS, I am a friendly, good, energetic, faithful, fantastic, gentle, enchanting person who loves writing and wants to share my knowledge and understanding with you.