TM1637 4-Digit 7-Segment Display
Overview
A 4-digit 7-segment display using the TM1637 chipset.

Specifications
- Input voltage: 3.3~5.5V DC
- Current consumption: 30mA (MAX 80mA)
- FND type: Common Anode
- Control method: 2-wire serial interface (CLK, DIO)
- Oscillating type: Built-in RC oscillator
- Built-in power-on reset circuit
- Built-in automatic blanking circuit
Supported GPIO
- Raspberry Pi 0~4
- Raspberry Pi 5
- BeagleBone Black/Green
- Jetson Nano
Commands
[INIT]
Initializes the module.
Item | Type | Description |
---|---|---|
CLK Pin | WRITE | Enter the GPIO pin to connect to the CLK pin. |
DIO Pin | WRITE | Enter the GPIO pin to connect to the DIO pin. |
[SHOW_NUMBER_DEC]
Displays numbers in decimal format on the display.
Item | Type | Description |
---|---|---|
Number | WRITE | Enter the number to display. |
Left Zero Padding | WRITE | Set whether to fill the left side of the display with zeros. |
Display Position | WRITE | Set the starting position to display the number. (0~3, 0 from left) |
Display Digits | WRITE | Set the number of digits to display. (1~4) |
[SHOW_NUMBER_DEC_EX]
Displays decimal numbers with dots (.) or colons (:) on the display.
Item | Type | Description |
---|---|---|
Number | WRITE | Enter the number to display. |
Left Zero Padding | WRITE | Set whether to fill the left side of the display with zeros. |
Display Position | WRITE | Set the starting position to display the number. (0~3, 0 from left) |
Display Digits | WRITE | Set the number of digits to display. (1~4) |
Dot (.) or Colon (:) Value * | WRITE | Set whether to display dots or colons. This is a bitmask byte value. Dots or colons may exist differently depending on the display type. |
* You can display dots (.) or colons (:) at various positions as follows:
• Dot (.) display
– 0x80 → 0b10000000 → 0.000
– 0x40 → 0b01000000 → 00.00
– 0x20 → 0b00100000 → 000.0
– 0xE0 → 0b11100000 → 0.0.0.0
• Colon (:) display
– 0x40 → 0b01000000 → 00:00
• Dot (.) and colon (:) display
– 0xE0 → 0b11100000 → 0.0:0.0
• Dot (.) display
– 0x80 → 0b10000000 → 0.000
– 0x40 → 0b01000000 → 00.00
– 0x20 → 0b00100000 → 000.0
– 0xE0 → 0b11100000 → 0.0.0.0
• Colon (:) display
– 0x40 → 0b01000000 → 00:00
• Dot (.) and colon (:) display
– 0xE0 → 0b11100000 → 0.0:0.0
[SHOW_NUMBER_HEX_EX]
Displays hexadecimal numbers with dots (.) or colons (:) on the display.
Item | Type | Description |
---|---|---|
Number | WRITE | Enter the number to display in hexadecimal format. |
Left Zero Padding | WRITE | Set whether to fill the left side of the display with zeros. |
Display Position | WRITE | Set the starting position to display the number. (0~3, 0 from left) |
Display Digits | WRITE | Set the number of digits to display. (1~4) |
Dot (.) or Colon (:) Value | WRITE | Set whether to display dots or colons. This is a bitmask byte value. Dots or colons may exist differently depending on the display type. |
[SHOW_DATE]
Displays date on the display.
Item | Type | Description |
---|---|---|
Date | WRITE | Enter the date to display. |
Display Format | WRITE | Select the format to display. (Year/Month, Month/Day) |
Show Dot (.) or Colon (:) | WRITE | Set whether to display dots or colons. |
[SHOW_CLOCK]
Displays time on the display.
Item | Type | Description |
---|---|---|
Time | WRITE | Enter the time to display. |
Display Format | WRITE | Select the format to display. (Hour/Minute, Minute/Second) |
Show Dot (.) or Colon (:) | WRITE | Set whether to display dots or colons. |
[SHOW_TIME]
Displays time duration on the display.
Item | Type | Description |
---|---|---|
Time Duration | WRITE | Enter the time duration to display. |
Display Format | WRITE | Select the format to display. (Hour/Minute, Minute/Second) |
Show Dot (.) or Colon (:) | WRITE | Set whether to display dots or colons. |
[CLEAR]
Clears the display content.
[SET_SEGMENTS]
Displays raw data on the display.
Item | Type | Description |
---|---|---|
Raw Data * | WRITE | Enter the content to display as a byte array. Up to 4 bytes can be entered. |
Display Position | WRITE | Set the starting position to display. (0~3, 0 from left) |
Display Digits | WRITE | Set the number of digits to display. (1~4) |
* Refer to the following to calculate the bitmask value. Positions marked with X are not used, so enter 0.
Example) To display 8: Binary 0b01111111 → Hexadecimal 0x7F → Decimal 127
Example) To display 8: Binary 0b01111111 → Hexadecimal 0x7F → Decimal 127

[ENCODE_DIGIT]
Encodes a single digit number into raw data.
Item | Type | Description |
---|---|---|
Number | WRITE | Enter the number to convert to raw data. |
Raw Data | READ | Converted bitmask byte value. |
[SET_BRIGHTNESS]
Sets the brightness of the display.
Item | Type | Description |
---|---|---|
Brightness | WRITE | Set the brightness of the display. (0~7) |
[DISPLAY_ON]
Turns on the display.
[DISPLAY_OFF]
Turns off the display.
Example
Objective
Display the current time in “Hour:Minute” format on the display.
Parts
Part | Quantity |
---|---|
Raspberry Pi 4 * | 1 |
TM1637 Display | 1 |
* Other hardware can also be used. Refer to Supported GPIO.
Wiring
Connect the following pins horizontally to each other.
TM1637 Display | GPIO |
---|---|
VCC | 3.3V |
GND | GND |
CLK | 23 * |
DIO | 24 * |
* Any GPIO pins can be used.

Project Link