Arduino UNO R4 - TM1637 4-Digit 7-Segment Display

The Arduino Uno R4 - available as Minima and WiFi - brings more processing power, additional memory, and a 14-bit ADC while keeping the classic Uno header layout. The TM1637 display module connects to any two digital pins and works at both 3.3V and 5V, so it pairs with the Uno R4 without any level-shifting.

In this guide you will:

Arduino Uno R4 TM1637 4-Digit 7-Segment Display

TM1637 4-Digit 7-Segment Display Overview

The TM1637 module drives a 4-digit 7-segment LED display using just two signal wires (CLK and DIO). It handles the LED multiplexing internally and stores the display data in its own memory, which means the display stays lit without any continuous updates from the microcontroller.

Highlights:

  • 4 digits with 7 segments each, plus decimal points
  • Colon LED between digit 1 and digit 2 for clock-style display
  • 8 adjustable brightness levels
  • 2-wire serial interface
  • Works with 3.3V or 5V logic
Function Pin
CLK Clock signal input
DIO Data input/output
VCC Power supply (3.3V or 5V)
GND Ground

Any two digital pins on the Uno R4 can serve as CLK and DIO.

Wiring Diagram

Hook up the TM1637 to your Arduino Uno R4:

  • CLK to pin 9
  • DIO to pin 10
  • VCC to 5V
  • GND to GND
The wiring diagram between Arduino Uno R4 TM1637 4-Digit 7-Segment Display

This image is created using Fritzing. Click to enlarge image

See The best way to supply power to the Arduino Uno R4 and other components.

How to Install the Library

  1. Plug the Arduino Uno R4 into your computer using a USB Type-C cable.
  2. In the Arduino IDE, verify that the correct board (Arduino Uno R4 Minima or WiFi) and serial port are selected.
  3. Click the Libraries icon in the left sidebar.
  4. Type "DIYables_4Digit7Segment_TM1637" into the search box and locate the library published by DIYables.
  5. Hit Install to add the library to your IDE.
Arduino TM1637 4-Digit 7-Segment Display library

No additional dependencies are needed - the library is entirely self-contained.

Minimal Sketch Structure

All sketches using the DIYables_4Digit7Segment_TM1637 library share this skeleton:

#include <DIYables_4Digit7Segment_TM1637.h> #define CLK_PIN 9 #define DIO_PIN 10 DIYables_4Digit7Segment_TM1637 display(CLK_PIN, DIO_PIN); void setup() { display.begin(); display.print(1234); } void loop() { }

Construct the display object with pin numbers, call begin() once, and you are ready to write data to the display.

Showing Integer Values

Displays various integers on the 7-segment display, including zero-padded output.

/* * This Arduino UNO R4 code was developed by newbiely.com * * This Arduino UNO R4 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-r4/arduino-uno-r4-tm1637-4-digit-7-segment-display */ /* * DIYables_4Digit7Segment_TM1637 - Integer Example * * Displays various integer values on a 4-digit 7-segment display * with TM1637 driver, including zero-padded numbers. * * Tutorial: https://diyables.io/products/4-digit-7-segment-display-led-tm1637-with-colon * * TESTED HARDWARE: * - Arduino Uno R3 * - Arduino Uno R4 WiFi * - Arduino Uno R4 Minima * - Arduino Mega * - Arduino Due * - Arduino Giga * - DIYables STEM V3: https://diyables.io/stem-v3 * - DIYables STEM V4 IoT: https://diyables.io/stem-v4-iot * - DIYables STEM V4B IoT: https://diyables.io/stem-v4b-iot * - DIYables STEM V4B Edu: https://diyables.io/stem-v4-edu * - DIYables MEGA2560 R3: https://diyables.io/atmega2560-board * - DIYables Nano R3: https://diyables.io/nano-board * - DIYables ESP32 Board: https://diyables.io/esp32-board * - DIYables ESP32 S3, Uno-form factor: https://diyables.io/esp32-s3-uno * - It is expected to work with other boards */ #include <DIYables_4Digit7Segment_TM1637.h> // Pin configuration - change to match your wiring #define CLK_PIN 9 // The Arduino pin connected to the CLK pin of TM1637 4-digit 7-segment display #define DIO_PIN 10 // The Arduino pin connected to the DIO pin of TM1637 4-digit 7-segment display DIYables_4Digit7Segment_TM1637 display(CLK_PIN, DIO_PIN); void setup() { Serial.begin(9600); display.begin(); Serial.println("TM1637 Integer Example"); } void loop() { // Display various integers int numbers[] = {0, 42, 1234, -5, -123, 9999}; int count = sizeof(numbers) / sizeof(numbers[0]); for (int i = 0; i < count; i++) { display.print(numbers[i]); Serial.print("Displaying: "); Serial.println(numbers[i]); delay(2000); } // Display with zero padding display.print(42, true); // Shows "0042" Serial.println("Displaying: 0042 (zero-padded)"); delay(2000); }

How to Run

  • Connect the TM1637 module to the Arduino Uno R4 as described in the wiring diagram.
  • Plug in the USB Type-C cable.
  • Paste the code in Arduino IDE, choose the correct board and port, and press Upload.
  • Open the Serial Monitor to see the output.

Numbers cycle through 0, 42, 1234, -5, -123, 9999, followed by zero-padded "0042".

Method Quick Reference

Method What It Does Usage
print(int) Shows an integer (-999 to 9999) display.print(1234)
print(int, true) Shows with leading zeros display.print(42, true)
clear() Blanks the display display.clear()

Showing Text and Temperature

Displays text strings, the degree symbol, and formatted temperature.

/* * This Arduino UNO R4 code was developed by newbiely.com * * This Arduino UNO R4 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-r4/arduino-uno-r4-tm1637-4-digit-7-segment-display */ /* * DIYables_4Digit7Segment_TM1637 - TextAndDegree Example * * Displays text strings, special characters, and temperature * on a 4-digit 7-segment display with TM1637 driver. * * Tutorial: https://diyables.io/products/4-digit-7-segment-display-led-tm1637-with-colon * * TESTED HARDWARE: * - Arduino Uno R3 * - Arduino Uno R4 WiFi * - Arduino Uno R4 Minima * - Arduino Mega * - Arduino Due * - Arduino Giga * - DIYables STEM V3: https://diyables.io/stem-v3 * - DIYables STEM V4 IoT: https://diyables.io/stem-v4-iot * - DIYables STEM V4B IoT: https://diyables.io/stem-v4b-iot * - DIYables STEM V4B Edu: https://diyables.io/stem-v4-edu * - DIYables MEGA2560 R3: https://diyables.io/atmega2560-board * - DIYables Nano R3: https://diyables.io/nano-board * - DIYables ESP32 Board: https://diyables.io/esp32-board * - DIYables ESP32 S3, Uno-form factor: https://diyables.io/esp32-s3-uno * - It is expected to work with other boards */ #include <DIYables_4Digit7Segment_TM1637.h> // Pin configuration - change to match your wiring #define CLK_PIN 9 // The Arduino pin connected to the CLK pin of TM1637 4-digit 7-segment display #define DIO_PIN 10 // The Arduino pin connected to the DIO pin of TM1637 4-digit 7-segment display DIYables_4Digit7Segment_TM1637 display(CLK_PIN, DIO_PIN); void setup() { Serial.begin(9600); display.begin(); Serial.println("TM1637 Text and Degree Example"); } void loop() { // Display text strings const char* texts[] = {"HELP", "Hi", "COOL", "done"}; for (int i = 0; i < 4; i++) { display.print(texts[i]); Serial.print("Displaying: "); Serial.println(texts[i]); delay(2000); } // Display temperature with degree symbol display.printTemperature(25, 'C'); // Shows "25*C" Serial.println("Displaying: 25 degrees C"); delay(2000); display.printTemperature(72, 'F'); // Shows "72*F" Serial.println("Displaying: 72 degrees F"); delay(2000); // Display string with degree constant char buf[5]; buf[0] = '2'; buf[1] = '5'; buf[2] = DIYables_4Digit7Segment_TM1637::DEGREE; buf[3] = 'C'; buf[4] = '\0'; display.print(buf); // Same as printTemperature(25, 'C') Serial.println("Displaying: 25 degrees C (via print)"); delay(2000); }

How to Run

  • Wire the module as shown above.
  • Upload the sketch and open the Serial Monitor.

The display cycles through "HELP", "Hi", "COOL", "done", then shows "25*C" and "72*F".

Method Quick Reference

Method What It Does Usage
print(const char*) Displays a string (up to 4 chars) display.print("HELP")
printTemperature(int, char) Shows temperature with degree and unit display.printTemperature(25, 'C')
DEGREE Degree character for building strings display.DEGREE

Showing Time with Blinking Colon

Displays a clock-like output with the colon toggling every half second.

