Three wires, eight digits
Eight seven-segment digits are sixty-four LEDs, and no hobby board has sixty-four spare pins. The MAX7219 is the chip that turns that into three wires and, more usefully, into a display that keeps working while your sketch is busy doing something else.
Sixty-four LEDs
A seven-segment digit is seven bars and a dot: eight LEDs. Eight of them side by side is sixty-four. That is the number every design decision on this board is working around.
Work the two rows of buttons. One pin per LED is honest and useless. Sharing the eight segment lines across all the digits and lighting one digit at a time — multiplexing — gets it down to sixteen pins, which is possible on an Uno and leaves you nothing. And it costs more than pins.
What multiplexing actually costs
If you multiplex in software, something in your sketch has to move to the next digit hundreds of times a second, forever. Not once at startup — continuously, for as long as you want the display lit.
That is fine until the sketch does anything else. Read a sensor that takes two
milliseconds and one digit stays lit for two milliseconds instead of one, so it
looks brighter than its neighbours. Call delay(1000) and the display holds one
digit for a second. Join a Wi-Fi network and it goes dark, because the Wi-Fi
stack does not give the CPU back on your schedule.
What the chip does instead
The MAX7219 has an 8 × 8 block of memory, one byte per digit, and its own oscillator. You write a byte; it holds it and scans the display at about 800 times a second in hardware, whatever your board is doing. Your sketch stops being a refresh loop and becomes a thing that occasionally sends eight bytes.
Three wires carry that. DIN is the data, one bit at a time. CLK tells the chip when to read each bit. CS says when a message has ended. Two more for 5 V and ground and the connection is complete — five wires from the board to the tube, of which two are power.
The same three wires drive any number of these chained together, which is how the 32 × 8 matrix boards in the same shop work. This kit has one chip per display, so a second display costs one more CS pin and nothing else.
The trade you are making
You give up direct control of individual LEDs at the pin level and get, in exchange, a display that is a fixed cost: three pins, eight bytes, and no timing obligation. For a clock in a glass tube that is exactly the right trade. Nothing about a clock needs sub-millisecond control of a segment, and everything about one needs the digits to stay lit while the board is asking a time server what time it is.
When it does not work
For one digit, yes — eight pins and eight resistors. For eight there is no board with the pins, and even if there were, every LED needs its own current-limiting resistor. The driver board does the current limiting too, from a single resistor on the back, which is one of the quieter reasons it is cheaper than the parts.
Yes, and that is not a coincidence: an 8 by 8 matrix is sixty-four LEDs on eight rows and eight columns, and so is eight seven-segment digits with their points. The MAX7219 does not know the difference. What changes is whether you use its built-in number font, which only makes sense on digits.
Expected, and occasionally confusing. The eight bytes live in the chip's own memory and it goes on scanning them whatever your board does — including sitting in a reset loop. A frozen display is not proof your sketch is running.
Three displays already built, three you build yourself, and the one combination the box cannot make.
What is in the box →Edit this page — content/books/max7219-tube-clock/three-wires-eight-digits.mdx
Questions about this product
See what other owners have asked, and read their solutions.
MAX7219 Vintage Tube LED Clock Kit
Loading discussions…
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.