ESP32 C3 Super Mini - LED Matrix

An LED matrix display, also called a dot matrix display, is a cheap and easy way to show text and numbers. This tutorial shows you how to drive a MAX7219 LED matrix with the ESP32 C3 Super Mini using only three signal wires.

In this tutorial, you'll learn:

After that, you can easily adapt the code for other sizes such as a 16x8 or 64x8 LED matrix.

ESP32 C3 Super Mini - LED Matrix

Hardware Preparation

1×ESP32 C3 Super Mini
1×USB Cable Type-A to Type-C (for USB-A PC)
1×USB Cable Type-C to Type-C (for USB-C PC)
1×FC-16 LED Matrix 32x8
1×FC-16 LED Matrix 8x8
1×Generic LED Matrix 8x8
1×Breadboard
1×Jumper Wires
1×Optionally, DC Power Jack

Or you can buy the following kits:

1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of LED Matrix

LED Matrix display

An LED matrix is a grid of LEDs driven by a small chip so you can control every dot. With the ESP32 C3 Super Mini, the MAX7219-based LED matrix is the most popular choice.

Key Features:

  • Block: The base unit of an LED matrix is one block.
  • Inside a block: Each block has an 8x8 LED matrix (64 LEDs) and one MAX7219 driver.
  • Two forms: There are two popular block forms, the generic module and the FC-16 module.
  • Single or many: An LED matrix can be one block, or many blocks in a daisy-chain.
  • Ready-made: You can buy a pre-built multi-block LED matrix (for example 4-in-1 or 8-in-1).
  • Build your own: You can also buy separate blocks and wire them into any size you want.
  • In code: You declare the size of the LED matrix in the ESP32 C3 Super Mini code.

Technical Specifications:

  • Driver chip: MAX7219
  • Supply voltage: 5V
  • Logic level: works with the 3.3V signals of the ESP32 C3 Super Mini
  • Interface: SPI (three signal wires: DIN, CS, CLK)
  • Brightness levels: 16 steps, from 0 to 15
  • Current draw: up to about 1A per display at full brightness

Pinout

LED Matrix Pinout

An LED matrix is formed by one or more blocks. Each block has two groups of pins.

Input pins group:

  • VCC: connects to 5V.
  • GND: connects to GND.
  • DIN: Data pin. Connect it to a GPIO pin of the ESP32 C3 Super Mini.
  • CS: Chip Select. Connect it to a GPIO pin of the ESP32 C3 Super Mini.
  • CLK: Clock pin. Connect it to a GPIO pin of the ESP32 C3 Super Mini.

Output pins group:

  • VCC: connects to VCC of the input pins group on the next module.
  • GND: connects to GND of the input pins group on the next module.
  • DOUT: Data Out, connects to the DIN pin of the input pins group of the next module.
  • CS: connects to CS of the input pins group on the next module.
  • CLK: connects to CLK of the input pins group on the next module.

Wiring Diagram

The ESP32 C3 Super Mini talks to the LED matrix over SPI, so only three signal wires are needed.

LED Matrix Pin ESP32 C3 Super Mini Pin
VCC 5V (external supply)
GND GND
DIN GPIO6 (MOSI)
CS GPIO7
CLK GPIO4 (SCK)
  • Note: GPIO4 (SCK) and GPIO6 (MOSI) are the hardware SPI pins. Keep them as they are.
  • Note: GPIO7 is the CS pin. You can change it to another free GPIO pin if you also change it in the code.
  • Note: The GND of the ESP32 C3 Super Mini and the GND of the power supply must be joined together.
  • Note: Always check VCC and GND twice before you power the display on.

If the LED matrix is made of a single block:

  • Connect the input pins group to the ESP32 C3 Super Mini
  • Leave the output pins group unconnected
The wiring diagram between ESP32 C3 Super Mini 8x8 LED matrix FC-16

This image is created using Fritzing. Click to enlarge image

The wiring diagram between ESP32 C3 Super Mini 8x8 LED matrix generic

This image is created using Fritzing. Click to enlarge image

If the LED matrix is a pre-built multi-block module:

  • Connect the input pins group to the ESP32 C3 Super Mini
  • Leave the output pins group unconnected
The wiring diagram between ESP32 C3 Super Mini LED matrix display

This image is created using Fritzing. Click to enlarge image

If you build the LED matrix from several blocks yourself:

  • Connect the input pins group of the first block to the ESP32 C3 Super Mini
  • Connect the output pins group of each block to the input pins group of the next block
  • Leave the output pins group of the last block unconnected
The wiring diagram between ESP32 C3 Super Mini 32x8 LED matrix FC-16

This image is created using Fritzing. Click to enlarge image

WARNING

The display draws a lot of current, up to 1A at maximum brightness.

  • Do not power the LED matrix from the 5V pin of the ESP32 C3 Super Mini.
  • Use an external 5V power supply instead.
  • The ESP32 C3 Super Mini and the LED matrix can share the same 5V power adapter.

How To Program For LED Matrix

Controlling a MAX7219 by hand is hard, but a library makes it simple. Below are the steps to write ESP32 C3 Super Mini code for the LED matrix.

  • Include the libraries:
#include <MD_Parola.h> #include <MD_MAX72xx.h>
  • Tell the library which hardware you have: GENERIC_HW or FC16_HW.
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
  • Set how many LED blocks are used. For example, a 4-in-1 LED matrix has 4 blocks.
#define MAX_DEVICES 4
  • Set the ESP32 C3 Super Mini pin that goes to the CS pin of the LED matrix, for example GPIO7.
#define CS_PIN 7
  • Create a new instance of the MD_Parola class for the LED matrix display.
MD_Parola ledMatrix = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
  • Write the setup() function:
