4-Digit 7-Segment LED Display + Arduino

415,654

133

68

Introduction: 4-Digit 7-Segment LED Display + Arduino

I recently got a 4-Digit 7-Segment LED Display from Sparkfun, and couldn't wait to use it. Here, I will show you how to wire it, and some sample programs to use with it!

Step 1: Display Info

This is the way the display works. It's multiplexed, so you select the digit by setting its pin (we'll get into pins later) HIGH, and you select the segment by setting its pin LOW. You display multiple digits at once by rapidly cycling through them.
The Pins (digits are numbered from the left):
Digit 1: 1
Digit 2: 2
Digit 3: 6
Digit 4: 8

Segment A: 14
Segment B: 16
Segment C: 13
Segment D: 3
Segment E: 5
Segment F: 11
Segment G: 15

Decimal Point: 7

Step 2: Wiring the Display and Button

Now, to wiring! To make it easier for you, I am going to put the Arduino pin number first, then the display's pin number.

1--14
2--16
3--13
4--3
5--5
6--11
7--15
8--7
9--1 (resistor)
10--2 (resistor)
11--6 (resistor)
12--8 (resistor)

If this is too confusing, say so in the comments, and I'll rewrite it.
Connect the button to Arduino pin 13 and 5V.
I used 1K resistors, but you could get away with less.

Step 3: Programming

I'm pretty much just putting refrence links and files here.

Display Datasheet


Timer Program (I modeled my timer after this)


Attatched Files:

_4segTimer: Timer program

_4digitAni1: Animations

The programs still need some tweaking/additions, so I'll be updating them once in a while.

Update History:


LED Contest

Participated in the
LED Contest

Be the First to Share

    Recommendations

    • For the Home Contest

      For the Home Contest
    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge
    • Big and Small Contest

      Big and Small Contest

    68 Comments

    0
    tmahundrah
    tmahundrah

    6 years ago

    i got it working, it is a 4 digit seven segment i got from an old DSTV Decorder, and controlling it over the serial monitor

    0
    pugonfireyt
    pugonfireyt

    Reply 1 year ago

    Haha, me too lmao

    What a coincidence

    Keep in mind that there are two kinds of 7-segment displays, common anode and common cathode. If you have a different type then Jimmacle, then this won't work for you. The one that Jimmacle used here is a common anode if the link to the spec sheet is correct. I have two different Amazon starter kits and they are both common cathode. I will try to post a tutorial soon on how to do common cathode, but here's the general idea:
    Looking at the display if you number the pins like this:
    1 2 3 4 5 6

    7 8 9 10 11 12
    Then you should connect like this:
    Pin 1 goes through a 220 ohm resistor to pin 10 on the arduino and is called D4
    Pin 2 goes to pin 9 on the arduino and controls segment A
    Pin 3 goes to pin 8 on the arduino and controls segment F
    Pin 4 goes through a 220 ohm resistor to pin 11 on the arduino and is called D3
    Pin 5 goes through a 220 ohm resistor to pin 11 on the arduino and is called D2
    Pin 6 goes to pin 2 on the arduino and controls segment B
    Pin 7 goes to pin 6 on the arduino and controls segment E
    Pin 8 goes to pin 5 on the arduino and controls segment D
    Pin 9 is used for the decimal and I'm not using that
    Pin 10 goes to pin 4 on the arduino and controls segment C
    Pin 11 goes to pin 3 on the arduino and controls segment G
    Pin 12 goes through a 220 ohm resistor to pin 13 on the arduino and is called D1

    With common cathode, your D1, D2, D3, D4 calls are reversed. For example, if you want to display a numeral on the 2nd digit, put:
    digitalWrite(D1, HIGH);
    digitalWrite(D2, LOW);
    digitalWrite(D3, HIGH);
    digitalWrite(D4, HIGH);

    Then, if you want to display the number "0" (all of the LEDs lit except "G"), then put
    digitalWrite(pinA, HIGH);
    digitalWrite(pinB, HIGH);
    digitalWrite(pinC, HIGH);
    digitalWrite(pinD, HIGH);
    digitalWrite(pinE, HIGH);
    digitalWrite(pinF, HIGH);
    digitalWrite(pinG, LOW);

    See the image below of a "2" being displayed in the third digit.

    0611191400_resized.jpg
    0
    gasper1
    gasper1

    5 years ago

    hello again,still no success in getting the sketch to start counting.I am using a UNO v3 with a 5461A5 type readout.12 pin

    Im sure it must be something simple that is causing it to non start.

    0
    gasper1
    gasper1

    5 years ago

    Can you give me some idea's why I can't get the digits to start counting. I am sure i am working with the correct code, as the other code works well.but I cannot get this start counting.All my connections are correct.

    please help make an old happy !!.

    Please help

    0
    blackburdtx
    blackburdtx

    6 years ago

    There are only 12 pins on the display but your connecting pin 1 on the Ard to pin 14 on the display.... very confusing.

    0
    run7
    run7

    Reply 5 years ago

    same here

    0
    robertje
    robertje

    Reply 5 years ago

    some down in the comments:

    1--10 (a)
    2--7 (b)
    3--4 (c)
    4--2 (d)
    5--1 (e)
    6--11 (f)
    7--5 (g)
    8--3 (dot)
    9--12 (resistor) (d1)
    10--9 (resistor) (d2)
    11--8 (resistor) (d3)
    12--6 (resistor) (d4)

    10 and 11 reversed for me

    Tip: If you have 12-pin segment display your scheme will be like this:

    1--10 (a)
    2--7 (b)
    3--4 (c)
    4--2 (d)
    5--1 (e)
    6--11 (f)
    7--5 (g)
    8--3 (dot)
    9--12 (resistor) (d1)
    10--9 (resistor) (d2)
    11--8 (resistor) (d3)
    12--6 (resistor) (d4)

    0
    robertje
    robertje

    Reply 5 years ago

    Used the same, except of 10 and 11, I reversed it. Using (sh)5461as panels.

    0
    aseppermana
    aseppermana

    6 years ago

    i has download it,but cant open in arduino IDE because that file is not pde

    0
    KarissaA1
    KarissaA1

    6 years ago

    Does the 4 digit file is the part one of the Segment?

    0
    EligijusJ
    EligijusJ

    7 years ago

    I dont get it how to wiring ?! Can anyone sent schematics or smth ? Thank You :)

    0
    DavidB552
    DavidB552

    Reply 6 years ago

    yeah could we get a digram ?

    0
    ArcAiN6
    ArcAiN6

    6 years ago

    People should also be aware that there are differences when wiring CC (Common Cathode) and CA (Common Anode) 7-Segment displays, as well as addressing them with the code, or using shift registers / led drivers.

    0
    PaulW106
    PaulW106

    7 years ago

    To get the timer to work do I just copy and paste the file into the Arduino program?

    0
    npegnato
    npegnato

    7 years ago on Introduction

    Could I possibly get a list of comments for what's happening in either the timer or animation program? I'm using a 4 digit display for a heart rate monitor and I want to know how I can display the BMP from my Arduino.

    0
    kittekaak1
    kittekaak1

    8 years ago on Introduction

    It runs also with an ULN 2803 instad of the 4 transistors. where can i buy in europe the sma420564 ? I have only one in my arduino kit. mfg CK