Introduction: Seven Segment Display Tutorial

Picture of Seven Segment Display Tutorial

How many TV shows and movies have some mysterious device counting down to zero those displays are 7 segment displays.With the 7 segment displays you can display any number or some alphabets that your heart desires.

At first controlling a 7 segment display seems quite complex but it quickly becomes clear.

What follows is a quick guide to control a 7 segment display with a arduino board

If you want to jump ahead to any other part here's your chance:

Step 1 - What Is A Seven Segment Display?
Step 2 - Parts & Tools
Step 3 - Testing
Step 4 - Built The Circuit
Step 5 - Project 1- One Digit Count Down Timer
Step 6 - Multiplexing
Step 7 - Project 2 - Two Digit Count Down Timer

This instructable is a entry in the arduino contest so if you like it please vote.

Step 1: What Is a Seven Segment Display?

Picture of What Is a Seven Segment Display?

A seven-segment display (SSD), or seven-segment indicator, is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot-matrix displays. Seven-segment displays are widely used in digital clocks, electronic meters, and other electronic devices for displaying numerical information.A seven segment display, as its name indicates, is composed of seven elements. Individually on or off, they can be combined to produce simplified representations of the arabic numerals.The seven segments are arranged as a rectangle of two vertical segments on each side with one horizontal segment on the top, middle, and bottom. Additionally, the seventh segment bisects the rectangle horizontally. There are also fourteen-segment displays and sixteen-segment displays (for full alphanumerics

Step 2: Parts & Tools

Picture of Parts & Tools

~ 2 x Seven Segment Display (Common Cathode)- Red,Blue
~ 1 x 330 ohm resistor -
~ Arduino Uno(Or equivalent) -
~ Breadboard -
~ Some jumper wires -

~ The arduino programming Environment -
~ USB Cable A-B -
~ Soldering Iron -
~ Solder Wire - Leaded or Lead Free
The total cost should be about 8.10 $ assuming that you have a arduino,breadboard and all the tools

Step 3: Testing the Display

Picture of Testing the Display

Before we connect the seven segment display to our arduino its a good idea to give it a test.

Consult the datasheet of your display for the PIN-OUT and other specs

Wire up your display for testing
~Plug the display into your breadboard
~Connect the two common cathodes together and attach a resistor to them
~Connect the common cathode resistor to the -5v
~Test each segment by connecting its pin to +5v
~Experiment and try to make different numbers by lighting one or more segments at the same time 

Step 4: Built the Circuit

Picture of Built the Circuit

Now lets move on to controlling the seven segment display with the arduino.

The circuit is pretty straight forward connect the common cathode's to gnd with a 330 ohm current limiting resistor. Connect the seven segment displays pin number 7(A) to arduino pin2 , 6(B) to arduino pin3 , 4 (C) to arduino pin 4 , 2 (D) to arduino pin5 , 1 (E) to arduino pin6 , 9 (F) to arduino pin7 , 10 (G) to arduino pin8 , 5 (DP) to arduino pin9.For the 2nd project first make the multiplexing circuit below and then follow these connections pattern.Segment A to pin 7, Segment B to pin 8, Segment C to pin 4, Segment D to pin 3, Segment E to pin 2, Segment F to  pin 6, Segment G to pin 5, Gnd1 via resistor to pin 11, Gnd2 via resistor to pin 9.

I have also included the fritzing digram(The worst you can get as I am not good at making circuit diagrams)  for the multiplexed circuit and the simple circuit and pinout of the seven segment display .

Step 5: Project 1- One Digit Count Down Timer

Picture of Project 1- One Digit Count Down Timer

The first project we are going to do is one digit count down timer.This project will count down from nine to zero.This project does not use any multiplexing but the project 2 includes multiplexing.The circuit digram can be found on step four.

To get started and get playing with this just follow the following these simple steps.
~ Copy or download the code below and paste it in an empty arduino sketch
~ Compile the sketch and upload it to your board. If any problem occurs feel free to ask
~ And now enjoy your count down timer.
~ I have included two files the first one is a compact verson of the  code and the second one is the longer more longer one but is really easy to understand.

Here is a short video of it in action:


Step 6: Multiplexing

Picture of Multiplexing

In the technique of multiplexing the entire display is not driven at one time. Instead, sub-units of the display (typically, rows or columns for a dot matrix display or individual characters for a character orientated display, occasionally individual display elements) are multiplexed, that is, driven one at a time, but the electronics and the persistence of vision combine to make the viewer believe the entire display is continuously active.In senven segment displays the various segments of each character are connected in a two-dimensional matrix and will only illuminate if both the "row" and "column" lines of the matrix are at the correct electrical potential. The light-emitting element normally takes the form of a diode so electricity will only flow in one direction, keeping the individual "row" and "column" lines of the matrix electrically isolated from each other.

A multiplexed display has several advantages compared to a non-multiplexed display:
~Fewer wires (often, far fewer wires) are needed
~Simpler driving electronics can be used
~And both lead to reduced cost
~Reduced power consumption

For information please refer to this page

Step 7: Project 2 - Two Digit Count Down Timer

Picture of Project 2 - Two Digit Count Down Timer
In the first project we made a one digit count down timer but now its time to move to the next level.This project counts down from twenty to zero.The two seven segment displays are multiplexed to reduce the number of I/O pins used.The circuit digram can be found on step four.

To get started and get playing with the count down timer just follow these simple steps:
~ Copy or download the code below and paste it in an empty arduino sketch
~ Compile the sketch and upload it to your board. If any problem occurs feel free to ask
~ And now enjoy your count down timer.

Here is a short video of it in action:


Step 8: Final Thoughts

Picture of Final Thoughts

 By this point of time you have mastered controlling a seven segment display all that is left is comming up with ideas on how to use it.A seven segment display can be used for various purposes.Some other applications can be found here.Hope this project inspires further experimentation.Dont forget to follow mores comming up.

I have lots of plans for the displays.If you make something innovative please post some pictures or E-mail me at


IvanH3 (author)2017-06-11

Halo @Bot1398,

Thank you for your helpful tutorial.

I learnt the pin configurations of the 7 segment LED & how to wire it up on the bread board.

Specifically, Steps 3 & 4 are very helpful.

Here's a YouTube video:, thank you for your help.

Inuate (author)2016-04-22

I wired the displays but Im having hard time wiring arduino to displays because it's pretty hard to see which wire goes where. Anyone knows how to wire it and is willing to tell me I'd appriciate it.

SamuelQ2 (author)2016-04-14

Thanks for you tutorial, I made it and It worked for me but I used a lot of pins, so I tried with a decoder BCD to 8 Segments(7447) but also I need to use 4 pins and I need them for other input devices. Finally I'm using a TM1637, in this case i just need 2 pins and the device is cheaper ;). Regards!!

YoYoKulbirSingh (author)2016-01-29


I am very happy that you have used an indian coin !

Will be even happier if you are Indian too ! :)

