0% found this document useful (0 votes)
363 views

Arduino 4-Digit 7-Segment LED Display

This document describes a project to interface a 4-digit 7-segment LED display to an Arduino board. It includes a circuit diagram showing how the display is connected to the Arduino using transistors for multiplexing. The code samples show how to define the segments and display digits by turning on the relevant LED segments. Comments from readers ask for clarification or additional resources on programming Arduino and interfacing with 7-segment displays.

Uploaded by

Phops Freal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
363 views

Arduino 4-Digit 7-Segment LED Display

This document describes a project to interface a 4-digit 7-segment LED display to an Arduino board. It includes a circuit diagram showing how the display is connected to the Arduino using transistors for multiplexing. The code samples show how to define the segments and display digits by turning on the relevant LED segments. Comments from readers ask for clarification or additional resources on programming Arduino and interfacing with 7-segment displays.

Uploaded by

Phops Freal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

ELECTRONICS HUB

PROJECTS | TUTORIALS | REVIEWS | KITS

HOME PROJECTS MINI PROJECTS ARDUINO FREE CIRCUITS TUTORIALS SYMBOLS DIY

REVIEWS CONTACT US

YOU ARE HERE: HOME / ARDUINO / ARDUINO 4-DIGIT 7-SEGMENT LED DISPLAY

Arduino 4-Digit 7-Segment LED Display


FEBRUARY 29, 2016 BY ADMINISTRATOR — 12 COMMENTS

7 Segment LED displays are used in many applications as front panel number indicators.
The most common applications are calculators, microwave ovens, electronic lab
equipment like function generators and frequency counters.
A 7 segment LED display consists of 7 LEDs arranged in such a way that it can display
numbers from 0 to 9. The arrangement of LEDs in the display can be either common
anode or common cathode.

In this project, a 4 – digit 7 – segment LED display is used to display numbers using
Arduino.

Either a compact module containing four 7- segment LED displays can be used or four
individual 7 – segment displays can be used by multiplexing them.
Select the Next Set of Arduino Projects You Want to Learn in Electronicshub:
Arduino Projects»

Table of Contents 
1. Circuit Diagram
2. Components Required
3. Working of 4 – Digit 7 – Segment LED Display
4. Code

Circuit Diagram

Components Required
Arduino UNO — 1 [Buy Here]
4 – Digit compact 7 – segment LED display — 1(Or)7 – Segment LED display — 4
BC547 — 4
1KΩ — 4
100Ω — 4
Working of 4 – Digit 7 – Segment LED Display
A 7 – Segment LED display, as the name indicates, is an assembly of LED bars, where
each bar can be powered individually. Each LED bar is in the form of a hexagon and the
overall arrangement will be in the form of ‘8’.

The following figure shows a general representation of 7 – segment LED display with
dedicated names to each segment.
Each segment can be powered separately to display digits from 0 to 9. The following
figure shows the pattern of digits displayed by a 7 – segment LED display.

As mentioned earlier, in a 7 – segment display, the LEDs can be arranged in common


anode or common cathode mode.

The equivalent circuit of a 7 – segment display in common anode and common cathode
configuration is shown below.
To determine whether the 7 – segment display is common anode or cathode, a small
test circuit can be built. The common terminal of the display is connected to a current
limiting resistor.

The resistor is given positive voltage and any of the segments (A to G) is connected to
ground. If the segment glows, then it is common anode display.

If the segment doesn’t glow, reverse the polarity of the supply and then it glows. This is a
common cathode display.

It is important to determine whether the display is of common anode or common


cathode type as the code for Arduino (or any microcontroller) will depend on it.

In this project, we are using a 4 – digit 7 – segment LED display. We can use a compact
4 – digit module or use four individual 7 – segment displays and multiplex them to make
a 4 – digit display.

The following figure shows four multiplexed 7 – segment LED displays.


Respective segment pins (A to G and DP) of all the 7 – segment displays are connected
with each other.

Hence, only 8 pins will be sufficient to control all the eight segments of all four displays.
These eight pins are connected to eight pins of Arduino.

We assume that the selected 7 – segment module is of common cathode type. The four
common pins from four displays are connected to collector terminals of four different
transistors through current limiting resistors.

The emitter terminals of four transistors are connected to ground. The four base terminal
of the four transistors are connected to four pins of Arduino through current limiting
resistors.

All the connections are shown in the circuit diagram.


The aim of this project is to demonstrate the working of a 4 – digit 7 – segment LED
display using Arduino by implementing a simple counter.

The circuit diagram and written code are developed for common cathode type 7 –
segment LED display.

Code

1 #define duration 5000

2
3 #define A 2

4 #define B 3

5 #define C 4

6 #define D 5

7 #define E 6

8 #define F 7

9 #define G 8
10 #define DP 9

11
12 #define disp1 10

13 #define disp2 11

14 #define disp3 12

15 #define disp4 13

16
17 #define numbersegments { \

18 {1,1,1,1,1,1,0,0},\

19 {0,1,1,0,0,0,0,0},\
20 {1,1,0,1,1,0,1,0},\
21 {1,1,1,1,0,0,1,0},\

22 {0,1,1,0,0,1,1,0},\

23 {1,0,1,1,0,1,1,0},\

24 {1,0,1,1,1,1,1,0},\

25 {1,1,1,0,0,0,0,0},\

26 {1,1,1,1,1,1,1,0},\

27 {1,1,1,0,0,1,1,0},\

28 }

29
30 byte numbers[10][8] = numbersegments;
31 const int segments[8] = {A, B, C, D, E, F, G, DP};

32
33 void setup()

34 {

35 pinMode(A, OUTPUT);

36 pinMode(B, OUTPUT);

37 pinMode(C, OUTPUT);

38 pinMode(D, OUTPUT);
39 pinMode(E, OUTPUT);
40 pinMode(F, OUTPUT);
41 pinMode(G, OUTPUT);
42 pinMode(DP, OUTPUT);

43 pinMode(disp1, OUTPUT);

44 pinMode(disp2, OUTPUT);

45 pinMode(disp3, OUTPUT);

46 pinMode(disp4, OUTPUT);

47 digitalWrite(A, LOW);

48 digitalWrite(B, LOW);

49 digitalWrite(C, LOW);

50 digitalWrite(D, LOW);
51 digitalWrite(E, LOW);
52 digitalWrite(F, LOW);

53 digitalWrite(G, LOW);

54 digitalWrite(DP, LOW);

55 digitalWrite(disp1, LOW);

56 digitalWrite(disp2, LOW);

57 digitalWrite(disp3, LOW);

58 digitalWrite(disp4, LOW);

59 }

60
61 void loop()
62 {

63 for (int digit4=0; digit4<10; digit4++)

64 {

65 for (int digit3=0; digit3<10; digit3++)

66 {

67 for (int digit2=0; digit2<10; digit2++)

68 {

69 for (int digit1=0; digit1<10; digit1++)

70 {

71 for (int t=0; t<30; t++)


72 {

73 setsegments(digit1, disp1, duration);

74 setsegments(digit2, disp2, duration);

75 setsegments(digit3, disp3, duration);

76 setsegments(digit4, disp4, duration);

77 }

78 }

79 }

80 }

81 }
82 }

83
84 void setsegments(int number, int digit, int ontime)

85 {

86 for (int seg=0; seg<8; seg++)


{
87
88 if(numbers[number][seg]==1)

89 {

90 digitalWrite(segments[seg], HIGH);
91 }

92 else

93 {

94 digitalWrite(segments[seg], LOW);

95 }

96 }

97 digitalWrite(digit, HIGH);

98 delayMicroseconds(ontime);

99 digitalWrite(digit, LOW);

100 }

Arduino 4-Digit 7-Segment LED Display hosted with by GitHub view raw

You are free to use above code. Feel free to ask your doubts and questions in below
comment. Our technical person love to help you.

Related Posts:
Arduino 7 Segment Display Interface
Interfacing 7 Segment Display to 8051
Seven Segment Displays
2 Digit Up/Down Counter Circuit
8 Channel Quiz Buzzer Circuit using Microcontroller
Arduino 8x8 LED Matrix
FILED UNDER: ARDUINO

Comments

Manoj Acharjee says


MARCH 18, 2016 AT 1:57 AM

Thanks for sending the best project to learn 7 segment led.

Reply

Akhil bansal says


APRIL 13, 2016 AT 10:49 AM

I need to learn the programming of Arduino and other microcontrollers, suggest me


some books , source for it.

Reply
Shivraj muttagi says
AUGUST 27, 2016 AT 2:22 PM

This website has superb for me…..

Reply

Sangeetha says
APRIL 11, 2017 AT 7:16 AM

Sir this code work in pic development board?

Reply

S Gnana Asha says


DECEMBER 26, 2017 AT 5:26 AM

Video of this topic??

Reply

knit tha says


FEBRUARY 16, 2018 AT 9:51 AM

For me thank you that you make project good for student lean

Reply

Manikandan says
MARCH 21, 2018 AT 12:09 PM
I need an program code for arduino uno based 4digit 7 segment display using
decimal to binary output in 7segment display.

Please help us .

Reply

junaid says
APRIL 9, 2018 AT 12:19 PM

can i get hex file of this


or kindly show me the way to load this code in arduino
i am using proteus 8

WHATEVER DO IT ASAP
THANKS IN ADVANCE

Reply

Ravi says
APRIL 10, 2018 AT 4:07 AM

You need to use Arduino IDE to upload the code to Arduino. Simply connect the
Arduino to the computer (through USB cable) and hit upload in the Arduino IDE.
It’ll take care of everything.

Reply

azfar rajput says


JULY 24, 2018 AT 9:35 AM
kindly provide me the source , so that i can learn programming of arduino.

Reply

Ravi says
JULY 30, 2018 AT 2:08 AM

Hi,
Code is already uploaded in the page.

Reply

Amstrong says
DECEMBER 8, 2018 AT 9:27 PM

hey, this is really good. but can i get a help? im trying to build a counter but i have
issues.

Reply

Leave a Reply
Your email address will not be published. Required fields are marked *

Comment
Name *

Email *

Website

POST COMMENT

Search this website


PROJECTS BY CATEGORY

Arduino Projects (200+)


Electronics Projects (250+)
Mini Project Circuits (160+)
Mini Project Ideas (150+)
ECE Projects (150+)
EEE Projects (150+)
8051 Projects (110+)
Raspberry Pi Projects (101+)
Electrical Project Ideas (100+)
Embedded Projects (100+)
Latest Electronics Ideas (100+)
Microcontroller Mini Projects (100+)
Robotics Projects (100+)
VLSI Projects (100+)
Solar Projects (100+)
IOT Projects (100+)

Communication Projects (70+)


LED Projects (70+)
Power Electronics Projects (60+)
RFID Projects (60+)
Home Automation Projects (50+)
Matlab Projects (50+)
EIE Projects (50+)
Wireless Projects (50+)
LabView Projects (45+)
Zigbee Projects (45+)
GSM Projects (40+)
555 Timer Circuits (40+)
Sensor Projects (40+)
ARM Projects (60+)
DTMF Projects (30+)
PIC Projects (30+)
Electrical Mini Projects (25)
ESP8266 Projects (15)

KITS

Best Rgb Led Strip Light Kits


Arduino Starter Kit
Electronics Books Beginners
Breadboard Kits Beginners
Best Arduino Books
Diy Digital Clock Kits
Drone Kits Beginners
Best Brushless Motors
Raspberry Pi Books
Electronics Component Kits Beginners
Soldering Stations
Electronics Repair Tool Kit Beginners
Raspberry Pi Starter Kits
Best Waveform Generators
Arduino Robot Kits
Oscilloscope Kits Beginners
Raspberry Pi LCD Display Kits
Robot Cat Toys
FM Radio Kit Buy Online
Best Resistor Kits
Soldering Iron Kits
Best Power Supplies
Best Capacitor Kits
Arduino Sensors
Best Function Generator Kits
Led Christmas Lights
Best Iot Starter Kits
Best Gaming Headsets
Best Python Books
Best Robot Dog Toys
Best Robot Kits Kids
Best Solar Panel Kits
Led Strip Light Kits Buy Online
Top Robot Vacuum Cleaners
Digital Multimeter Kit Reviews
Solar Light Kits Beginners
Best Jumper Wire Kits
Best Gaming Earbuds
Best Wireless Routers
3d Printer Kits Buy Online
Best Gaming Mouse
Electric Lawn Mowers
Best Gaming Monitors

Best 32 inch in india

Best 40 inch in india

You might also like