/* * This Arduino UNO R4 code was developed by newbiely.com * * This Arduino UNO R4 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-r4/arduino-uno-r4-tm1637-4-digit-7-segment-display */ /* * DIYables_4Digit7Segment_TM1637 - Time Example * * Displays time in HH:MM format with blinking colon separator * on a 4-digit 7-segment display with TM1637 driver. * * Tutorial: https://diyables.io/products/4-digit-7-segment-display-led-tm1637-with-colon * * TESTED HARDWARE: * - Arduino Uno R3 * - Arduino Uno R4 WiFi * - Arduino Uno R4 Minima * - Arduino Mega * - Arduino Due * - Arduino Giga * - DIYables STEM V3: https://diyables.io/stem-v3 * - DIYables STEM V4 IoT: https://diyables.io/stem-v4-iot * - DIYables STEM V4B IoT: https://diyables.io/stem-v4b-iot * - DIYables STEM V4B Edu: https://diyables.io/stem-v4-edu * - DIYables MEGA2560 R3: https://diyables.io/atmega2560-board * - DIYables Nano R3: https://diyables.io/nano-board * - DIYables ESP32 Board: https://diyables.io/esp32-board * - DIYables ESP32 S3, Uno-form factor: https://diyables.io/esp32-s3-uno * - It is expected to work with other boards */ #include <DIYables_4Digit7Segment_TM1637.h> // Pin configuration - change to match your wiring #define CLK_PIN 9 // The Arduino pin connected to the CLK pin of TM1637 4-digit 7-segment display #define DIO_PIN 10 // The Arduino pin connected to the DIO pin of TM1637 4-digit 7-segment display DIYables_4Digit7Segment_TM1637 display(CLK_PIN, DIO_PIN); int hours = 12; int minutes = 30; bool colonOn = true; void setup() { Serial.begin(9600); display.begin(); Serial.println("TM1637 Time Example"); Serial.println("Displaying 12:30 with blinking colon"); } void loop() { display.printTime(hours, minutes, colonOn); delay(500); // Toggle colon every 500ms for blinking effect colonOn = !colonOn; }

How to Run

  • Wire the module, upload the code.
  • The display shows "12:30" with the colon blinking.

Method Quick Reference

Method What It Does Usage
printTime(int, int) Shows HHMM with colon on display.printTime(12, 30)
printTime(int, int, bool) Shows HHMM, controls colon display.printTime(12, 30, false)

Blinking the Display On and Off

Uses off() and on() to create a blinking effect while keeping the display content.

/* * This Arduino UNO R4 code was developed by newbiely.com * * This Arduino UNO R4 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-r4/arduino-uno-r4-tm1637-4-digit-7-segment-display */ /* * DIYables_4Digit7Segment_TM1637 - Blink Example * * Blinks integer and text on a 4-digit 7-segment display * using off() and on() to toggle the display. * * Tutorial: https://diyables.io/products/4-digit-7-segment-display-led-tm1637-with-colon * * TESTED HARDWARE: * - Arduino Uno R3 * - Arduino Uno R4 WiFi * - Arduino Uno R4 Minima * - Arduino Mega * - Arduino Due * - Arduino Giga * - DIYables STEM V3: https://diyables.io/stem-v3 * - DIYables STEM V4 IoT: https://diyables.io/stem-v4-iot * - DIYables STEM V4B IoT: https://diyables.io/stem-v4b-iot * - DIYables STEM V4B Edu: https://diyables.io/stem-v4-edu * - DIYables MEGA2560 R3: https://diyables.io/atmega2560-board * - DIYables Nano R3: https://diyables.io/nano-board * - DIYables ESP32 Board: https://diyables.io/esp32-board * - DIYables ESP32 S3, Uno-form factor: https://diyables.io/esp32-s3-uno * - It is expected to work with other boards */ #include <DIYables_4Digit7Segment_TM1637.h> // Pin configuration - change to match your wiring #define CLK_PIN 9 // The Arduino pin connected to the CLK pin of TM1637 4-digit 7-segment display #define DIO_PIN 10 // The Arduino pin connected to the DIO pin of TM1637 4-digit 7-segment display DIYables_4Digit7Segment_TM1637 display(CLK_PIN, DIO_PIN); void setup() { Serial.begin(9600); display.begin(); Serial.println("TM1637 Blink Example"); } void loop() { // Blink an integer display.print(1234); Serial.println("Blinking: 1234"); for (int i = 0; i < 5; i++) { display.off(); delay(300); display.on(); delay(300); } delay(1000); // Blink text display.print("HELP"); Serial.println("Blinking: HELP"); for (int i = 0; i < 5; i++) { display.off(); delay(300); display.on(); delay(300); } delay(1000); }

How to Run

  • Upload and observe - "1234" blinks five times, then "HELP" blinks five times.

Method Quick Reference

Method What It Does Usage
off() Turns display off, data stays display.off()
on() Restores display display.on()
setBrightness(int) Adjusts brightness (0-7) display.setBrightness(4)

Controlling Individual Digits

Sets each digit independently using numbers, characters, and the colon separator.

/* * This Arduino UNO R4 code was developed by newbiely.com * * This Arduino UNO R4 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-r4/arduino-uno-r4-tm1637-4-digit-7-segment-display */ /* * DIYables_4Digit7Segment_TM1637 - IndividualDigits Example * * Sets individual digits, characters, and colon on a 4-digit * 7-segment display with TM1637 driver. * * Tutorial: https://diyables.io/products/4-digit-7-segment-display-led-tm1637-with-colon * * TESTED HARDWARE: * - Arduino Uno R3 * - Arduino Uno R4 WiFi * - Arduino Uno R4 Minima * - Arduino Mega * - Arduino Due * - Arduino Giga * - DIYables STEM V3: https://diyables.io/stem-v3 * - DIYables STEM V4 IoT: https://diyables.io/stem-v4-iot * - DIYables STEM V4B IoT: https://diyables.io/stem-v4b-iot * - DIYables STEM V4B Edu: https://diyables.io/stem-v4-edu * - DIYables MEGA2560 R3: https://diyables.io/atmega2560-board * - DIYables Nano R3: https://diyables.io/nano-board * - DIYables ESP32 Board: https://diyables.io/esp32-board * - DIYables ESP32 S3, Uno-form factor: https://diyables.io/esp32-s3-uno * - It is expected to work with other boards */ #include <DIYables_4Digit7Segment_TM1637.h> // Pin configuration - change to match your wiring #define CLK_PIN 9 // The Arduino pin connected to the CLK pin of TM1637 4-digit 7-segment display #define DIO_PIN 10 // The Arduino pin connected to the DIO pin of TM1637 4-digit 7-segment display DIYables_4Digit7Segment_TM1637 display(CLK_PIN, DIO_PIN); void setup() { Serial.begin(9600); display.begin(); Serial.println("TM1637 Individual Digits Example"); } void loop() { // Set individual numbers on each digit position display.clear(); display.setNumber(0, 1); display.setNumber(1, 2); display.setNumber(2, 3); display.setNumber(3, 4); Serial.println("Displaying: 1234"); delay(2000); // Turn colon on display.setColon(true); Serial.println("Displaying: 12:34"); delay(2000); // Turn colon off display.setColon(false); Serial.println("Displaying: 1234"); delay(2000); // Set individual characters display.clear(); display.setChar(0, 'H'); display.setChar(1, 'E'); display.setChar(2, 'L'); display.setChar(3, 'P'); Serial.println("Displaying: HELP"); delay(2000); // Mix characters and numbers with colon display.clear(); display.setChar(0, 'A'); display.setNumber(1, 3); display.setChar(2, 'b'); display.setNumber(3, 7); display.setColon(true); Serial.println("Displaying: A3:b7"); delay(2000); // Blinking colon effect display.clear(); display.setNumber(0, 1); display.setNumber(1, 2); display.setNumber(2, 3); display.setNumber(3, 0); Serial.println("Blinking colon: 12:30"); for (int i = 0; i < 5; i++) { display.setColon(true); delay(500); display.setColon(false); delay(500); } delay(1000); }

How to Run

  • Upload the code and watch the display cycle through different combinations.

Method Quick Reference

Method What It Does Usage
setNumber(int, int) Places a digit 0-9 at a position display.setNumber(0, 1)
setChar(int, char) Places a character at a position display.setChar(0, 'H')
setColon(bool) Toggles the colon display.setColon(true)
setSegments(int, uint8_t) Writes raw segment data display.setSegments(0, 0x76)

Troubleshooting

  • Nothing appears on the display - Recheck wiring. CLK and DIO must match the pin numbers in code. VCC should go to 5V (or 3.3V).
  • Wrong characters show up - CLK and DIO are likely swapped. Try switching the two wires.
  • Brightness too low - Call setBrightness(7) for maximum brightness.
  • Library not found - Install DIYables_4Digit7Segment_TM1637 from the Library Manager in Arduino IDE.

Platform Support

The library relies exclusively on Arduino standard APIs (pinMode, digitalWrite, digitalRead, delayMicroseconds) and runs on all Arduino-compatible platforms.

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!