How to Connect 4 Digit 7 Segment LED Display With Arduino Uno

by Technoesolution2020 in Circuits > Electronics

1528 Views, 1 Favorites, 0 Comments

How to Connect 4 Digit 7 Segment LED Display With Arduino Uno

Featured Image.png

Hello friends welcome back to "Techno-E-Solution" , In this article I will show you how to interface 4 Digit 7 Segment Display with Arduino Uno. We know there are many types of LED Display in market and a 4 Digit 7 segment display are used in Control Panels, DC power supply Kit etc. In this article we use 4 Digit 7 Segment LED Display to Interface with Arduino Uno. Let's get started.....

Follow Me On :-

| YOUTUBE | INSTAGRAM | FACEBOOK | INSTRUCTABLES | DAILYMOTION | HACKSTER |


If you like this project subscribe us on Youtube, So without wasting time Let's get started..............

MATERIAL REQUIRED

To make this project we need some components (Best Buy Link Provided):-

Arduino Uno X 1

LED Display X 1

Breadboard X 1

Jumper Wires X 1

CIRCUIT DIAGRAM

Circuit Diagram.PNG
111417_sq_1.jpg

Follow the circuit diagram to make connections.

Next PCB


NextPCB is a high-quality PCB Manufacturer. With professional PCB manufacturing capabilities, our PCB engineers with more than 10 years of experience will double-check your engineering files.

NextPCB is certified by IATF16949, ISO9001, ISO14001, UL, CQC, RoHS and REACH; more importantly, we handle the whole process including the PCB prototype, PCB manufacturing, PCB assembly, testing, and final shipment. We are capable of assembling BGA, Micro-BGA, QFN, and other leadless package parts. We also have an online parts shop, you can choose any parts you need.

If you want a Printed circuit board go through the NEXT PCB

LED DISPLAY PINOUTS

Pinouts.jpg

This is the Pinout diagram of the 4 Digit 7 Segment LED Display.

ARDUINO CODE

Arduino Code.PNG

Make a circuit & Upload following code to Arduino Uno.

