My Cart

2 7-Segment Display Using ArduinoJune 4, 2012

Driving 1 single 7-segment display is an easy task, but when you have to drive 2 or more of it than it becomes really complicated.

[Abishai] has made a good work sharing his knowledge to us. In his blog, we have found a great post of how to run 2 7-segment with Arduino.

There are two way which one can use many (more than 1) 7-segment display. The first method is to connect all the pins to the pins of micro-controller i.e each 7 pins to the pins of your micro-controller. And the second method is to make use of TDM i.e time division multiplexing. In TDM, we connect the 7 pins of the display with each other and then connect it to the micro-controller, but the ground of the displays are not connected directly but there is a transistor in between which could be turned on/off by the controller.Thus what ever is to be displayed is displayed by making use of time axis displaying digits one by one on the display, but the switching between the display is so fast that human eye can not see it.

Here he had used the 1st technique i.e i did not used TDM. He will show us the TDM technique in his preceding blogs.

So, the pin connection are shown in the figure.

The image shows which pin to connect with the arduino.

Remember to connect a 1K resistance at the ground pin of both the displays, as each LED in the display works on 3 volt and we have 5 volt supply from the arduino.

So, after connecting the hardware, which is easy, i will show you the code he has written for driving the displays.

The code which increase the count of the display form 00 to 99 is shown below:

0 to 99.
This program was developed by Abishai Singh.
The program is made for driving 2 7-segment displays
& to display the no.s from 0 to 99 in increasing order.
It can be used as a timer counter by making a little modification in the program.

int const a = 10;
int const b = 9;
int const c = 8;
int const d = 7;
int const e = 6;
int const f = 5;
int const g = 4;

int const p = A2;
int const q = A0;
int const r = A1;
int const s = 3;
int const t = 2;
int const u = A3;
int const v = 11;

int i;
int j;

int sir;
int ser;

void setup(){

pinMode(a, OUTPUT);
pinMode(b, OUTPUT);
pinMode(c, OUTPUT);
pinMode(d, OUTPUT);
pinMode(e, OUTPUT);
pinMode(f, OUTPUT);
pinMode(g, OUTPUT);
pinMode(A2, OUTPUT);
pinMode(A0, OUTPUT);
pinMode(A1, OUTPUT);
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
pinMode(A3, OUTPUT);
pinMode(11, OUTPUT);

void loop(){

for (j=0; j

Via and Source: Abishai Singh

Leave a Reply