Seven Segments… What More Could You Need?


Seven-segment displays are pretty useful tools for taking a project from indicator lamps to actual human-machine interaction. The only problem is, one digit of one display adds 7 outputs that you have to drive (or sink) and that doesn’t leave many signals for the process. How do you overcome this hurdle? Well, electronics engineers thought of that and came up with display driver IC chips. Basically, these take a more condensed set of data and deal with the overhead of controlling the display for you. For this project day, my goal was to use the least outputs possible to drive a 2-digit seven-segment display using the outputs from a microcontroller (I used Arduino Uno). Read on to see how I did.


Prototype Display Circuit

For the uninitiated, a seven-segment display is just an array of LEDs arranged to form the number 8. Well, actually any light source could be used, but I’m focusing on LED displays. By choosing which of the LEDs to light, the arrangement can articulate any numeral. This technology is used pretty much anywhere cheap numbers are needed, so in digital watches, calculators, thermometers, etc. LED displays in particular come in one of two flavors, common cathode and common anode. The type is important in selecting your driver, so watch out.

Seven-Segment LED Display

My display is a two-digit display with decimal points (Avago Technologies HDSP-5621, common anode, 2.5V, 30mA per segment)

There are a number of choices when it comes to display drivers. Input types include BCD, parallel binary, and serial. The output types vary from driving particular display types like LED, LCD, CRT to driving a generic output and from one up to eight digits . The driver I had on hand was a BCD to common anode LED driver for one digit (Texas Instruments SN74LS47). Part of my goal was to use the components I had to reduce my costs, but if I were to buy a driver from scratch, I’d want to go with a two-digit common anode driver with serial input.

At this point, I could have driven all 14 LEDs from 8 inputs to the display driver ICs, but 8 pins is a lot to ask on a small microcontroller, so the only way to reduce again was to look at serial. I chose to use a simple parallel-out shift register IC (takes in serial data and a clock pulse and outputs the last 8 serial bits as parallel data). I didn’t have anything on hand, so I selected Texas Instruments SN74HC164N.

Prototyping was pretty straightforward. I selected 220Ohm resistors to limit the current between each segment and the driving IC (assuming 1.2V-2.5V drop across resistors, that would be 17mA – 11mA from my 5V source). Also, I had to choose if the serial data would come from the microcontroller as LSb first or MSb first. The choice was completely mine since I wouldn’t be able to use the Serial method in the Arduino due to the clock requirement on the shift register. I opted to stick with convention and send the LSb first.

Here is a drawing of my prototype circuit:

Schematic of Seven-Segment Display Driver

Here is the Arduino code I used to drive the display:

// define all constant parameters here

int LEDPin = 2;
int CLKPin = 3;
int i = 0;
int j = 0;

//Debugging settings
#define DebugBaud 9600

void setup()
// Debugging Setup

pinMode(LEDPin, OUTPUT);
pinMode(CLKPin, OUTPUT);

void loop()
//Debugging Message
// Serial.println(“Online”);

for (j = 0; j <= 9; j++){
Serial.println(” is on the display”);
Transmit((byte) j);


void Transmit(byte Msg)
for (i = 0; i <= 7; i++){
// delay(100);

void writeBit(boolean Val) {
digitalWrite(CLKPin, LOW);
// delay(1);

if (Val) {digitalWrite(LEDPin, HIGH);}
else {digitalWrite(LEDPin, LOW);}

digitalWrite(CLKPin, HIGH);

That was my project day!

Recommended Posts

A Fun Recipe for Kitchen Chemistry

Chemistry is all around us every day. And now, it’s all over my father-in-laws refrigerator, too. My father-in-law is a chemical engineer and a kitchen chemist in his free time. My wife and I thought that the chemistry equivalent of poetry fridge magnets would be the perfect Christmas gift for him. The concept is pretty simple, find […]


Salvage – It’s Not Just for Sinking Boats

What do you do when your beloved printer, scanner, blender, or remote controlled car breaks? I’m glad you asked because this weeks’ post is about salvage. I’m going to use my experience to help you quickly sift through the junk and help you find the good stuff. sal·vage ( sal-vij )  – To rescue or […]


A Twist to Build a Dream On

Some projects, like this deburring/countersinking tool sit on the back-burner for a long time. Dusting them off to finish the job feels like sharing a meal with an old friend. This deburring tool is a handy way I came up with to reduce the amount of time I spend switching between drill bits and countersinking […]


Leave A Comment