Make a simple Arduino Game Scoreboard with 7-segment Displays

//Make a simple Arduino Game Scoreboard with 7-segment Displays

Connect and control 7 segment displays with an Arduino using the MAX7219CNG


All my content is free.

If you feel that my videos are helping and you would like to contribute, you can toss some coins in the Tip Jar via PayPal.

Select amount then click the “Donate” button.

Brainy-Bits Tip Jar Amount

I’ve used and done tutorials in the past using 7 segment displays modules.  These modules are great and easy to use since they have all the parts needed onboard.

But sometimes for a project you might need to create your own so that it fits in a case or you need to space them in a particular way, that a premade module won’t fit or even exist.

Most of the 7 segment modules use the MAX7219 led display driver IC.

One MAX7219 can control up to 64 individual leds or eight 7 Segment displays.

In this tutorial we will see how to connect two 2 digits 7 Segment display and control them with an Arduino UNO using the MAX7219.


7Segment 2 digit display

So what is a 7 segment display?

A 7 segment display is basicaly just a couple of regular LEDs behind a stencil.  Each led lights up a particular segment and by lighting a specific combination of LEDs you can represent a number or some letters.

Most 7 segment display have 8 LEDs, one for each segment and another one used for the DP (decimal point).  That’s why one MAX7219 IC can control up to eight 7 segment displays, 8×8=64 individuals LEDS.

So to connect one digit directly to an Arduino you would need 8 digital pins.  That is why you want to use a LED driver like the MAX7219 that enables you to control up to 8 digits using only 3 pins.

Most 7 Segment display are common Cathode, which mean that each LED GND pins (Cathode) are connected together and the VCC+ pins (Anode) are not.

Just like a regular LED, if you reverse the polarity it will not light up.

Here’s a diagram of the 2 digit 7 Segment display we are using in this tutorial:

2 digit 7 segment pinout

As you can see pin 1-5 and pin 6, 9 and 10 are connected to a specific segment.

Pin 7 and 8 (D1 and D2) are the common Cathode for each digit.

So by grounding D1 or D2 you select which digit you want to lit up a specific segment.

Of course like any LED you need to use a resistor to limit the amount of current drawn by the LED.  But since we will be using the MAX7219 we will only need one resistor.


Although the MAX7219 is not the only LED driver available it’s probably the easiest to use and can control many LEDs using only one chip.


The connections are clearly identified, all you have to do is connect them to the correct pins on the 7 segment display.

You then have 3 pins to connect to the Arduino.

In addition you will need a resistor to limit the current drawn by the LEDs of the 7 segment.

Last you might want to connect some capacitors to filter out the noise from the power supply, but this is optional since I’ve built many of these without using them and never had a problem, but this is from the realm of “This is good practice”.

If you look closely you can see the pins DIG 0 through DIG 7, these are the selectors for which digit you want to select.

In our tutorial we will be using 4 of them since we have four digits.

To have a better idea on how everything is connected check out the diagram below which shows all the connections including the 10K resistor and the noise filtering capacitors.


Arduino 7 segment MAX7219 schematic

In this tutorial we have two 2 digits 7 segment, and two switches.  Each switch control one of the 7 segment to increase the value displayed when clicked.

You start by connecting the corresponding pins from the MAX7219 to the first 7 Segment, this includes D0 and D1 pin, then you connect the pins from the first 7 Segment to the second 7 Segment, but this time you connect the D2 and D3 pins from the MAX7219.

Since this tutorial has many connections, look at the diagram closely to see were everything is connected.

Don’t forget to put the 10K resistor between the MAX7219 “ISET” pin and the 5V power to prevent overcurrent.


We are using the “LedControl” library to communicate with the MAX7219 from the Arduino.

This library can be used with LED matrix or with 7 Segment displays.

In this tutorial when we click a switch, the corresponding display will increase by one, kinda like a scoreboard.

As alway check out the tutorial video to get more information.

/* Arduino 7 Segment scoreboard 
 * Using the MAX7219CNG LED Driver
Created by Yvan /

This code is in the public domain...

You can: copy it, use it, modify it, share it or just plain ignore it!


#include "LedControl.h"  // Library used for communcation with 7 segment

LedControl lc=LedControl(12,11,10,1);  //  (DIN, CLK, LOAD, number of Max7219 chips)

// Variable to hold current scores
int displayone=0;
int displaytwo=0;

// Variables to split whole number into single digits
int rightdigit;
int leftdigit;

// Switches pin connection to Arduino UNO
#define switchone 2
#define switchtwo 3

void setup() {
  lc.shutdown(0,false);  // Wake up MAX7219

  lc.setIntensity(0,7);  // Set brightness to medium

  lc.clearDisplay(0);  // Clear all displays connected to MAX7219 chip #

// Put zeros on both displays at startup
  lc.setDigit(0,0,0,false);  // (Max7219 chip #, Digit, value, DP on or off)


void loop() { 

  // If switch 1 is clicked
  if (!digitalRead(switchone)) {
    displayone++;  // Increase score by 1
    // convert whole number to single digits

    // Display extracted digits on the display

    // Wait until switch is released to continue
    while (!digitalRead(switchone)) { 
    delay(5);  // Small delay to debounce the switch

    if (!digitalRead(switchtwo)) {


    while (!digitalRead(switchtwo)) { 

Copy and Paste the above code/sketch in your Arduino IDE software.

Donwload the LedControl library here:

By | 2018-04-18T13:58:02-04:00 March 26th, 2018|Tutorials|


  1. steve February 25, 2020 at 10:25 am - Reply

    hi there,am a little bit behind on this part of the code,kindly asking for an explanation

    convert whole number to single digits

  2. David January 13, 2020 at 7:34 pm - Reply

    Hi there, I wonder if you can make a Timer countdown with keypad to add at this awesome scoreboard, I try to do something like that, but I can’t get it, I have a timer which works fine, but I can get working with keypad to put the time that I want..

    any advise?

  3. Nate March 5, 2019 at 11:21 am - Reply

    Please HELP!
    I’ve been trying to build this scoreboard project for some time where I then want to modify it to work off a IR beam break rather then a button(s).
    However My attempts have all had the same result. When I upload the program nothing happens. Im getting all the segments and dismals to light up and stay on and thats all that happens.
    Ive checked all the connections several times and tried multiple max 7219 (incase one was bad) can you help maybe point me to the right directions to where I should look for the problem no matter how insignificant. Im very new to working with an Arduino but this seemed very straight forward and exactly what I needed.
    thank you

  4. Jerry Rodgers November 8, 2018 at 3:27 pm - Reply

    First of all GREAT tutorial. I’m going to try this project to use as a shuffleboard scoreboard. I would like to have a switch to lower each score as well as a button to reset both scores as well. Is there anyone that could assist with the code? I’ve never used an arduino board and am not familiar with coding. I’m gathering the parts at the moment and hope to get started quickly, Thanks!

    • Michael July 19, 2019 at 8:12 pm - Reply

      Hello, I have the same idea. Have you tried to make this already? I have tried numerous times but the LEDs don’t seem to light up. Did it work for you? And did you figure out how to put a reset button in

  5. Hardik Trivedi October 15, 2018 at 8:59 am - Reply

    I’m using four 1 digit displays since I can’t find those 2 digit ones, so is there any change in the code for that?
    Would be pleased for fast reply.
    Thank you..

  6. Tim August 20, 2018 at 1:53 pm - Reply

    My comment is more of a question than a comment. First off nice video this concept makes sense to me and was informative where as others have to much jargon. I am a complete noob at this ( as in first and probally only project) and want to build this exact thing except using buttons for longevity instead of switches. Would I have to rewrite part of the code or change the wiring at all? Maybe I’m overcomplicating this but your switch has three pins and most buttons have two or four. Please help. Thanks.

  7. gouveia July 22, 2018 at 8:45 am - Reply

    tem como eu colocar um botão para decrementar o numero

  8. Jonzy59 June 21, 2018 at 2:45 pm - Reply

    This is very helpful wow! I was just wondering if it is possible to make this scoreboard count down? To add code which will count down, for example from “14” to “13”, do I need to add two more switches (say, switchfour & switchfive), then write a line of code which says (for both swritchfour & switchfive):

    if (!digitalRead(switchfour)) {

    displayone–; // Decrease score by 1

    // convert whole number to single digits

    // Display extracted digits on the display

    // Wait until switch is released to continue
    while (!digitalRead(switchone)) {
    delay(5); // Small delay to debounce the switch

    I’m not sure about the code from the bottom half, do you think you could help?

    • Gary Gallant July 10, 2018 at 9:49 am - Reply

      Same here I would like to see a code for counting down as well any chance you figured this out?

    • @cK! June 14, 2020 at 12:36 am - Reply

      Wouldnt the script read:
      ….. Displayone%-10…
      ….. Displayone%-100…
      (For every time the additional switches/buttons (both are types of “Triggers”) 3 & 4 are activated)
      (The reset switch is on the blue arduino board)

  9. Arthur Manley April 17, 2018 at 4:57 pm - Reply

    This article says that the MAX7219 is a driver for a “common-anode” display. All the literature I have read says the MAX7219 is for “common-cathode” display. Which way is correct? Does it drive common-anode OR common-cathode ?
    And does this change the 7 segment display to common-cathode ? Does the Arduino code stay the same ? A bit confusing to me. Thanks for your reply.

    • brainy-bits April 18, 2018 at 1:55 pm - Reply

      Great catch! The MAX7219 is common-cathode, and the most 7 segment displays are common-cathode as well. The one we are using in this tutorial is common-cathode. I’ve updated the tutorial page to reflect these changes.

      Thank you for letting me know of this. I guess I must have been tired when writing the article are got anode and cathode confused 🙂

Leave A Comment