I am working on a small test project for my Arduino and as part of it, I want to display a number on a 7-segment LED system. My first setup involved just direct links to the 7-segment display and controlling each segment individually with the Arduino by setting the output to LOW to activate it.

I then reduced the number of pins required to 4 (5 including the decimal point control) using a BCD to 7-segment High-speed CMOS chip (74HC4511) and connecting it as shown in the diagram below (the NOT gates are achieved through using NOR gates with one input connected to ground):


simulate this circuit – Schematic created using CircuitLab

I can then control the 7-segment display using the following snippet:

digitalWrite( 1, iVal & 0x0001 != 0 ? HIGH : LOW );
digitalWrite( 2, iVal & 0x0002 != 0 ? HIGH : LOW );
digitalWrite( 3, iVal & 0x0004 != 0 ? HIGH : LOW );
digitalWrite( 4, iVal & 0x0008 != 0 ? HIGH : LOW );
digitalWrite( 5, bDPRequired ? HIGH : LOW );

However, this isn't ideal as it still requires 4 pins; ideally I would like to reduce it to 1 pin which outputs the data serially. My first thought was to use some sort of 4-bit shift register; however, this would require another output pin to control the clock pulse, and would result in spurious displays during the transition from one number to another.

I'd be grateful for any potential ways I could minimize the number of pins!

PS: I am aware that it is somewhat bad practise to have the current-limiting resistor on the 5V output rather than on each of the cathode pins on the 7-segment display as it will result in less light emission the more segments are activated.


2 Answers 2


You could use a 74HC595 shift register and this circuit, courtesy of Roman Black.

enter image description here

That will buy you 8 outputs with a single 25-cent chip.

  • \$\begingroup\$ I would not use it to control a nuclear power plant, but assuming that it drives a display you can refresh it regularly, so a glitch has a limited inpact. \$\endgroup\$ Commented Apr 1, 2014 at 18:19

The only was I can think to do this with only one pin is to use a 1-wire shift register, such as DS2408. This will give you 8 outputs using only one pin from your micro. However, I'd really suggest you go to two pins instead. This will allow you to either use a standard shift register or I2C to a GPIO expander chip as this will be much easier to program.

By the way, you have an error in your schematic. The resistor should be after your driver chip. Otherwise, its Vcc will drop in voltage along with the LEDs as more are turned on.

  • \$\begingroup\$ And preferrably it should be a separate resistor for each segment. \$\endgroup\$ Commented Apr 1, 2014 at 17:54
  • \$\begingroup\$ The OP already commented on this so I didn't mention it. However, it is even worse as shown in this schematic. \$\endgroup\$
    – DoxyLover
    Commented Apr 1, 2014 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.