7 Segment display Multiplexing with 74hc595 Shift Register Using Arduino
Overview
In this Arduino tutorial, we will how to multiplexing seven segment display with a 74hc595 shift register. A single digit display shows 0 to 9 decimal number. Ofen we need to display two, three, four or more digit decimal number, but the problem is lack of I/O (input/output) pins in the MCUs. To solve this problem we need for multiplexing. Here we will also use a 74hc595 shift register.You can watch the following video below:-
Components Required
The following component needed for this tutorial- Arduino Uno
- 2 Common anode 7 segment display
- 74hc595 shift register
- 220-ohm resistor
- Breadboard
Pin Configuration
The following figure shows the common anode 7 segment display pinout. It has the total of 10 pins in which pin 3,8 common pin, pin 5 is DP and remaining pins are a,b,c,d,e,f,g.
Fig: Common anode 7 segment display pinout |
Fig: 74hc595 pinout
|
Circuit Schematic
The following figure shows the 7 segment display multiplexing with 74hc595 shift register using Arduino.Fig: 7 Segment display multiplexing |
Circuit Description
The shift register has 16 pins in which 7 output pins will connect with 7 segment LEDs pin. The shift register Vcc pin 16 and MR pin 10 will connect to +5V. The ground pin 8 and output enable pin 13 will goes to ground. Next, shift register clock, latch, and data pins are gradually 11,12 and 14 will connect to Arduino digital pin 2, 3 and 4 respectively. Seven segment display common pins will connect to Arduino digital pin 6 and 7 through the 220-ohm series resistor.
7 segment display ----------------- 74hc595 shift register
Pin_7(Seg_a) --------------- Pin_15(Q_A)
Pin_6(Seg_b) --------------- Pin_1(Q_A)
Pin_4(Seg_c) --------------- Pin_2(Q_A)
Pin_2(Seg_d) --------------- Pin_3(Q_A)
Pin_1(Seg_e) --------------- Pin_4(Q_A)
Pin_10(Seg_f) -------------- Pin_5(Q_A)
Pin_9(Seg_g) -------------- Pin_6(Q_A)
Source Code
This is the source code of multiplexing given below:-
int DS_14 = 2;
int STCP_12 = 3;
int SHCP_11 = 4;
int j = 0;
int digit1 = 5;
int digit2 = 6;
int Digit[10] = {64, 121, 36, 48, 25, 18, 2, 120, 0, 24};
void setup() {
pinMode(STCP_12, OUTPUT);
pinMode(DS_14, OUTPUT);
pinMode(SHCP_11, OUTPUT);
pinMode(digit1, OUTPUT);
pinMode(digit2, OUTPUT);
}
void loop() {
for (int i = 0; i <= 10; i++)
{
if (i == 10) {
i = 0;
j = j + 1;
}
if (j == 6) {
j = 0;
}
{
for (int m = 0; m < 65; m++)
{
display1();
digitalWrite(STCP_12, LOW);
shiftOut(DS_14, SHCP_11, MSBFIRST, Digit[i]);
digitalWrite(STCP_12, HIGH);
delay(5);
display2();
digitalWrite(STCP_12, LOW);
shiftOut(DS_14, SHCP_11, MSBFIRST, Digit[j]);
digitalWrite(STCP_12, HIGH);
delay(5);
}
}
}
}
void display1()
{
digitalWrite(digit1, 1);
digitalWrite(digit2, 0);
}
void display2()
{
digitalWrite(digit1, 0);
digitalWrite(digit2, 1);
}
No comments