3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Charlieplexing 7 segment displays

Charlieplexing 7 segment displays
«
  • charlie-012345.jpg
  • charlie-board.jpg
  • charlie-done-down.jpg
This instructable describes how to charlieplex a bunch of 7-segment led displays.

Charlieplexing of discrete leds has been the topic of a few other instructables. The Charlieplexing LEDs- The theory and the How to drive a lot of LEDs from a few microcontroller pins comes to mind. They are both excellent and should be read by anyone that wants to gain a deeper knowledge of how charlieplexing really works.

Charlieplexing 7-segment displays is more or less the same as doing it with discrete leds, but with some changes to handle the fact that all the led segments have a common pin instead of being separate, and the need for buffering of the common output so the poor microcontroller can cope with the load.
 
Remove these adsRemove these ads by Signing Up
 

Step 1Why

While building a quick n' dirty pulse generator that I needed to test coils for a HV power supply I decided that it'd look more funky if I used a 6-digit seven segment display instead of the ubiquitous and boring LCD display.

Due to a shortage of available i/o-pins on the Atmel Tiny26 that I've used for the pulse generator project I couldn't use the standard multiplexed way of doing this. The standard multiplex would require 14 i/o-pins - 8 for the segments (don't forget the dot) plus 6 for the common anode/cathode of each display.

By Charlieplexing the displays I only need 9 i/o-pins and the displays are still muxed in a 1:6 way acheving the same brightness as standard muxing. Charlieplexing usually only light up one led at a time thus giving a reduced brightness if you want several leds to be (visibly) lit at the same time.

Of course I could have used a BCD-to-7segment decoder chip (74LS48) plus a 1-to-8 decoder (74LS138) but that would have been cheating, and i didn't have any '48ths as hand and I really wanted to be able to fit the pulse generator in an Altoids-like box.
« Previous StepDownload PDFView All StepsNext Step »
14 comments
Mar 18, 2009. 5:44 PMDuFFxP93 says:
Yo dude, I have a TI MSP430 with 8 I/O pins n I'm trying to control (4) 7-segment displays. I only need the 7 segments (no dot) and it seems according to this way of charlieplexing that it might be possible after all. Could you help me understand how exactly the charlieplexing works in simpler terms. It seems to me that if you power one of the segments with another segment's transistor on the same wire, you'd get some unwanted results, unless i'm totally confused.
Feb 21, 2011. 6:35 AMdantu says:
Hi DuFFxP93,

I was quite confused at first, but I think I've got it. The real trick is to realize that the uCPU lines are actually tri-state: high, low, and high-impedance (disconnect). This design takes advantage of all 3 states. Using this matseng has used HIGH to select a display and LOW to select a segment:

1. The "sink" on each display is connected to a DIFFERENT line (look very closely at the diagram). You drive this line HIGH to select the display.

2. Now, the actual segments are wired almost like normal, except that one of them will no be connected to the new data line (the one that would have been connected to the line you just drove high). You need to drive the segments you want on LOW.

3. Unlike a standard design, you MUST set the segments you don't want enabled to high-impedance (singe high would select a 2nd display, and low would select another segment).

PS: matseng - very clever, and useful!
Oct 12, 2010. 1:40 PMnatna says:
where did you get or buy that breadboard its really cool give me a link if you can
Aug 19, 2010. 12:34 PMtdk4 says:
It's not organized and hard to understand may be u could organize it more to be easily read with adding empty lines between each instruction :-) I use PIC and it's hard for me to recognize ur code :)
Jul 29, 2010. 7:13 PMsmeezekitty says:
Code is jumbled. Oh and Microchip PIC s do infact support C.
Jan 12, 2010. 11:17 AMbigstiffy says:
As soon as I saw the wall of code I felt like I could cry.
Sep 15, 2009. 10:25 AMkaushleshchandel says:
Hey, Which Transistor you have used. Kaushlesh
May 14, 2009. 7:37 AMcircuitmage says:
FYI on the current limiting; I just completed my first Charlieplex of 6 7-seg displays. I thought I would need current limiting, but after testing and measurments they were not needed so I took those Rs out. The LEDs as multiplexed are abit dim with only a few mA on each segment. It seems the code ensures power limits are in place! My project to be posted soon.
Dec 6, 2008. 5:27 PMyourcat says:
Genius! Did you get this idea from somewhere, or think it up yourself?
Jul 13, 2008. 3:37 PMUnit042 says:
Awesome 'ible! Have you thought of using a demultiplexor for LED alphanumeric display selection?
Jul 10, 2008. 11:58 AMckiick says:
Very clear Instructable - Thanks. Suppose I have a mutli-digit LED display where the inputs are already arranged in a segment/grid pattern. Is it possible to "piggyback" charlieplexing on top of it? I'm looking at it but don't quite see how. Thanks,
Aug 7, 2007. 8:24 AMandy says:
Good idea, hadn't thought of that... maybe i can use that 7 segment after all... thanks drew
Aug 6, 2007. 11:18 PMrgbphil says:
hi, nice instructable. Makes a lot of sense to charlieplex a seven segment display rather than use a special chip. The only comment I would make is that it is a bit of a myth to only look at the average current going into an LED and neglect to use limiting resistors. I'll explain in a second. Firstly, in this case, the natural output current limitations of the microcontroller and the small size of the LEDs in the displays will limit the current, so the following is more of an issue for high power LEDs. You might want to check the effect of high current pulses on the micro and PCB tracks and any effect it has on the rest of your circuitry though. An LED will fail because the plastic surrounding the LED die gets heated/cooled repeatedly, slightly softening (depending on current, perhaps melting) then hardening which expands and contracts making mechanical pressures on the LED die/wire bond. In time this wiggles the wire bond off making an open circuit. If you have a high current pulse of short duration, but low average consumption the LED will not be measurably warm because of the much larger thermal mass surrounding the LED. However the die/wire bond will quickly heat up/cool down because of the small area at the bond has a tiny thermal mass. I think I read somewhere you need a pulsewidth of sub millisecond to alleviate this (ie >1kHz refresh rate). So, particularly for high power LEDs, always keep the current under the datasheet maximum....even if the average current is less, even if you don't feel the LED getting warm. It is the pulse current width that matters, not the average current. Odds are this circuit will keep running for years because the LEDs are low power......but you never know.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
12
Followers
10
Author:matseng
Swedish expat living now living in Malaysia after spending some years working in Dubai.