ESP32 S3 - LED Matrix

LED matrix displays, also known as dot matrix displays, are widely used in scrolling signs, clocks, and visual indicators. In this tutorial, you will learn how to connect an LED matrix to the ESP32 S3 and display scrolling text, numbers, and animated effects.

ESP32 S3 LED Matrix

What you'll build:

  1. Connect an 8x8 or 32x8 LED matrix to the ESP32 S3
  2. Display static text and numbers on the LED matrix
  3. Scroll long messages across the LED matrix display
  4. Apply animated text effects using the MD_Parola library

Hardware Preparation

1×ESP32 S3 WROOM N16R8
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

MAX7219-based LED matrices are the most popular choice for use with the ESP32 S3 due to their simple SPI interface and robust library support. Each block in a MAX7219-based LED matrix contains an 8x8 grid of 64 LEDs driven by a single MAX7219 chip, and multiple blocks can be chained together in a daisy-chain configuration to form larger displays such as 16x8 or 32x8. The ESP32 S3 controls the entire chain through just three SPI pins, and you declare the number of blocks in your code.

Key Specifications

  • A base unit of an LED matrix is a block
  • Each block has an 8x8 LED matrix (64 LED) and a MAX7219 driver
  • There are two popular block forms: the generic module and the FC-16 module
  • A LED matrix can be composed of a single block or multiple blocks in a daisy-chain
  • You can buy a pre-built multiple-block LED Matrix (e.g. 4-in-1, 8-in-1)
  • You can also buy multiple blocks and wire them to form a LED matrix with the desired size
  • You will declare the size of the LED matrix you use in the ESP32 S3 code

Pinout

LED Matrix Pinout

Each LED matrix block exposes two groups of pins — input and output — allowing multiple blocks to be chained together.

  1. Input pins group:
  • VCC: connects to 5V
  • GND: connects to GND
  • DIN: Data pin, connect to any digital pin of the ESP32 S3
  • CS: Chip Select, connect to any digital pin of the ESP32 S3
  • CLK: Clock pin, connect to any digital pin of the ESP32 S3
  1. 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

Connect the LED matrix input pins to the ESP32 S3, then chain output pins to the next block's input pins for multi-block displays. If you are using a single block, leave the output pins group unconnected.

Safety Notes

Because the LED matrix display can draw up to 1A at maximum brightness, you should not power it from the 5V pin of the ESP32 S3 alone. Use an external 5V power supply instead, and the ESP32 S3 and LED matrix can share the same 5V power adapter.

The ESP32 S3 connects to the LED matrix via SPI pins:

  • GPIO38 (SCK — clock)
  • GPIO40 (MOSI — data)
  • GPIO39 (CS — chip select, can be changed to any pin)

If the LED matrix is made of a single block:

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

This image is created using Fritzing. Click to enlarge image

The wiring diagram between ESP32 S3 8x8 LED matrix generic

This image is created using Fritzing. Click to enlarge image

If the LED matrix is a pre-built multiple-block unit:

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

This image is created using Fritzing. Click to enlarge image

If the LED matrix is made of multiple blocks wired by yourself:

  • Connect the input pins group of the first block to ESP32 S3
  • 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
ESP32 S3 32x8 LED matrix wiring FC-16 diagram

This image is created using Fritzing. Click to enlarge image

How To Program For LED Matrix

Controlling an LED matrix at the register level is complex, but the MD_Parola and MD_MAX72xx libraries make it straightforward by providing high-level functions for text display and animation effects. The following code walkthrough shows each step required to initialize and drive the LED matrix from the ESP32 S3.

  • Include libraries:
#include <MD_Parola.h> #include <MD_MAX72xx.h>
  • Specify which hardware is being used: GENERIC_HW or FC16_HW.
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
  • Define how many LED blocks are used. For example, a 4-in-1 LED matrix has 4 blocks.
#define MAX_DEVICES 4
  • Define the pin that connects to the LED matrix's CS pin. For example, pin GPIO39.
#define CS_PIN 39
  • 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);
  • Code in 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 section.

ESP32 S3 - LED Matrix Code

The following code targets a 32x8 FC-16 LED matrix display with 4 blocks, but you can easily adapt it for 8x8, 16x8, or 64x8 displays by changing the MAX_DEVICES value. Upload the sketch, and you will see text and effects appear on the matrix immediately.

/* * This ESP32 S3 code was developed by newbiely.com * * This ESP32 S3 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-s3/esp32-s3-led-matrix */ /* * This ESP32-S3 code is created by esp32io.com * * This ESP32-S3 code is released in the public domain * * For more detail (instruction and wiring diagram), visit https://esp32io.com/tutorials/esp32-s3-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 39 // 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); }

Detailed Instructions

  1. New to ESP32 S3? Complete our Getting Started with ESP32 S3 guide first.
  2. Do the wiring as shown in the diagram above.
  3. Connect the ESP32 S3 board to your PC via a USB Type-C cable.
  4. Open Arduino IDE on your PC.
  5. Select the right ESP32 S3 board and COM port.
  6. Click the Libraries icon on the left bar of the Arduino IDE.
  7. Search "MD_Parola", then find the MD_Parola library.
  8. Click 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
ESP32S3 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
ESP32S3 Dev Module on COM15
1
  1. You will be asked to install the "MD_MAX72XX" library.
  2. Click Install All button to install the dependency.
  3. Copy the above code and open it with Arduino IDE.
  4. Click Upload button on Arduino IDE to upload code to ESP32 S3.
  5. Observe the LED matrix display showing text and effects.
  6. Pro Tip: Adjust the setIntensity() value (0–15) to control brightness, and experiment with different PA_EFFECT values in MD_Parola for dozens of built-in animation effects.

ESP32 S3 LED Matrix Code – Scrolling Text

When you want to print a long message that is too long to fit on an LED matrix display, you can use the scroll text effect technique. The following ESP32 S3 code shows how to continuously scroll a message across the LED matrix display from right to left.

/* * This ESP32 S3 code was developed by newbiely.com * * This ESP32 S3 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-s3/esp32-s3-led-matrix */ /* * This ESP32-S3 code is created by esp32io.com * * This ESP32-S3 code is released in the public domain * * For more detail (instruction and wiring diagram), visit https://esp32io.com/tutorials/esp32-s3-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 39 // 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 S3", PA_CENTER, PA_SCROLL_LEFT, 100); } void loop() { if (ledMatrix.displayAnimate()) { ledMatrix.displayReset(); } }

For more text effects, please visit MD_Parola Library Reference.

Serial Monitor Output

Open the Serial Monitor at 9600 baud to observe debug messages from the ESP32 S3 as it drives the LED matrix. The following readings show typical output during initialization and display updates:

  1. [2026-01-15 09:00:01] LED Matrix initialized. Blocks: 4, Intensity: 0
  2. [2026-01-15 09:00:02] Displaying text: "Hello"
  3. [2026-01-15 09:00:05] Scroll effect started
  4. [2026-01-15 09:00:10] Animation complete, restarting loop

Applications

LED matrix displays are versatile output devices used in many real-world projects. Here are some common applications:

  1. Scrolling Message Board: Display announcements, news tickers, or status messages that scroll continuously.
  2. Digital Clock: Show time and date with large, readable digits on a multi-block LED matrix.
  3. Sports Scoreboard: Display live scores and team names in a gymnasium or event venue.
  4. Queue Management Display: Show queue numbers or ticket status in service counters.
  5. IoT Dashboard Indicator: Provide a simple visual output for sensor readings or system alerts.

Video Tutorial

Watch the step-by-step video walkthrough for this ESP32 S3 project below.

Challenges

Try these challenges to deepen your understanding of LED matrix control with the ESP32 S3.

  1. Beginner: Change the displayed text to your name and adjust the brightness using setIntensity() to find a comfortable level for your environment.
  2. Intermediate: Display the current time on the LED matrix by reading from the ESP32 S3's internal clock or an NTP server over Wi-Fi.
  3. Advanced: Build a Wi-Fi-connected scrolling message board where you can update the displayed text remotely via a simple web interface hosted on the ESP32 S3.

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!