Arduino MD_MAX72XX LED Matrix: Wiring, Code and Simulator
To build this Arduino MD_MAX72XX LED Matrix project you need an Arduino Uno and a MAX7219 8x8 LED matrix. The MajicDesigns MD_MAX72XX library on hardware SPI lights alternating rows. Make the 5 connections in the wiring table, upload the Arduino C++ code, and use mx.setPoint(row, col, true) to draw single pixels.
Open this circuit in the free Arduino Uno simulator
Parts list
| Qty | Part | What it does |
|---|---|---|
| 1 | Arduino Uno | the microcontroller board |
| 1 | MAX7219 8x8 LED matrix | An 8×8 red matrix. Shift 16 bits (register, data) into DIN on CLK with CS LOW, then raise CS. Rows are registers 1–8; write 0x0C=1 to switch it on. |
Wiring
| # | From | To |
|---|---|---|
| 1 | Arduino Uno 5V | MAX7219 8x8 LED matrix VCC |
| 2 | Arduino Uno GND | MAX7219 8x8 LED matrix GND |
| 3 | Arduino Uno pin 11 | MAX7219 8x8 LED matrix DIN |
| 4 | Arduino Uno pin 10 | MAX7219 8x8 LED matrix CS |
| 5 | Arduino Uno pin 13 | MAX7219 8x8 LED matrix CLK |
Step by step
- Open the simulator. Open the BitForBytes Embedded Lab in your browser and start from the Arduino Uno. No install or account is needed.
- Add the parts. Add a MAX7219 8x8 LED matrix from the parts palette.
- Wire 1. Connect Arduino Uno 5V to MAX7219 8x8 LED matrix VCC.
- Wire 2. Connect Arduino Uno GND to MAX7219 8x8 LED matrix GND.
- Wire 3. Connect Arduino Uno pin 11 to MAX7219 8x8 LED matrix DIN.
- Wire 4. Connect Arduino Uno pin 10 to MAX7219 8x8 LED matrix CS.
- Wire 5. Connect Arduino Uno pin 13 to MAX7219 8x8 LED matrix CLK.
- Paste the Arduino C++ code. Paste the Arduino C++ code below into the code editor.
- Run it. Press Run. Use mx.setPoint(row, col, true) to draw single pixels.
Arduino C++ code
// MD_MAX72XX: the MajicDesigns MAX7219 library, one FC16-style 8x8 module.
#include <MD_MAX72xx.h>
#include <SPI.h>
MD_MAX72XX mx(MD_MAX72XX::FC16_HW, 10, 1); // FC16: the common module type
void setup() {
mx.begin();
mx.clear();
for (uint8_t r = 0; r < 8; r++) mx.setRow(0, r, r & 1 ? 0xAA : 0x55);
}
void loop() {}
What to try
Use mx.setPoint(row, col, true) to draw single pixels.
Frequently asked questions
How do I wire the MD_MAX72XX LED Matrix project on an Arduino Uno?
Make 5 connections: Arduino Uno 5V to MAX7219 8x8 LED matrix VCC; Arduino Uno GND to MAX7219 8x8 LED matrix GND; Arduino Uno pin 11 to MAX7219 8x8 LED matrix DIN; Arduino Uno pin 10 to MAX7219 8x8 LED matrix CS; Arduino Uno pin 13 to MAX7219 8x8 LED matrix CLK.
What parts do I need for this Arduino project?
An Arduino Uno and a MAX7219 8x8 LED matrix.
Can I simulate this Arduino project online for free?
Yes. The BitForBytes Embedded Lab runs this exact circuit and Arduino C++ code in your browser for free, with no install and no hardware. The sketch is compiled with the real Arduino toolchain and runs on an emulated ATmega328P.
What does the code do?
The MajicDesigns MD_MAX72XX library on hardware SPI lights alternating rows.
More Arduino Uno projects
- Arduino LED Blink: Wiring, Code and Simulator
- Arduino LDR Light Sensor: Wiring, Code and Simulator
- Arduino NTC Thermistor Thermometer: Wiring, Code and Simulator
- Arduino PWM to Analog RC Filter: Wiring, Code and Simulator
- Arduino Capacitance Meter: Wiring, Code and Simulator
- Arduino DC Motor PWM Speed Control with MOSFET: Wiring, Code and Simulator