// Hello friends welcome to Techno-E-Solution
// Here is the Code for Interface 4 Digit 7 Segment Display
#define Dig1 6
#define Dig2 9
#define Dig3 10
#define Dig4 11
#define DIGIT_ON LOW
#define DIGIT_OFF HIGH
#define DISPLAY_BRIGHTNESS 5000
boolean duiz = false;
boolean hon = false;
#define segA 2
#define segB 3
#define segC 4
#define segD 5
#define segE A0
#define segF 7
#define segG 8
//int segPD = ;
void setup()
{
 pinMode(segA, OUTPUT);
 pinMode(segB, OUTPUT);
 pinMode(segC, OUTPUT);
 pinMode(segD, OUTPUT);
 pinMode(segE, OUTPUT);
 pinMode(segF, OUTPUT);
 pinMode(segG, OUTPUT);
pinMode(Dig1, OUTPUT);
pinMode(Dig2, OUTPUT);
pinMode(Dig3, OUTPUT);
pinMode(Dig4, OUTPUT);
Serial.begin(9600);
}
void loop()
{
 int number;
 Serial.println(number);

 for( int i = 0; i<=9999; i++){// for loop to pick a number from.
 duiz = false;
 hon = false;
 for(int k = 0; k<50; k++){ // for loop to slow it down.

 int figur = i;
 for(int digit = 1 ; digit < 5 ; digit++) { //for loop to place the number in the right digit
 switch(digit) {
 case 1:
 if(figur > 999){
 digitalWrite(Dig1, DIGIT_ON);
 lightNumber(figur / 1000); // for example 2511 / 1000 = 2
 figur %= 1000; // new value of figur = 511 figur = figur %1000

 delayMicroseconds(DISPLAY_BRIGHTNESS);
 if (figur < 100){
 duiz = true;
 if (figur <10){
 hon = true;

 }

 }else duiz = false;
 }

 break;
 case 2:
 if(duiz == true){
 digitalWrite(Dig2, DIGIT_ON);
 lightNumber(0);
 delayMicroseconds(DISPLAY_BRIGHTNESS);

 }if(hon == true){
 break;
 }

 if(figur > 99 && figur < 1000){
 digitalWrite(Dig2, DIGIT_ON);
 lightNumber(figur / 100);
 figur %= 100;
 delayMicroseconds(DISPLAY_BRIGHTNESS);
 if (figur < 10){
 hon = true;

 }else hon = false;
 }
 break;
 case 3:
 if(hon == true){
 digitalWrite(Dig3, DIGIT_ON);
 lightNumber(0);
 delayMicroseconds(DISPLAY_BRIGHTNESS);
 break;
 }

 if(figur > 9 && figur < 100){
 digitalWrite(Dig3, DIGIT_ON);
 lightNumber(figur / 10);
 figur %= 10;
 delayMicroseconds(DISPLAY_BRIGHTNESS);
 }

 break;
 case 4:
 if(figur < 10){
 digitalWrite(Dig4, DIGIT_ON);
 lightNumber(figur);
 delayMicroseconds(DISPLAY_BRIGHTNESS);

 break;
 }
 }
 //Turn off all segments
 lightNumber(10);
 //Turn off all digits
 digitalWrite(Dig1, DIGIT_OFF);
 digitalWrite(Dig2, DIGIT_OFF);
 digitalWrite(Dig3, DIGIT_OFF);
 digitalWrite(Dig4, DIGIT_OFF);

}
}}}
void lightNumber(int numberToDisplay) {
#define SEGMENT_ON HIGH
#define SEGMENT_OFF LOW
 switch (numberToDisplay){
 case 0:
 digitalWrite(segA, SEGMENT_ON);
 digitalWrite(segB, SEGMENT_ON);
 digitalWrite(segC, SEGMENT_ON);
 digitalWrite(segD, SEGMENT_ON);
 digitalWrite(segE, SEGMENT_ON);
 digitalWrite(segF, SEGMENT_ON);
 digitalWrite(segG, SEGMENT_OFF);
 break;
 case 1:
 digitalWrite(segA, SEGMENT_OFF);
 digitalWrite(segB, SEGMENT_ON);
 digitalWrite(segC, SEGMENT_ON);
 digitalWrite(segD, SEGMENT_OFF);
 digitalWrite(segE, SEGMENT_OFF);
 digitalWrite(segF, SEGMENT_OFF);
 digitalWrite(segG, SEGMENT_OFF);
 break;
 case 2:
 digitalWrite(segA, SEGMENT_ON);
 digitalWrite(segB, SEGMENT_ON);
 digitalWrite(segC, SEGMENT_OFF);
 digitalWrite(segD, SEGMENT_ON);
 digitalWrite(segE, SEGMENT_ON);
 digitalWrite(segF, SEGMENT_OFF);
 digitalWrite(segG, SEGMENT_ON);
 break;
 case 3:
 digitalWrite(segA, SEGMENT_ON);
 digitalWrite(segB, SEGMENT_ON);
 digitalWrite(segC, SEGMENT_ON);
 digitalWrite(segD, SEGMENT_ON);
 digitalWrite(segE, SEGMENT_OFF);
 digitalWrite(segF, SEGMENT_OFF);
 digitalWrite(segG, SEGMENT_ON);
 break;
 case 4:
 digitalWrite(segA, SEGMENT_OFF);
 digitalWrite(segB, SEGMENT_ON);
 digitalWrite(segC, SEGMENT_ON);
 digitalWrite(segD, SEGMENT_OFF);
 digitalWrite(segE, SEGMENT_OFF);
 digitalWrite(segF, SEGMENT_ON);
 digitalWrite(segG, SEGMENT_ON);
 break;
 case 5:
 digitalWrite(segA, SEGMENT_ON);
 digitalWrite(segB, SEGMENT_OFF);
 digitalWrite(segC, SEGMENT_ON);
 digitalWrite(segD, SEGMENT_ON);
 digitalWrite(segE, SEGMENT_OFF);
 digitalWrite(segF, SEGMENT_ON);
 digitalWrite(segG, SEGMENT_ON);
 break;
 case 6:
 digitalWrite(segA, SEGMENT_ON);
 digitalWrite(segB, SEGMENT_OFF);
 digitalWrite(segC, SEGMENT_ON);
 digitalWrite(segD, SEGMENT_ON);
 digitalWrite(segE, SEGMENT_ON);
 digitalWrite(segF, SEGMENT_ON);
 digitalWrite(segG, SEGMENT_ON);
 break;
 case 7:
 digitalWrite(segA, SEGMENT_ON);
 digitalWrite(segB, SEGMENT_ON);
 digitalWrite(segC, SEGMENT_ON);
 digitalWrite(segD, SEGMENT_OFF);
 digitalWrite(segE, SEGMENT_OFF);
 digitalWrite(segF, SEGMENT_OFF);
 digitalWrite(segG, SEGMENT_OFF);
 break;
 case 8:
 digitalWrite(segA, SEGMENT_ON);
 digitalWrite(segB, SEGMENT_ON);
 digitalWrite(segC, SEGMENT_ON);
 digitalWrite(segD, SEGMENT_ON);
 digitalWrite(segE, SEGMENT_ON);
 digitalWrite(segF, SEGMENT_ON);
 digitalWrite(segG, SEGMENT_ON);
 break;
 case 9:
 digitalWrite(segA, SEGMENT_ON);
 digitalWrite(segB, SEGMENT_ON);
 digitalWrite(segC, SEGMENT_ON);
 digitalWrite(segD, SEGMENT_ON);
 digitalWrite(segE, SEGMENT_OFF);
 digitalWrite(segF, SEGMENT_ON);
 digitalWrite(segG, SEGMENT_ON);
 break;
 case 10:
 digitalWrite(segA, SEGMENT_OFF);
 digitalWrite(segB, SEGMENT_OFF);
 digitalWrite(segC, SEGMENT_OFF);
 digitalWrite(segD, SEGMENT_OFF);
 digitalWrite(segE, SEGMENT_OFF);
 digitalWrite(segF, SEGMENT_OFF);
 digitalWrite(segG, SEGMENT_OFF);
 break;
 }
}<br>

DEMO & TESTING

If you Like this project please subscribe our youtube channel for latest projects :-

NEXT PCB

IaJuZlauXF3DR9vPBdhW7jWaduSLZom73TO2ShVof8M5kzs-In8QrC9hnJH6JseV02AEp58oz_ykZIC7QNW2lB-iWgFid5zqTY9ni6BRDTPZI3H3oMhF2xmG-yCewaHC-OGuxkKZ.png

NEXTPCB PCB MANUFACTURER COMPANY

NextPCB was founded in 2004 and has since established itself as a turnkey PCB manufacturing and assembly factory for prototype quantities as well as small-volume to big-volume production.

Why NEXTPCB?

NextPCB provides one-stop services for PCB with professional PCB manufacturing practices fulfilling the advanced design requirements. The company provides the speed of PCB and assembly manufacturing with efficient collaboration and quality assurance.

NextPCB provides a variety of PCBs with optimistic capabilities. Starting from the single-layer they provide PCB services up to 20 layers, with a board thickness of 0.6mm to 2.5mm with a tolerance of 10% and much more capabilities. Check out the manufacturing capabilities of NextPCB for better production of your PCB.