void setup() { ledMatrix.begin(); // initialize the object ledMatrix.setIntensity(0); // set the brightness of the LED matrix display (from 0 to 15) ledMatrix.displayClear(); // clear led matrix display }
  • Display text, numbers and animated effects: see the next part.

※ NOTE THAT:

The DIN and CLK pins are handled by the hardware SPI of the ESP32 C3 Super Mini, so you never name them in the code. Only the CS pin is written in the sketch.

ESP32 C3 Super Mini - LED Matrix Code

The code below is for a 32x8 FC-16 LED matrix display (4 blocks), but you can easily adapt it for 8x8, 16x8, 64x8 and other sizes.

/* * This ESP32 C3 Super Mini code was developed by newbiely.com * * This ESP32 C3 Super Mini code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-c3/esp32-c3-super-mini-led-matrix */ #include <MD_Parola.h> #include <MD_MAX72xx.h> #define HARDWARE_TYPE MD_MAX72XX::FC16_HW #define MAX_DEVICES 4 // 4 blocks #define CS_PIN 7 // The ESP32 C3 SuperMini pin connected to the CS pin of the LED matrix // create an instance of the MD_Parola class MD_Parola ledMatrix = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES); void setup() { ledMatrix.begin(); // initialize the LED Matrix ledMatrix.setIntensity(15); // set the brightness of the LED matrix display (from 0 to 15) ledMatrix.displayClear(); // clear LED matrix display } void loop() { ledMatrix.setTextAlignment(PA_LEFT); ledMatrix.print("Left"); // display text delay(2000); ledMatrix.setTextAlignment(PA_CENTER); ledMatrix.print("Center"); // display text delay(2000); ledMatrix.setTextAlignment(PA_RIGHT); ledMatrix.print("Right"); // display text delay(2000); ledMatrix.setTextAlignment(PA_CENTER); ledMatrix.setInvert(true); ledMatrix.print("Invert"); // display text inverted delay(2000); ledMatrix.setInvert(false); ledMatrix.print(1234); // display number delay(2000); }

What This Code Does:

  • Sets the CS pin to GPIO7 on the ESP32 C3 Super Mini
  • Tells the library the display has 4 FC-16 blocks
  • Starts the display and sets the brightness to the maximum, 15
  • Shows the same text aligned left, center and right
  • Shows inverted text, then the number 1234

Detailed Instructions

  • New to ESP32 C3 Super Mini? Complete our Getting Started with ESP32 C3 Super Mini tutorial first to set up your development environment.
  • Wire the parts: Connect the LED matrix to the ESP32 C3 Super Mini as shown in the diagram above.
  • Power the display: Use an external 5V supply and join the grounds together.
  • Connect the board: Plug the ESP32 C3 Super Mini into your computer with the USB Type-C cable.
  • Open the IDE: Launch the Arduino IDE on your computer.
  • Select the board: Make sure ESP32 C3 Super Mini is selected in Tools > Board.
  • Select the port: Pick the COM port of your ESP32 C3 Super Mini.
  • Open Library Manager: Click the Library Manager icon on the left navigation bar of the Arduino IDE.
  • Search the library: Type “MD_Parola”, then find the MD_Parola library.
  • Install it: Click the Install button.
  • Search for MD_Parola created by majicDesigns and click the Install button.
Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
ESP32C3 Dev Module
Library Manager
Type:
All
Topic:
All
MD_Parola by majicDesigns
Implemented using the MD_MAX72xx library for hardware control. Provides functions to simplify the implementation of text special effects on the LED matrix. More info
3.7.2
INSTALL
Newbiely.ino
···
1 void setup() {
Output
Serial Monitor
Ln 1, Col 1
ESP32C3 Dev Module on COM15
1
  • Install the dependency: You will be asked to install the “MD_MAX72XX” library. Click the Install All button.
  • Copy the code: Copy the code above and open it in the Arduino IDE.
  • Upload: Click the Upload button to send the code to the ESP32 C3 Super Mini.
  • Watch: See the text and numbers appear on the LED matrix display.
  • Serial Monitor: If you add Serial output later, set the Serial Monitor baud rate to 115200.
  • Pro Tip: If the characters look mirrored or cut in half, change HARDWARE_TYPE from FC16_HW to GENERIC_HW.

ESP32 C3 Super Mini LED Matrix Code – Scrolling Text

A long message does not fit on a small LED matrix, so you can scroll it instead.

The ESP32 C3 Super Mini code below scrolls a message across the LED matrix display.

/* * This ESP32 C3 Super Mini code was developed by newbiely.com * * This ESP32 C3 Super Mini code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-c3/esp32-c3-super-mini-led-matrix */ #include <MD_Parola.h> #include <MD_MAX72xx.h> #define HARDWARE_TYPE MD_MAX72XX::FC16_HW #define MAX_DEVICES 4 // 4 blocks #define CS_PIN 7 // The ESP32 C3 SuperMini pin connected to the CS pin of the LED matrix // create an instance of the MD_Parola class MD_Parola ledMatrix = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES); void setup() { ledMatrix.begin(); // initialize the object ledMatrix.setIntensity(15); // set the brightness of the LED matrix display (from 0 to 15) ledMatrix.displayClear(); // clear led matrix display ledMatrix.displayScroll("ESP32", PA_CENTER, PA_SCROLL_LEFT, 100); } void loop() { if (ledMatrix.displayAnimate()) { ledMatrix.displayReset(); } }

What This Code Does:

  • Uses the same GPIO7 CS pin and the same 4-block setup
  • Calls displayScroll() once in setup() with the text and the speed
  • Scrolls the message from right to left across the whole display
  • Calls displayAnimate() in loop() to move the text one step at a time
  • Resets the animation so the message repeats forever
  • Note: The last number in displayScroll() is the speed in milliseconds. A smaller number scrolls faster.

For more text effects, please visit MD_Parola Library Reference.

Applications and Project Ideas

Here are some easy projects you can build with an ESP32 C3 Super Mini and an LED matrix.

  • Scrolling name badge: Show your name or a greeting on a wearable display.
  • Desk clock: Show the time on the LED matrix using Wi-Fi time from the ESP32 C3 Super Mini.
  • Weather ticker: Pull the temperature from the internet and scroll it across the display.
  • Room thermometer: Show a DHT11 or DHT22 reading in big digits.
  • Countdown timer: Display a kitchen or workout countdown that anyone can read from far away.
  • Notification board: Scroll new messages sent from your phone over Wi-Fi.

Challenge Yourself

Try these small challenges to practice with the ESP32 C3 Super Mini and the LED matrix.

  • Easy: Change the displayed text to your own name.
  • Easy: Change setIntensity() from 15 to 3 and see the display get dimmer.
  • Medium: Make a counter that shows numbers from 0 to 99, one per second.
  • Medium: Change the scroll direction to PA_SCROLL_RIGHT and change the speed.
  • Advanced: Add a push button on GPIO3 that switches between two different messages.
  • Advanced: Connect the ESP32 C3 Super Mini to Wi-Fi and scroll a message you type in a web page.

Learn More

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!