science tinker

LED matrix 8×8 (MAX7219)

A square of 64 red LEDs in 8 rows and 8 columns, driven by one MAX7219 chip from three signal wires.

Light, sound and displays · Elements inside: AlGaInPSiCuSn

Function: what the MAX7219 does in a circuit

A square of 64 red LEDs in 8 rows and 8 columns, driven by one MAX7219 chip from three signal wires.

  • Shows letters, symbols and animations on an 8 × 8 grid of LEDs
  • Controls all 64 LEDs from three pins
  • Can be chained with more matrices for scrolling text

MAX7219 key facts

LEDs64 red, 8 rows × 8 columns
Driver chipMAX7219
Interface3 wires: DIN, CS (LOAD), CLK, or the SPI pins (MOSI, SS, SCK)
ChainingDOUT feeds DIN of the next matrix; CS and CLK are shared; up to 8 in a row
Supply5 V
Brightness16 levels (0 to 15)
Currentup to about 330 mA with every LED at full brightness
LibraryLedControl

MAX7219 pinout

The connections, in the order they appear on the part:

No.Name
1VCC
2GND
3DIN (data in)
4CS (chip select)
5CLK (clock)
6DOUT (data out to the next matrix)

How to connect the MAX7219 to an Arduino

Connect VCC to 5V, GND to GND, DIN to pin 11, CS to pin 10 and CLK to pin 13. For a second matrix, wire DOUT of the first to DIN of the second, share CS, CLK, 5V and GND, and change the last number in LedControl(11, 13, 10, 2). The matrix wired to the Arduino is number 0.

Example sketch:

#include <LedControl.h>

LedControl lc = LedControl(11, 13, 10, 1);  // DIN, CLK, CS, number of matrices

void setup() {
  lc.shutdown(0, false);     // wake the chip
  lc.setIntensity(0, 8);
  lc.clearDisplay(0);
  lc.setLed(0, 3, 4, true);  // row 3, column 4
  lc.setRow(0, 0, B11111111);
}

void loop() {}

Run this in the free simulator

How it works

The LEDs are wired as a grid: each LED sits where a row wire crosses a column wire. The MAX7219 lights one row at a time, hundreds of times a second, so fast that your eye sees a steady picture (this is called multiplexing). The Arduino sends it data on DIN, one bit per pulse of CLK, and CS marks the end of a command. With the LedControl library: lc.shutdown(0, false) wakes the chip, lc.setLed(0, row, column, true) lights one LED and lc.setRow(0, row, B10101010) sets a whole row. Several matrices can share the same three pins: DOUT of one feeds DIN of the next, and the first number in each command says which matrix is meant (0 is the one wired to the Arduino).

What it is made of

  • LEDs: Red LED dies (aluminium gallium indium phosphide) in a moulded block AlGaInP
  • Driver: MAX7219 silicon chip Si
  • Board and pins: Glass-fibre and epoxy with copper tracks, tin-plated headers CuSn

Where the materials come from: Gallium and indium as by-products of aluminium and zinc refining; copper from chalcopyrite.

The chemistry

One resistor on the board sets the current for all 64 LEDs, because the chip is a constant-current driver: it adjusts the voltage so the same current flows whichever LEDs are lit.

Biology connection

Multiplexing works because of persistence of vision: the eye keeps seeing a flash for a moment after it ends, so rows lit one after another merge into a whole picture. How the eye sees →

Safety and the environment

The order in LedControl is DIN, CLK, CS. The chip wakes up in shutdown mode, so nothing shows until you call shutdown(0, false).

Did you know? Modules can be chained, DOUT of one to DIN of the next, to build long scrolling message signs from the same three pins.

Try it in the simulator

Build and code a circuit with an LED matrix 8×8 in these practice projects:

Questions students ask

What does the MAX7219 do?

A square of 64 red LEDs in 8 rows and 8 columns, driven by one MAX7219 chip from three signal wires. Main functions: shows letters, symbols and animations on an 8 × 8 grid of LEDs; controls all 64 LEDs from three pins; can be chained with more matrices for scrolling text.

Why is my MAX7219 matrix blank?

The chip starts in shutdown mode. Call lc.shutdown(0, false) once in setup(), and check the pin order: LedControl(DIN, CLK, CS, 1).

What are the connections of the MAX7219?

In order: VCC, GND, DIN (data in), CS (chip select), CLK (clock), DOUT (data out to the next matrix).

How do I connect the MAX7219 to an Arduino?

Connect VCC to 5V, GND to GND, DIN to pin 11, CS to pin 10 and CLK to pin 13. For a second matrix, wire DOUT of the first to DIN of the second, share CS, CLK, 5V and GND, and change the last number in LedControl(11, 13, 10, 2). The matrix wired to the Arduino is number 0.

How does the MAX7219 work?

The LEDs are wired as a grid: each LED sits where a row wire crosses a column wire. The MAX7219 lights one row at a time, hundreds of times a second, so fast that your eye sees a steady picture (this is called multiplexing). The Arduino sends it data on DIN, one bit per pulse of CLK, and CS marks the end of a command. With the LedControl library: lc.shutdown(0, false) wakes the chip, lc.setLed(0, row, column, true) lights one LED and lc.setRow(0, row, B10101010) sets a whole row. Several matrices can share the same three pins: DOUT of one feeds DIN of the next, and the first number in each command says which matrix is meant (0 is the one wired to the Arduino).

What is the MAX7219 made of?

LEDs: Red LED dies (aluminium gallium indium phosphide) in a moulded block. Driver: MAX7219 silicon chip. Board and pins: Glass-fibre and epoxy with copper tracks, tin-plated headers.

Is the MAX7219 safe? How should it be recycled?

The order in LedControl is DIN, CLK, CS. The chip wakes up in shutdown mode, so nothing shows until you call shutdown(0, false).

More light, sound and displays

Know someone who would use this?

It’s free for every learner. Send it to your class, team or club.

Updated · Free, no sign-up ·

Connected tools

The same idea from another angle, across the site.