Whether you’re making a countdown timer, a score counter, a sensor dashboard, or a temperature display, you need a simple way to show numbers that people can read at a glance. A 4-digit TM1637 display is great for such projects, and we already have a detailed tutorial on that module if you want to start there. But sometimes four digits just are not enough.
That is when the MAX7219 8-Digit 7-Segment Display becomes really useful. It gives you eight digits to work with, and it only needs three data pins from your Arduino. Even better, it supports daisy-chaining, so you can connect multiple modules together and build much larger displays while still using only three data pins on your Arduino.
In this tutorial, we’ll walk through how the MAX7219 display works, how to connect it to an Arduino, and how to write simple code to display numbers, text, and individual characters.
Let’s get started and bring those digits to life!
Hardware Overview
This MAX7219 module combines two 0.36-inch 4-digit 7-segment displays with the MAX7219 LED driver chip made by Analog Devices. This cool combination is perfect for projects where you need to display numbers, like timers, counters, sensor readings, or temperatures.


The module communicates via SPI and lets you control all eight digits using just three SPI pins from your microcontroller.
One of the best things about the MAX7219 is that it handles refreshing the display on its own. All you need to do is send simple commands through SPI. Once the chip receives your data, it handles refreshing the display by itself—up to 800 times per second—and keeps the brightness of the LEDs steady. This frees up your microcontroller to handle other important tasks.
The MAX7219 chip includes some awesome features:
- Power-saving mode: You can turn off the display when not needed to save energy.
- Startup safety: The chip keeps all LEDs off for the first few seconds when powering up, preventing random flickering or strange patterns during startup.
- Daisy-chaining: If you want a larger display, you can connect multiple MAX7219 modules together using the same three SPI data wires.
Adjusting Brightness and Current
The MAX7219 chip allows you to adjust the brightness of the display in two different ways: through hardware or through software. Let’s explore both methods.
Hardware Brightness Control
On your MAX7219 module, you’ll find a resistor labelled R1. This resistor controls the amount of current that flows through each LED, which directly affects the overall brightness of the display.

Different 7-segment displays need different resistor values depending on what type of LEDs they use. The table below shows which resistor values to use, based on the voltage and current needed by the LEDs in your display.
| Target Peak Segment Current (ISEG) | Required R1 at Vf=1.5V | Required R1 at Vf=2.0V | Required R1 at Vf=2.5V | Required R1 at Vf=3.0V | Required R1 at Vf=3.5V |
| 40 mA | 12.2 | 11.8 | 11.0 | 10.6 | 9.69 |
| 30 mA | 17.8 | 17.1 | 15.8 | 15.0 | 14.0 |
| 20 mA | 29.8 | 28.0 | 25.9 | 24.5 | 22.6 |
| 10 mA | 66.7 | 63.7 | 59.3 | 55.4 | 51.2 |
Your MAX7219 module already has the R1 resistor populated, usually with a 10 kΩ SMD resistor. You only need to change this resistor if you want to set a different hardware limit for the peak segment current going into the LEDs.
Software Brightness Control
The MAX7219 also offers software-based brightness control via the internal intensity register. Although this might sound a bit complicated, the process is actually quite straightforward. Most libraries simplify this into a single command. We’ll show you exactly how to do this later in the tutorial when we start programming the display.
MAX7219 8-Digit 7-Segment Display Module Pinout
The module two sets of pins:

Input Connector
These are the pins you use to connect the module to your microcontroller (like an Arduino):
VCC is the power supply pin. Connect it to a 4V to 5.5V power source. Since the display can use quite a lot of power, it’s best to use a separate power supply. If you want to use the Arduino’s 5V pin instead, keep the brightness low (below 25%) to avoid overheating the voltage regulator.
GND is the ground pin. This needs to be connected to the common ground.
DIN is the data input pin, which receives serial data from the Arduino. It can be assigned to any available digital pin on your Arduino.
CS is the chip select pin, used to enable communication with the module. This also connects to a digital pin on your Arduino.
CLK is the clock pin, which synchronizes data transfer by receiving pulses from the Arduino. This also connects to a digital pin on your Arduino.
Output Connector
The second set of pins is used when you want to connect multiple displays together in a chain (daisy-chaining):
VCC connects to the VCC pin on the next module.
GND connects to the GND pin on the next module.
DOUT is the data output pin and connects to the DIN pin on the next module.
LOAD connects to the CS pin on the next module.
CLK connects to the CLK pin on the next module.
Connecting the MAX7219 8-Digit 7-Segment Display to an Arduino
Now that we’ve learned how the MAX7219 module works, it’s time to connect it to an Arduino and get it running!
Start by connecting the VCC pin of the module to the 5V output on the Arduino, and the GND pin to one of the Arduino’s ground (GND) pins.
Next, we’ll connect the pins used for SPI communication. Connect the DIN pin to digital pin 12 on the Arduino, the CS pin to digital pin 11, and the CLK pin to digital pin 10.
Here’s a quick reference table for the pin connections:
| MAX7219 Module | Arduino | |
| VCC | 5V | |
| GND | GND | |
| DIN | 12 | |
| CS/LOAD | 11 | |
| CLK | 10 |
Here’s how to wire up the module:

Daisy-Chaining Multiple Displays
If you want to create a larger display using multiple MAX7219 modules, you can easily daisy-chain them together. Just connect the DOUT pin of the first module to the DIN pin of the next module. Then share the VCC, GND, CLK, and CS connections across all displays.

Library Installation
Writing all the code for controlling the MAX7219 display from scratch would be complicated and time-consuming. Fortunately, there’s a helpful library called MAX7219 that makes things much easier.
To install the library,
- First open your Arduino IDE program. Then click on the Library Manager icon on the left sidebar.
- Type “max7219” in the search box to filter your results.
- Look for max7219 Library by Jonathan Evans.
- Click the Install button to add it to your Arduino IDE.

Arduino Example – Basic Test Program
The following is a basic test program that goes through a bunch of different routines, so we can quickly check whether the module is working properly and also understand how text, numbers, characters, and positions behave on the display.
Give it a try; we’ll go over how the code works in a moment.
#include <max7219.h>
MAX7219 max7219;
void setup() {
max7219.Begin();
}
void loop() {
String temp;
char temp2[8];
int y;
//DisplayText Demo
max7219.DisplayText("95.67F", 1); //1=Right justified
delay(1000);
max7219.Clear();
max7219.DisplayText("95.67F", 0); //0=Left justified
delay(1000);
max7219.Clear();
//Counter with decimals
//slow counter
for (float x = 0; x < 1; x = x + 0.1) {
temp = String(x);
temp.toCharArray(temp2, temp.length());
max7219.DisplayText(temp2, 1);
delay(500);
}
//fast counter
for (float x = 0; x < 500; x++) {
temp = String(x);
temp.toCharArray(temp2, temp.length());
max7219.DisplayText(temp2, 1);
}
delay(500);
//Display Char Demo
max7219.Clear();
max7219.DisplayChar(7, 'H', 0); //Position 7 is on the left of the display
delay(500);
max7219.DisplayChar(6, 'E', 0);
delay(500);
max7219.DisplayChar(5, 'L', 0);
delay(500);
max7219.DisplayChar(4, 'L', 0);
delay(500);
max7219.DisplayChar(3, 'O', 0);
delay(500);
max7219.DisplayChar(2, '1', 0);
delay(500);
max7219.DisplayChar(1, '2', 0);
delay(500);
max7219.DisplayChar(0, '3', 0);
delay(500);
max7219.Clear();
//Count front the right
for (int x = 0; x < 8; x++) {
max7219.DisplayChar(x, '0'+x, 0);
delay(500);
}
max7219.Clear();
delay(500);
//Count from the left
for (int x = 7; x >= 0; x--) {
max7219.DisplayChar(x, '7'-x, 0);
delay(500);
}
max7219.Clear();
//Count from the right
for (int x = 0; x < 8; x++) {
max7219.DisplayChar(x, '0' + x, 0);
delay(500);
max7219.Clear();
}
delay(500);
//Count front the left
for (int x = 7; x >= 0; x--) {
max7219.DisplayChar(x, '7'-x, 0);
delay(500);
max7219.Clear();
}
}Demonstration
Once you upload the sketch to your Arduino, you should see:
Code Explanation
The sketch starts by including the max7219.h library, which gives us all the functions we need to talk to the display module.
#include <max7219.h>After that, we create an object named max7219. This object is what we will use throughout the program to control the display.
MAX7219 max7219;Inside setup(), we call the Begin() function to wake up the display and get it ready to receive our instructions.
void setup() {
max7219.Begin();
}At the beginning of loop(), we create two variables to hold our data. We use temp to store numbers as text, and temp2 as a character array because the display function expects text in that format.
String temp;
char temp2[8];Next, we use the DisplayText(Text, Justification) function to show "95.67F" on the display. This function lets you push a complete string or number to your 8-digit display all at once.
It really only needs two specific pieces of information to work: the actual text you want to show (which can hold up to 8 characters, plus up to 8 decimal points), and your preferred alignment. You simply pass a 0 to justify the text to the left, or a 1 to align it to the right.
max7219.DisplayText("95.67F", 1); //Right justified
delay(1000);
max7219.Clear();We then pause for a second so we can easily read it, and then we clear the screen using the Clear() function.
After that, we display the same text, but we pass a 0 instead to push the text over to the left side.
max7219.DisplayText("95.67F", 0); //Left justified
delay(1000);
max7219.Clear();From there, we move on to building some counters.
We first set up a slow counter using a float variable that goes from 0 up to 1 in increments of 0.1. Inside this loop, we take that number, turn it into a String, and then convert it into our character array because that is the specific format the display expects. We print it to the right side and wait half a second between each update so we can watch it count.
for (float x = 0; x < 1; x = x + 0.1) {
temp = String(x);
temp.toCharArray(temp2, temp.length());
max7219.DisplayText(temp2, 1);
delay(500);
}Next, we run a faster counter that goes from 0 to 500. We use the exact same conversion method, but we leave out the delay inside the loop. This lets the numbers fly by as fast as the Arduino can process them.
for (float x = 0; x < 500; x++) {
temp = String(x);
temp.toCharArray(temp2, temp.length());
max7219.DisplayText(temp2, 1);
}
delay(500);After clearing the screen again, we start playing with individual characters. We spell out "HELLO123" one letter at a time.
For this, we use the DiaplayChar(Digit, Char, Decimal) function, which lets us write to specific digits on the display. This function expects three inputs, the target position number (where 7 corresponds to the far left of the display and 0 corresponds to the far right), the actual character you want to show, and finally, a flag to turn the decimal point on or off (0 for off, 1 for on).
max7219.Clear();
max7219.DisplayChar(7, 'H', 0); //Position 7 is on the left of the display
delay(500);
max7219.DisplayChar(6, 'E', 0);
delay(500);
max7219.DisplayChar(5, 'L', 0);
delay(500);
max7219.DisplayChar(4, 'L', 0);
delay(500);
max7219.DisplayChar(3, 'O', 0);
delay(500);
max7219.DisplayChar(2, '1', 0);
delay(500);
max7219.DisplayChar(1, '2', 0);
delay(500);
max7219.DisplayChar(0, '3', 0);
delay(500);
max7219.Clear();Finally, we have a few counting animations.
We run a loop from 0 to 7, and we use the character ‘0’ and add our loop counter to it. Since position 0 is on the far right, we end up populating the display with numbers moving from right to left.
for (int x = 0; x < 8; x++) {
max7219.DisplayChar(x, '0'+x, 0);
delay(500);
}Then, we flip the math and count backwards from 7 down to 0, which prints our numbers moving from left to right.
for (int x = 7; x >= 0; x--) {
max7219.DisplayChar(x, '7'-x, 0);
delay(500);
}Finally, we run those same two loops again, but this time we clear the screen right after printing each number. Instead of leaving the numbers sitting on the screen, we create an effect where a single number travels across the display, first from right to left, and then from left to right.
for (int x = 0; x < 8; x++) {
max7219.DisplayChar(x, '0' + x, 0);
delay(500);
max7219.Clear();
}
for (int x = 7; x >= 0; x--) {
max7219.DisplayChar(x, '7'-x, 0);
delay(500);
max7219.Clear();
}