aljonm (author)2015-11-17

i also need the code for 3 digits 7 segment countdown timer using shiftregister, help?

brinesharks made it! (author)2015-11-02

I used a very old hp 763 display with completely different pin outs. But found a data sheet online and got it to work! Thanks for the intro.

pragithk (author)2015-10-21

pls send me the code for a 3 digit, 7 segment count down timer

DragNfLyDale made it! (author)2015-10-07

Thank You Bot1398

ZiqM (author)2015-08-14

Let say I have 9 switches, how to appear the number accordingly with all the switches? Like switch A=1, B=2, C=3 and so on..

Please help.


btrevor (author)2014-05-04

How did this happen? Sorry but i don't get it.
{ { 1,1,1,1,1,1,0 }, // = 0
{ 0,1,1,0,0,0,0 }, // = 1
{ 1,1,0,1,1,0,1 }, // = 2
{ 1,1,1,1,0,0,1 }, // = 3
{ 0,1,1,0,0,1,1 }, // = 4
{ 1,0,1,1,0,1,1 }, // = 5
{ 1,0,1,1,1,1,1 }, // = 6
{ 1,1,1,0,0,0,0 }, // = 7
{ 1,1,1,1,1,1,1 }, // = 8
{ 1,1,1,0,0,1,1 } // = 9

itsSubhadeep (author)btrevor2014-09-28

these are binary codes to activate lines. o means we have to activate a,b,c,d,e,f so 1,1,1,1,1,1 and g is 0..

how is that working can u tell pleas

AlistairM (author)btrevor2014-05-05

its the binary relevant to the seven segment, each 1 turning on a line of the seven seg.

fonorobert made it! (author)2015-05-03

I wired up and programmed a 7segment display based on this tutorial. It works like a charm, I have it mapped to the analog readings from a potentiometer.

Note: don't wire any of the segments to pins 0 and 1. The "TX" and "RX" leds are wired to these and light up when the arduino is connected to USB.

joshgem123 (author)2015-04-12

can someone please email me the code in arduino ide format as I can't seem to make this code work

ejayapalan (author)2015-03-27

I need to connect it to 4 PIR motion sensors...designated as 1 2 3 & 4...and output to be displayed accordingly...

how to write the code? please help...

HoneyL made it! (author)2015-03-04

nethmi.amanda.3344 (author)2015-02-08

what are the changes need to do when you are using common anode seven segment display instead of common cathode seven segment display.hint:using transistors

grimmindustries (author)2015-01-31

Hi, I'm building a prop and I need a display that counts down from 99. There are two contacts, every time the first contact is made the counter runs down 10 digits potter second till it his zero. The second don't will reset the counter to 99 when pushed. Besides the additional hardware do I need a different controller for this kind of programming?

ARIF ANIQM (author)2014-11-16

hallo i want to ask, how to change the coding to up counter? can anyone help please.. urgent

phomithona (author)2014-12-12

Hello all, I need circuit diagram of 2 digit seven segment display.

m1s73r (author)2012-07-11

Unfortunately I can't test my 7-Segment Display... Your method is not working. I'm using a KINGBRIGHT SA52-11GWA.

I think its a common anode one...

Could you please add a detailed tut on testing these?


ktrantham (author)m1s73r2014-09-30

@m1s73r All you do is change the the wiring, from Arduino 5V to the anode pins on display and then the pins that are connected to the arduino for anode connects in this guys tutorial become the Cathodes or outputs. You wire no ground. Nothing else changes in wiring. So in the code just change the 1's to 0's. SO short Change the Gnd on this guys tutorial to 5v on arduino and then wire the rest output wires and a few simple code tweeks and done

samalert (author)2012-03-20

not into electronics seriously but that 1 rupee got me here so see my brothers .... its gud instructable never have i thought tat 7 segment display is so hard .... for u it might be a piece of cake for me its like O_O

sreeraj (author)samalert2012-03-25

the indian rupee is the thing that lead me here too.

me #3

powerman666 (author)2012-06-24

Ever hooked up a common anode 7 segment display?

blinkyblinky (author)powerman6662012-08-31

I talk about common anode and what to do about it although the process is a bit tedious...if you can only find common anode (like me) then it is worth it.

Bot1398 (author)powerman6662012-08-30

No,but it shouldent be difficult just make all the ones to zeros and all the zeros to ones in the code and you should be ready to go.

andreicek007 (author)2012-07-04

What software did you use to create that circuit image? Thank you!

m1s73r (author)andreicek0072012-07-11

It's called Fritzing...

Applebohn (author)2012-03-30

way to copy from wikipedia

rammstein2 (author)2012-03-25

FYI a single 7-segment display can display 126 symbols. ;-)

