Arduino Nano - 8 Digit Segment Display

About: " Work until you no longer have to introduce yourself " Show some love on Instagram @it.is.prem & Motivate me on YouTube @TheCircuit

The MAX7219 is a popular serial LED driver that is popularly used with micro-controllers and Arduino community has a built-in library, which makes easy to work with it. The MAX7219 works with Dot Matrix Display's and Seven Segment Display's and you can connect multiple of them in a chain to create a bigger display, by just simply using up only 3-pins of the Arduino.

In this Instructable, I'm going to show you How to get started Seven Segment Display with the MAX7219 IC.

Step 1: Components Required

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 this project is very simple as there are only three connections to be made from the Arduino to the MAX7219 IC.

The connections are as follows:

  1. MAX7219 CLK > Arduino Digital Pin2
  2. MAX7219 CS > Arduino Digital Pin3
  3. MAX7219 DIN > Arduino Digital Pin4
  4. MAX7219 GND > Arduino GND
  5. 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 pin combination you selected.

Step 3: Let's Write Code

The code for this project can be found below, you will need to install the IDE and the LED Contol Library it can be downloaded from here.

https://github.com/wayoda/LedControl

Make sure you add it in 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 setup, Copy & Paste the code from below.

#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: TADAAA!! Here's the Output

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

That's all Folks.

Follow me!! DM me if you have any doubts or any project requirements, happy to work as a freelancer.

Share

    Recommendations

    • Paper Contest

      Paper Contest
    • Warm and Fuzzy Contest

      Warm and Fuzzy Contest
    • Faux-Real Contest

      Faux-Real Contest

    Discussions