8x8 LED matrix/How it lights/03. One column at a time
How it lights · 03 of 10

One column at a time

Sixty-four LEDs share sixteen legs, so they can never all be lit at the same instant. The MAX7219 lights one column, then the next, eight columns in turn, about 800 times a second, and the eye adds them up into one picture.

Sixteen legs for sixty-four LEDs

Inside the matrix each LED joins one row wire and one column wire. Eight rows, eight columns, sixteen legs. Current flows through an LED only when its column is driven and its row is grounded, so lighting two LEDs in different columns at once would light the two LEDs that share their rows as well. The way out is to light only one column at any moment.

One scan, slowed down

One column at a time
Picture
One scan
1250 µs
Each column
156 µs
Scans a second
500 to 1300
Press Run. The chip will light the picture the only way sixteen legs allow: one column at a time.

The chip does exactly that. It grounds one column, sends current to the LEDs of that column that should be on, waits, and moves to the next. Eight columns make one scan; the datasheet gives about 800 scans a second, anywhere from 500 to 1300. So each column is lit for about 156 µs in every 1.25 ms.

An eye cannot follow that. It sees every LED that is lit in any column as lit all the time, a little dimmer than if it really were. This is called multiplexing, and it is how nearly every LED display with more than a few dozen LEDs works.

What the chip keeps

The picture lives in the chip's eight digit registers, one byte per column. The chip reads them on every scan by itself. Your board writes a register only when the picture changes, and the rest of the time it is free.

The chip's name for a column is a digit, because it was designed for seven-segment digits. The TK52 wires its eight digit lines to the matrix's eight lines of LEDs, and with the matrix up and the header down those lines run up and down the board, so this book calls them columns.

When it does not work

Only one column lights up.

The scan-limit register is set to scan one column, which is also where the chip starts after power-up. Write 7 to register 0x0B so it scans all eight. The book's sketch does this in setup().

Can I scan fewer columns to make it brighter?

Do not go under four on this board. The datasheet limits the current when only one, two or three columns are scanned, to protect the chip's column drivers, and R7 sets the LEDs near 40 mA, far over those limits. Scan all eight.

The display flickers on video but not to my eye.

That is the scan. A camera's shutter catches some columns lit and some dark. At about 800 scans a second an eye does not see it; a phone camera often does, as rolling bands.

Does my sketch have to keep refreshing it?

No. The chip does the scanning from its own memory. Your board sends a picture once, and it stays until the next picture, the power goes, or the chip is put in shutdown.

Where this goes next

One byte per column, one bit per LED, and which bit is which on this board.

Eight bytes for sixty-four LEDs →

Edit this page — content/books/matrix-led/one-column-at-a-time.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

This page covers several products. Choose yours to see the right 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.

Browse Modules and blocks on the forum →