jeffconnelly (author)rammstein22012-03-27

Wikipedia says 128, actually. Although "symbol" doesn't mean actual LETTER...

estope (author)jeffconnelly2012-03-29

no need for wikipedia, simple math: 2^7= 128

akowalczyk (author)estope2012-03-29

Actually, 255 - there is a decimal point - and I don't count all blank as a symbol YMMV

estope (author)akowalczyk2012-03-29

well, de decimal point makes it an eight-segment display i guess. and all blank is a symbol, you can asign a meaning to it as to any other combination. but i think we are leaving math behind and getting too phylosophical...

mr monoply33 (author)2012-03-29

Oi, I wish this was out about six or seven years. Spent hours if not days just going trial and error trying to figure out how to wire up some of these I mail-ordered. No good online tutorials at the time. I started to have trouble when I wired more than 5 displays together. Random segments would go out. Maybe the current got too low by that point... The lesson I learned from messing with them is, hot-glue is very hard to get off the back, and out of these displays.

dumle29 (author)2012-03-25

As these pictures show, you have chosen wrong resistors. When working with leds with 1 common pin, you should attach a resistor for each individual pin for the LEDs. This is because the more leds you turn on, the more ma the display would require. I know its a pain, but its the correct way.

qwerty156 (author)2012-03-20

Good Instructables for beginners

Its nice to see someone else my age interested in electronics, even better if they are from india :D

About This Instructable




Bio: Preapering for my medical entrance exams
More by Bot1398:555 Crriter RepellentSolar Powered Clock HackDIY Astronomy Flashlight
Add instructable to: