In this instructable, I will be teaching the basics of multiplexing 7 segment displays using an Arduino and a couple of shift registers. This project is well suited for displaying numerical information or if you want to control a bunch of LEDs. For beginners, like me, I had no clue on how to tackle this project. But after trial and error and blood, sweat, and tears, I can say that I have a better understanding of multiplexing and how best to implement it on an Arduino.

First off, what is multiplexing? What about Charlieplexing? Any differences?
Actually, they are they same... Charlieplexing just takes multiplexing to a higher level. Both are techniques used to not only reduce the number of microcontroller pins needed, but also to reduce the power requirements substantially. However, at the cost of time and/or brightness.

In multiplexing, an entire digit or row of LEDs are shown at one time. After some time, the whole digit or row is turned off and the next digit/row is turned on, etc... Simple!

However, Charlieplexing is a bit more complicated in that it goes deeper than multiplexing. Instead of turning on a whole digit or row, a single segment or individual LED is turned on/off. After some time, the segment/LED is turned off and the next segment/individual LED is turned on, etc... After cycling through a digit/row, the process repeats with the next digit/row. So, if you're charlieplexing a 7-segment, you would consume a max of 20mA vs 160mA in multiplexing since only 1 segment is on at a time. The severe downside is that it takes longer to display information and brightness is reduced because the program needs to cycle through all the 7 segments + decimal or each LED first before moving to the next digit or row. You will also notice a slight flicker as you chain more displays/LEDs.

Look above for a comparison on multiplexing and charlieplexing. Notice how charlieplexing requires more time to display a number?

Before you tackle your multiplexing project, you must lay everything out--research as much as you can. Otherwise, you will end up wasting time, money, and pulling your hair out of frustration.

Step 1: Plan the Hardware

To multiplex 7 segment displays, you will need the following:

1. 7 segment displays -- I'm using 3 x 4.0 Inch Super Red 7 Segments from Kingbright (SA40-19SRWA)
I strongly suggest you purchase COMMON ANODE displays. Common anode means all the anodes (+) pins are connected. You apply + voltage to the anode and use shift registers to ground the segments and form a complete circuit. Very simple! 

However, with common cathode, all the ground (-) pins are connected. You then use shift registers to divert power to the anodes of the segments. However, the problem with this setup, as I've learned the hard way, is that you need to worry about sourcing AND sinking current. Most uControllers and shift registers cannot source nor sink a lot of current. Otherwise, you'd burn it out. If you require more voltage or current, you'll then need to worry about transistors or darlington arrays (external drivers) since you're using shift registers to tell them which segments need power (high voltage or current) and when to ground it. In other words, the hardware and code get more complicated and drives up cost.

2. Microcontroller
I strongly suggest getting an Arduino. The environment is much more intuitive and there is a huge pool of resources out there if you get stuck. If you're prone to making mistakes, get the Ruggeduino. It's only $10 more than Arduino Uno and protects you and your precious uController from stupid mistakes.

3. Serial-In Parallel-Out Shift Register
If you have the money, buy from the TPIC6x595 or TPIC6x596 family of shift registers by Texas Instruments. I use the TPIC6B596 in this instructable. The difference between its siblings (A, B, and C series) is the current handling capacity. In addition, the 596 family provides better reliability in cascading applications. When choosing shift registers, always make sure you do not exceed their current-handling limits.

Side notes:
- I would avoid the popular 74HC series as it can only source/sink a max of 70mA through the chip and cannot handle high voltages.

- I would also avoid using the common cathode / MAX7219/7221 setup with high voltage displays. Trust me... It's not worth it! You don't want to know the trouble I've been through with this setup. Even though there's a good library out there, it's best to understand and have control of the underlying mechanism behind shift registers and multiplexing.

4. Regulated DC Power Adapter
If you're planning to drive high-power displays, consider buying an regulated dc adapter that is greater than the forward voltage of your display. A regulated DC adapter provides stable voltage under any load. Just make sure its current rating is greater than what's required. In most cases, ratings higher than 500mA are enough (higher is better).

5. Resistors
You always need resistors to turn down current going through the LEDs.

The formula for calculating required resistor is:
(Supply Voltage - Minimum or Typical Forward Voltage per segment) / Desired forward current in Amps

Note that the desired current should always be a bit less than the absolute maximum forward current stated in the datasheet in order to extend the life of the LEDs. Don't forget that you need to do a separate calculation for the decimal point which may have a lower forward voltage requirement.

Also, be careful with datasheets of large displays. If they show low forward voltages (< 5V), that rating may be for the individual LED in a segment rather than the entire segment. So, for example, if there are  5 LEDs in series per segment and the datasheet shows a forward voltage of 2.6V for a 5 inch display, you probably need to multiply it by 5 to get the correct forward voltage for the entire segment. Here is one such example. It's more complicated if it's series/parallel arrangement which is beyond the scope of this instructable.

6. Breadboard and jumper wires
I recommend buying large solderless breadboards and a lot of jumper wires of various configurations (Male to Male, Male to Female). They are also known as dupont cables.

<p>I see someone has awoken this from the past.</p><p>Nice instructable, only one remark: this is not &quot;Multiplexing&quot; at all! This is simple serial-to-paralel conversion using shift registers. It saves microcontroller pins, that's true, but there is no multiplexing done. All indicators are powered at all time, no reduction of the drawn current whatsoever. Real multiplexing is done by sequentially addressing a single indicator and light up only those segments to show a single digit, then it is turned off and the next digit is shown on another indicator.</p>
<p>Great Instructable! I am new to arduino electronics. I have a question concerning the schematic: Is the last TPIC6B596 Ground connected to the Arduino board? In case of using only the ATMega 328 IC, will there be a sinking current problem or not? I hear that common cathode 7segs will have the problem. I only have a cathode 4 digit 7segs display, how would the schematic look in this case?<br>Thanks</p>
I need a clarification plz.<br>Suppose, the common anode pin of 4inch display is connected to 15v dc. And for making a segment off, what voltage should i give as reverse voltage at shift register pin. Is it ok with 5v or same 15v?. If 5v is enough then i can connect shift register ic directly to the display via resistors.<br>
<p>May I know how to select which digits in 4-digits seven segment display to be adjusted manually? What should I do on the circuit? I using arduino as well with infrared as input</p>
<p>Hi, I thought a benefit of using multiplexing would be to reduce the amount of wires and it should only require the single shift register as you can feed the same number to all all displays but since only one will be on at a time they will display different digits. It just might be what I thought of as I'm using common cathode, but you should absolutely be able to do it with common anode. What gets changed from what you have should be the same regardless of which display one uses.<br><br>The only reason I ask is because I was going to ask how you got such distinct differences in between segments that are on and those that are off, because the lights that should be off are half as bright as the ones that are on because it's pretty much PWM.</p>
<p>Just realized this is super old, my b. Don't feel inclined to say anything.</p>
<p>&gt;&gt; - I would avoid the popular 74HC series as it can only source/sink a max <br> of 70mA through the chip and cannot handle high voltages.</p><p>If someone had only those lying around (like yours truly), I guess slapping on some transistors would do the trick, wouldn't it?</p>
<p>I realize this is 7 months old, but I imagine you aren't the only one with this question. </p><p>Short answer is yes, https://www.instructables.com/id/Remote-Controlled-Arduino-Scoreboard-using-LED-Str/?ALLSTEPs is a good example, combining the 74HC595 with TIP-120 Transistors. Definitely nothing cutting edge, but two work horse components that are cheap and accessible. </p>
<p>Hey guys, I have question about the TPIC6B596 IC. I'm familiar with the 74HC595 but I am stuck on grasping the concept of the SER IN and SER OUT pin on the TPIC6B596. My interpretation is that you send 8 bits of data from your controller to pin 3 (SER IN). The data is then sent out via D0-D7 to illuminate the LEDs. Then data is retrieved on pin 18 (SER OUT) and shifted out to pin 3 of the next shift register. My question is, how is the data retrieved on pin 18 (SER OUT)? What is the source that determines the data being sent out to the next shift register?</p><p>Thank you in advance for your feedback!</p>
<p>I would like to point out to the entire universe that what everyone is calling multiplexing is in reality DE-Multiplexing.</p><p>I don't know how or when it all got confused, but everyone is doing it now, and it kinds bugs me!</p><p>Multiplexing is when you take a large number if signals, and combine them into a few lines. A good example of this is when 500 apartments in an apartment building all have their telephone lines connected by one fibre optic line to the phone company. De-multiplexing happens when the fibre optic line comes back to the apartment and then becomes 500 individual phone lines. So what we are really doing with our microcontrollers sending out data that gets spread across a much larger number of devices or wires (LEDs usually) is de-multiplexing. If we were to take 250 push-buttons and connect them all to the Arduino with 2 wires so that it could tell which button was pressed, that would be multiplexing.</p><p>That said - Nice project!</p>
<p>A really good instructable.</p><p>I did it with zero knowledge about 7 segments and TPLC6B595N. Thank you.</p><p>A question. Should code be like this according to the schematic?</p><p>const int CLK = 13; <br>const int LATCH = 10;<br>const int OE = 9;<br>const int DOUT = 11;</p>
hello my good sir <br>i have a question <br>can i use this for building a nice vfd shield? <br>and another one can this be rewritten for an 74hc595?
Can I use 74HC595 instead tpic6b596?
Beautiful Instructable. This one I am printing out.
Nice tutorial! And a cool maiden Instructable! It would be totally cool when your next I'ble is some cool application of charlie/multiplexing :-)

About This Instructable




More by Kev O:How to Create a Wimboot Installation of Windows 8.1 Multiplexing 7 Segment displays with Arduino and Shift Registers 
Add instructable to: