TM1638 8-Digit Display + Button Module

One chip drives eight seven-segment digits, eight LEDs, and reads eight push-buttons — a complete user interface over three wires.

Difficulty: Breadboard. Estimated build time: about 35 minutes. Estimated parts cost: about US$7.00. 4-line bill of materials. Compare supplier offers when available. A complete pocket user interface in a single Titan Micro TM1638 "LED & KEY" module.

Wire the module

The LED & KEY module has five pins on its header: VCC, GND, STB, CLK, DIO. Connect VCC to 5 V, GND to GND, and STB/CLK/DIO to any three digital pins — D7, D8, D9 on the UNO is a common choice. The module includes pull-ups, decoupling caps, and current-limit resistors for the segments and LEDs, so no external components are needed.

Install the TM1638 library

In the Library Manager search for "TM1638" by Ricardo Batista (or use the maintained fork "TM1638plus" by Gavin Lyons). Install. Open the basic example, set the pins to match your wiring, and upload. The library exposes setDisplayToString("HELLO"), setLED(n, true), and getButtons() — high-level calls that hide every detail of the multiplexed protocol.

Build a stopwatch

Use millis() to compute elapsed time. Convert it to MM:SS.s and pass that string to setDisplayToString. Read getButtons() each loop; if button 1 is pressed, start or stop the timer; if button 8 is pressed, reset to zero. With under a hundred lines of code you have a stopwatch with a far nicer interface than most desktop ones.

Light the LED bar in time with the counter

The eight discrete LEDs above the digits are independent of the segments. Use them as a tens-of-seconds bar (light LED n when the seconds reach 10·n) or as a status indicator (e.g. red LED 8 lights when the timer is running). The TM1638 can drive the LEDs at multiple brightness levels via setupDisplay(brightness); start with brightness 7 for normal use, drop to 1 for night mode.