0

Digital Countdown Timer with Arduino and a TM1637 Display

Build a digital countdown timer with Arduino and a TM1637 4-digit display. Wiring diagram, code and extension ideas.

Build a neat digital countdown timer on a bright 4-digit display. It uses the TM1637 module, which needs just two data wires, making it one of the easiest displays to drive. Great for a kitchen timer, a game buzzer, or learning how 7-segment displays work.

Below: the wiring diagram, the Arduino code, and ideas to extend it. All parts are in stock at Arduino Corner.

What you’ll need

That’s it — the TM1637 needs only four wires. New here? Start with the Arduino Uno Starter Kit.

Wiring diagram

Wiring diagram showing a TM1637 four-digit display connected to an Arduino Uno with four wires
The TM1637 needs only four wires — two power, two data.

The same connections as a quick reference table:

From (module)To (Arduino Uno)
TM1637 — CLKD3
TM1637 — DIOD2
TM1637 — VCC5V
TM1637 — GNDGND

Tip: CLK and DIO are just two ordinary digital pins — you can move them, as long as they match the #define lines in the code.

How it works

A 7-segment display makes numbers by lighting bars in a figure-8 pattern. Driving four digits directly would need many pins, so the TM1637 has its own little chip that handles all of them over a simple two-wire link: CLK (clock) and DIO (data). The library does the hard part — you just tell it what number to show.

The Arduino code

Install the “TM1637” library by Avishorp from Manage Libraries.

#include <TM1637Display.h>

#define CLK 3
#define DIO 2
TM1637Display display(CLK, DIO);

int seconds = 60;   // countdown start value

void setup() {
  display.setBrightness(5);
}

void loop() {
  int minutes = seconds / 60;
  int secs = seconds % 60;
  int shown = minutes * 100 + secs;   // show as MM:SS

  display.showNumberDecEx(shown, 0b01000000, true);   // colon on

  if (seconds > 0) {
    seconds--;
  }
  delay(1000);   // tick once per second
}

Understanding the code

We store the remaining seconds and, each second, split it into minutes and seconds to show as MM:SS. showNumberDecEx() with 0b01000000 turns on the middle colon. The delay(1000) is one tick; when seconds reaches zero the countdown stops.

Troubleshooting

  • Display stays blank: check VCC/GND and that CLK/DIO match the #define pins — it’s easy to swap them.
  • Garbled digits: usually CLK and DIO are reversed. Swap the two data wires.
  • Too dim or too bright: change the setBrightness(0–7) value.

Take it further

  • Add a push-button to start, pause and reset the timer.
  • Turn it into a stopwatch that counts up instead of down.
  • Trigger a buzzer when it reaches zero.

Frequently asked questions

Why only two wires for four digits?

The TM1637’s onboard chip drives all the segments for you and talks to the Arduino over a simple two-wire (CLK + DIO) link, saving lots of pins.

Can it show a colon for a clock?

Yes — the middle colon is controlled by a bit in showNumberDecEx(), so the same display works as a digital clock.

How do I make it start from a different time?

Change the seconds value at the top — for example 300 for a five-minute timer.

Related project guides

Get the parts

Everything for this build is in stock at Smart Home | Arduino Corner — Shaheen Market, DAV College Road, Rawalpindi — and ships across Pakistan with cash on delivery. Grab the TM1637 4-digit display and a set of jumper wires. Message us on WhatsApp and we’ll put the whole kit together for you.

Leave a Reply

Your email address will not be published. Required fields are marked *

Chat with us on WhatsApp