Projects / 4-digit clock

4-digit clock

Beginner40 minGuided buildReviewed
Arduino Uno5VD2D3GND10:14TM1637 display
Time 10:14

Tap a part to see what it does.

Tap the parts to see what each one does. A teaching simulation, not a circuit simulator.

Build it step by step

0 of 4 done
  1. UNO

    Place the display

    Plug the 4-pin header into four separate rows.

  2. UNO

    Power it

    VCC to 5V, GND to GND.

  3. UNO

    Connect CLK and DIO

    CLK to D2, DIO to D3.

  4. UNO

    Set the time and upload

    Change hh and mm in the code to the current time, then upload.

In short

How do you build a 4-digit clock?

A TM1637 display shows hours and minutes with a blinking colon, counted by the Uno. You need Arduino Uno R3, TM1637 4-digit display and Breadboard 830 Tie Points. It takes 4 steps and about 40 minutes.

Level
Beginner
Time
About 40 min
Parts
3

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
TM1637 VCCUno 5VPower
TM1637 GNDUno GNDGround
TM1637 CLKUno D2Clock
TM1637 DIOUno D3Data

Code

Arduino IDE. Install the "TM1637" library by Avishay Orpaz. Without a real-time clock module the time resets when power is lost and drifts a few seconds a day; add a DS3231 later.

Runs on a virtual Arduino Uno in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <TM1637Display.h>

TM1637Display disp(2, 3);  // CLK, DIO
int hh = 9, mm = 30;          // set the start time here
unsigned long last = 0;
bool colon = true;
int secs = 0;

void setup() {
  disp.setBrightness(4);
}

void loop() {
  if (millis() - last >= 500) {
    last += 500;
    colon = !colon;
    if (colon && ++secs >= 60) { secs = 0; if (++mm >= 60) { mm = 0; hh = (hh + 1) % 24; } }
    disp.showNumberDecEx(hh * 100 + mm, colon ? 0b01000000 : 0, true);
  }
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
After uploadShows your start time, colon blinks once a second
After 1 minuteMinutes go up by one
BrightnesssetBrightness(0 to 7) changes it

If it does not work

Display blank

Check CLK and DIO are not swapped and the pin numbers match the code.

Shows 8888 or random segments

Loose header: press the module firmly into the breadboard.

Time wrong after unplugging

Expected: the Uno has no clock battery. Add a DS3231 RTC.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the 4-digit clock?

Arduino Uno R3, TM1637 4-digit display and Breadboard 830 Tie Points.

How long does the 4-digit clock take to build?

About 40 minutes for a beginner maker, in 4 steps.

How do I know the 4-digit clock works?

After upload: Shows your start time, colon blinks once a second. After 1 minute: Minutes go up by one. Brightness: setBrightness(0 to 7) changes it.

Display blank: what should I check?

Check CLK and DIO are not swapped and the pin numbers match the code.

Shows 8888 or random segments: what should I check?

Loose header: press the module firmly into the breadboard.

Time wrong after unplugging: what should I check?

Expected: the Uno has no clock battery. Add a DS3231 RTC.