top of page

Interfacing 4-Digit 7-Segment Display with Arduino

Updated: May 16

In this project, you will learn to interface a 4-digit 7-segment display using Arduino.


Hardware Components:


1. Arduino Uno:

#ArduinoUno board is used for interfacing the input-output elements to construct a project. It is an open-source microcontroller board that can be programmed according to user requirements.


Arduino Uno R3
Arduino Uno R3

2. 4-Digit 7-Segment Display:

A 4-digit 7-segment digital display is used to display decimal numbers in electronic devices like digital clocks, calculators, etc. To display any decimal number or a letter certain segments of the digit should be activated according to the segment table. The segment table and the pin-out representation are given below.

4 Digit 7 Segment Display
4 Digit 7 Segment Display


Segment table for 4-digit 7-segment digital display
Segment table for 4-digit 7-segment digital display


Pin-out representation
Pin-out representation

3. Resistor-220Ω:

The resistor is a passive electronic component that offers resistance to the current flowing through it. In this project, we use 220Ω resistors to reduce the current flowing through the digital display.

4 Digit 7 Segment Display
4 Digit 7 Segment Display

4. Breadboard:

A breadboard is a simple rectangular board that has many holes shorted in a specific manner. It is the construction base for implementing electronic projects. The holes are used to connect circuit components like ICs, capacitors, potentiometers.


Breadboard
Breadboard

Circuit Connections:



  1. Connect the D4 of the display to the D3 of the Arduino via a 220Ω resistor.

  2. Connect the D3 pin of the display to the D4 of the Arduino via a 220Ω resistor.

  3. Connect the D2 pin of the display to the D5 of the Arduino via a 220Ω resistor.

  4. Connect the D1 pin of the display to the D6 of the Arduino via a 220Ω resistor.

  5. Connect segment A pin of the display to D13 of the Arduino.

  6. Connect segment B pin of the display to D7 of the Arduino.

  7. Connect segment C pin of the display to D9 of the Arduino.

  8. Connect segment D pin of the display to D10 of the Arduino.

  9. Connect segment E pin of the display to D11 of the Arduino.

  10. Connect segment F pin of the display to D12 of the Arduino.

  11. Connect segment G pin of the display to D8 of the Arduino.




Code:


  • Declare the pins of the Arduino connected to the segments of the display as an integer segpin[].

  • Also, declare the pins of the Arduino connected to the digit pins of the display as an integer dpin[].

  • Now, declare an array to hold the segment table of the 4-digit 7-segment display.

  • Declare a timer variable and initialize it to 100 seconds.

  • In void setup(), begin the serial monitor output with a 9600 baud rate.

  • Using the for loop, set the segment pins and the digital pins to output mode.

  • In void loop(), print the "Enter number to be displayed:" statement.

  • In while loop, take the input number from the user.

  • Assign variables to the ones, tens, hundreds and thousands place of the numeral given as input.

  • Using for loop, set the necessary segments to high or low value to get the output on the 4-digit 7-segment display.

Working:

When a numeral input is given to then the necessary segments are set to high and the numeral is obtained as the output on the 4-digit 7-segment display.


Hardware connections and output
Hardware connections and output


Video by- Anupama Koley


Written by-

Name- Nagashree R Nadig


See also-

Interfacing MPU 6050 Sensor with Arduino UNO

Interfacing IR sensor and Relay with Arduino


Follow us -


Please do follow us i.e #learnelectronicsindia to get daily updates about new blogs, videos, courses, quizzes, and contests.





Want us to help you with the projects, write your inquiry here - Order Projects


Check out our Free Arduino Projects Playlist - Arduino Projects

Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects

Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects

Check out our Free IoT Projects Playlist - IoT Projects

Check out our Free Home Automation Projects Playlist - Home Automation Projects

Check out our Free NodeMCu Projects Playlist - NodeMCu Projects

bottom of page