LED GURUcosycom.com
PAGE 115 OF 150 · MICROCONTROLLERS & LEDS

Driving a Matrix with a Microcontroller

Row and column scanning lights the grid.

LED SYMBOLTriangle points from anode to cathode; the arrows show light leaving the part.

Scanning a matrix

An 8 by 8 matrix directly needs 16 pins. A MAX7219 reduces this to three control wires: data, clock and chip select.

Program idea

  • Keep the picture in a frame buffer of eight bytes, one per row.
  • Send the row bytes to the driver, or scan rows yourself at 100 Hz or more.

When scanning yourself, a row with eight LEDs at 10 mA draws 80 mA, so put transistors on the row lines. Switch the rows off briefly between steps to prevent ghosting.

REMEMBER
A frame buffer separates drawing from refreshing.

Try it yourself

Sketch the circuit on paper first, calculate the values, then build it on a solderless breadboard using a low-voltage supply. Measure with a multimeter before you make anything permanent.

Explore LED clocks, stopwatches and electronics at cosycom.com.

Watch: COSYCOM channel videos

www.youtube.com/@cosycom