Arduino 2-Digit 7-Segment Display Counter: Circuit | Part 2

by Natalia Fargasch Norman

in Arduino, Project

This week we’ll look at the circuit for the 2-digit 7-segment display counter using the Arduino.

There are a few options to control multiple displays:

  • employing multiple controllers;
  • using a 7-segment driver chip like the 7447;
  • using a multi-display controller such as the MAXIM MAX7219;
  • sequencing through the displays, which is what we have done in our example, as it requires no added hardware.

When we were using a single-digit display, we connected the common anode pin to our Vdd supply, but with two digits we have to drive them independently if we want them to display different digits!

A natural reaction would be to try to use two Arduino I/O pins, each driving a digit of the display. The problem with this scenario is that it is not possible to drive the common anode or cathode pin using Arduino I/O pins, as they cannot source or sink enough current to light all seven segments.

2-digit 7-segment led display diagramThe solution is then to use bipolar junction transistors (NPN for common cathode and PNP for common anode displays) in order to sink or drive the required current. The controlling interface outputs the value for a specific display by enabling only its common pin transistor, and the digit driven by that common pin becomes active.

To give the impression that both displays are active at the same time and avoid flickering we cycle through the digits in quick succession and keep each of them lit for 5ms. We will see how that was implemented when we go over the sketch next week.

Here is the schematic for the 2-digit 7-segment display circuit (click for larger image):

2-digit 7-segment display circuit

* This is a multi-part post. Here are links to all parts:

Part 1: Intro, bill of materials and simple sketch
Part 2: The 2-digit 7-segment display circuit; this post
Part 3: Sketch broken down in sections, explained
Part 4: Added two buttons, and modified sketch
Part 5: Code for buttons, explained

Digiprove sealCopyright secured by Digiprove © 2014 Natalia Fargasch Norman

{ 4 comments… read them below or add one }


Hi Natalia!

I just wanted to ask if I’m gonna use a common cathode 7-segment display,
will there be no changes other than the pin configuration?


Natalia Fargasch Norman

Hi Jeanne, also pay attention that the transistors will be different for common cathode or common anode displays. As for the pins, you also have to follow the datasheet of your display, as the configuration may be different than the one I used. Good luck!


Sherwin Sena

Hi there,im sherwin,im doing a project,but i have no idea how to code,it would be a great blessing if you could help me out please! My project would consist of a 1 digit 7 Segment display counter which counts from 0-9,and a switch to reset it to 0 and start it again.

I can only code until this far and i have no idea what to do next :(
Please help me,im really lost..

#define 7 SEGMENT_SL1 PORTBbits.RB2
#define 7 SEGMENT_SL2 PORTBbits.RB3
#define 7 SEGMENT_c PORTBbits.RB4
#define 7 SEGMENT_e PORTBbits.RB5
#define 7 SEGMENT_d PORTCbits.RC5
#define 7 SEGMENT_DP PORTCbits.RC6
#define 7 SEGMENT_g PORTAbits.RA0
#define 7 SEGMENT_b PORTAbits.RA1
#define 7 SEGMENT_f PORTAbits.RA2
#define 7 SEGMENT_a PORTAbits.RA3


Natalia Fargasch Norman

Leave a Comment

{ 4 trackbacks }

Previous post:

Next post: