8 Digit Seven Segment Display - Arduino Nano




About: I love DIY Electronics

The MAX7219 is a popular serial LED driver that is popularly used with micro-controllers and arduino has a community built Library, which makes easy to work with it. The MAX7219 works with Dot Matrix displays and Seven segment displays and you can connect multiple of them in a chain to create a bigger display. While using up only 3 of the arduino Pins.

In this instructable I'm going go show you How to get started seven segment displays with the MAX7219 IC.

Step 1: Tools and Components

Here is what you need to proceed with this project

  • Arduino Nano
  • Breadboard
  • MAX7219 Based 8 Digit seven segment display
  • Connecting Wires

Step 2: Circuit

The circuit is of the is project is simple as there only three connections to be made from the arduino to the Max7219 IC. The connections goes as follows

  • Max7219 CLK => Arduino digital pin2
  • Max7219 CS => Arduino digital pin3
  • Max7219 DIN => Arduino digital pin4
  • Max7219 GND => Arduino GND
  • Max7219 VCC => Arduino 5V

The pins can be changed to any Digital pins of your choice, make sure make the respective changes in the code based on the the pin combination you selected.

Step 3: Code

The code for this project can be found below, you will need to install the Arudino IDE and the LEDContol Library it can be downloaded from here. Make sure you add it to the right path to get it working with the IDE. The library also contains examples you could try the seven segment example too, but the code is written only for 4 digits seven segment display. After you have got the arduino IDE IDE setup copy the paste from below and paste it in the arduino IDE.

#define MAX7219_DIN 4
#define MAX7219_CS 3
#define MAX7219_CLK 2

void initialise() { digitalWrite(MAX7219_CS, HIGH); pinMode(MAX7219_DIN, OUTPUT); pinMode(MAX7219_CS, OUTPUT); pinMode(MAX7219_CLK, OUTPUT); }

void output(byte address, byte data) { digitalWrite(MAX7219_CS, LOW); shiftOut(MAX7219_DIN, MAX7219_CLK, MSBFIRST, address); shiftOut(MAX7219_DIN, MAX7219_CLK, MSBFIRST, data); digitalWrite(MAX7219_CS, HIGH); }

void setup() { // put your setup code here, to run once: initialise(); output(0x0f, 0x00); //display test register - test mode off output(0x0c, 0x01); //shutdown register - normal operation output(0x0b, 0x07); //scan limit register - display digits 0 thru 7 output(0x0a, 0x0f); //intensity register - max brightness output(0x09, 0xff); //decode mode register - CodeB decode all digits output(0x08, 0x0c); //digit 7 (leftmost digit) data output(0x07, 0x0b); output(0x06, 0x0d); output(0x05, 0x0e); output(0x04, 0x08); output(0x03, 0x07); output(0x02, 0x06); output(0x01, 0x05); //digit 0 (rightmost digit) data


void loop() { // put your main code here, to run repeatedly:


Step 4: Going Further

And now you should have the seven segment working, to go further you could try a seven segment generator and generate what you want to be displayed on the display.



    • Big and Small Contest

      Big and Small Contest
    • First Time Author

      First Time Author
    • Toys Contest

      Toys Contest

    3 Discussions


    1 year ago

    Thank you for this! Of all the 8-digit 7-segment display examples, this is the only one that I have ever been able to get to compile. Now I know that at least my displays are working!


    1 year ago

    hi so i dont know how to code and i would just like to be able to help8765 on it can anyone post the code for it? (also if anyone cna explane to me how the code works that would be great)