Build it step by step
0 of 7 doneWire the display
CLK to D2, DIO to D3, with 5V and GND.
Add the buttons
Plus on D4, minus on D5, start/pause on D6, each to ground.
Add the buzzer
Buzzer between D8 and ground.
Upload and set the time
Press plus or minus to change the time in 5 minute steps.
Start
Press start. The display counts down every second.
Check the alerts
Use a short time such as 11 minutes and wait for the three beeps at 10 minutes and the flash at zero.
Pause and resume
Press start again to pause and resume.
How do you build an exam countdown timer?
A big 4-digit display counts down exam time and beeps at 10 minutes and at the end. You need Arduino Nano, TM1637 4-digit display, Tactile push button 6 mm × 3, Active buzzer 5 V, Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm) and USB A to micro-USB cable (data). It takes 7 steps and about 45 minutes.
- Level
- Beginner
- Time
- About 45 min
- Parts
- 7
Wiring
| From | To | Why |
|---|---|---|
| TM1637 CLK and DIO | Nano D2 and D3 | Display |
| TM1637 VCC and GND | Nano 5V and GND | Supply |
| Plus button | Nano D4 and GND | Add 5 minutes |
| Minus button | Nano D5 and GND | Subtract 5 minutes |
| Start/pause button | Nano D6 and GND | Run or pause |
| Buzzer + and - | Nano D8 and GND | Alerts |
Code
Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). Install "TM1637" by Avishay Orpaz. The count uses millis() and adds exactly 1000 ms each second so it does not drift. A Nano's crystal is accurate to a few seconds a day, which is plenty for a three hour exam.
Runs on a virtual Arduino Nano 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 display(2, 3);
const byte PLUS = 4, MINUS = 5, RUN = 6, BUZZ = 8;
long secsLeft = 60L * 60L; // default one hour
bool running = false, warned = false;
unsigned long lastTick = 0;
void show() {
int m = secsLeft / 60, s = secsLeft % 60;
display.showNumberDecEx(m * 100 + s, 0b01000000, true); // mm:ss
}
void beeps(byte n) { for (byte i = 0; i < n; i++) { digitalWrite(BUZZ, HIGH); delay(150); digitalWrite(BUZZ, LOW); delay(150); } }
void setup() {
pinMode(PLUS, INPUT_PULLUP); pinMode(MINUS, INPUT_PULLUP); pinMode(RUN, INPUT_PULLUP);
pinMode(BUZZ, OUTPUT);
display.setBrightness(7);
show();
}
void loop() {
if (!running) {
if (digitalRead(PLUS) == LOW) { secsLeft = min(secsLeft + 300, 99L * 60); show(); delay(250); }
if (digitalRead(MINUS) == LOW) { secsLeft = max(secsLeft - 300, 0L); show(); delay(250); }
}
if (digitalRead(RUN) == LOW) {
running = !running; lastTick = millis(); delay(300);
}
if (running && millis() - lastTick >= 1000) {
lastTick += 1000;
if (secsLeft > 0) secsLeft--;
show();
if (secsLeft == 600 && !warned) { beeps(3); warned = true; } // ten minutes left
if (secsLeft == 0) {
for (byte i = 0; i < 10; i++) { display.setBrightness(7, i % 2 == 0); display.showNumberDecEx(0, 0b01000000, true); beeps(1); }
display.setBrightness(7, true);
running = false;
}
}
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Set 90 minutes | Display shows 90:00 |
| Running | Counts down one second per second |
| At 10 minutes left | Three beeps once |
| At zero | Flashes and beeps |
If it does not work
Time runs fast or slow
Do not use delay() long in the loop. Keep the main loop free.
Buttons ignored
The wiring is on the wrong pins or the buttons are bouncing. Check D4 to D6.
Display blank
CLK and DIO may be swapped.
Wrong digits
Use showNumberDecEx with the colon mask as in the code.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the exam countdown timer?
Arduino Nano, TM1637 4-digit display, Tactile push button 6 mm × 3, Active buzzer 5 V, Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm) and USB A to micro-USB cable (data).
How long does the exam countdown timer take to build?
About 45 minutes for a beginner maker, in 7 steps.
How do I know the exam countdown timer works?
Set 90 minutes: Display shows 90:00. Running: Counts down one second per second. At 10 minutes left: Three beeps once.
Time runs fast or slow: what should I check?
Do not use delay() long in the loop. Keep the main loop free.
Buttons ignored: what should I check?
The wiring is on the wrong pins or the buttons are bouncing. Check D4 to D6.
Display blank: what should I check?
CLK and DIO may be swapped.
Wrong digits: what should I check?
Use showNumberDecEx with the colon mask as in the code.
