← How-Tos
electronics 15 min ago ◯ 5 min read

Driving 7-Segment and 14-Segment Displays with MAX7219, TM1637, and Direct Multiplexing

7-segment display14-segment displaymax7219tm1637ht16k33multiplexingarduinoesp32

The moment a project needs to show a number — a temperature, a counter, a clock, an RPM readout — the cheapest and most legible option is still a 7-segment or 14-segment display, not a graphical LCD or OLED. The hard part was never the display itself; it's the pin count. A single 7-segment digit needs 8 lines (7 segments plus a decimal point), and a bank of four digits needs 32 I/O pins if you wire it naively. Driver ICs exist specifically to solve that, and picking the right one changes how much code you write and how many GPIO pins you have left for everything else.

7-Segment vs 14-Segment: What You're Actually Choosing

Common vs. common-cathode/anode wiring matters here too: segments within a digit share one common pin (cathode or anode depending on the part), and driver ICs are generally written with one polarity in mind, so check your display's datasheet before wiring blind.

Driver IC Options Compared

DriverInterfaceMax DigitsNotes
MAX7219 / MAX7221SPI (3-wire)8 (7-segment) per chip, chainableHandles multiplexing and current limiting internally; the classic choice, huge library support, drives common-cathode 7-segment modules directly
TM16372-wire (clock + data, not true I2C)Typically 4-6 digits, fixed to the moduleDirt cheap, found on most 4-digit clock-style display boards; limited brightness steps, no daisy-chaining beyond what's on the board
TM1638 / TM1640Similar 2-wire protocolUp to 8-16 digits plus keys/LEDsCommon on "LED & Key" demo boards; adds built-in button scanning, useful for simple control panels
HT16K33True I2CUp to 8 digits (16x8 matrix driver)Used on many Adafruit 14-segment alphanumeric backpacks; shares the bus with other I2C sensors cleanly, good choice when you're already I2C-heavy
Direct multiplexing (no driver IC)Raw GPIO + transistorsLimited by your pin count and refresh codeCheapest in parts, most demanding in firmware; you own the refresh timing, current limiting, and ghosting prevention yourself

Direct Multiplexing: What the Driver IC Is Actually Doing For You

If you skip a driver chip, you drive multi-digit displays by multiplexing: light one digit's segments at a time, cycle through digits fast enough (refresh above roughly 60–100Hz per digit, so the full multiplex cycle stays comfortably above flicker threshold) that persistence of vision makes it look like all digits are lit simultaneously. In firmware, this means a timer interrupt that advances to the next digit, sets its segment pattern, and enables only that digit's common line, all within a budget small enough to not steal cycles from the rest of your program.

The practical headaches direct multiplexing introduces, and that a driver IC quietly solves for you, are:

Wiring Notes for Arduino and ESP32

MAX7219 modules chain over SPI (DIN/CLK/CS, or the hardware SPI pins if you want speed over many chained modules) and are supported directly by the widely-used LedControl and MD_MAX72XX libraries. TM1637 boards use a simple bit-banged two-wire protocol that doesn't need hardware SPI or I2C peripherals at all, which makes it a good fit for boards where those buses are already busy — just be aware it is not I2C-compatible despite looking similar, and cannot share a bus with real I2C devices. HT16K33-based modules are genuine I2C and will happily share a bus with sensors at other addresses (check for address conflicts if you're running several HT16K33 boards — most support a few hardware-selectable addresses via solder jumpers). On the ESP32 specifically, keep display-driver SPI or I2C pins off the strapping pins (GPIO 0, 2, 12, 15) to avoid boot-mode conflicts, and remember the ESP32-S2/S3/C3 variants don't all expose the same default bus pins as the original ESP32, so confirm your board's pinout before wiring.

Choosing Between Them

For a simple numeric counter or clock with four to eight digits, a TM1637 board is the fastest path from parts bin to working display and the cheapest per digit. For anything larger, chained, or where you want fine brightness control and rock-solid timing independent of your main loop, the MAX7219 is the better-documented, more flexible choice. Reach for an HT16K33 alphanumeric backpack specifically when you need readable text rather than digits, or when I2C is already your bus of choice and you'd rather not add a second protocol to the project. Direct multiplexing is worth doing once, as a learning exercise, before reaching for a driver IC on every project afterward.