New user intro + 7-LED Charlieplexing

Hi all,

New user here -- my name's Halle, I live in Berlin, and I just recently got acquainted with the Arduino and its many charms. This forum is great, cheers!

So, on my first Arduino project I wanted to use a couple of 7-segment LEDs and quickly ran out of pins, and while I was trying to figure out if I should get another chip to drive the LEDs I started to learn about multiplexing/charlieplexing, and decided to do it the hard way :), mostly because I thought it would get me past my lingering hangups about wiring diagrams and arrays. I primarily relied on this for the wiring:

http://www.instructables.com/id/Charlieplexing-7-segment-displays/

and this for the code:

http://www.instructables.com/id/Arduino-Charliplexed-Heart-just-in-time-for-Valen/

So, I wanted to post the current state of my wiring and sketch and see if I could get some feedback, and also share in case my progress so far would be useful to others. Everything works fine, but I think there could be some more polish. Thanks for any input!

Questions bugging me, in case anyone has a second to take a whack at them:

1) This still seems to work if I disconnect the +5v line. Why does it still work/why is the +5v line important? Does this come into play to a greater extent if I'm driving more than two 7-segments?

2) How is my resistor choice and placement? Could the resistors alternately go right after the data line?

3) I have some ghosting every once in a while (mostly when the number 4 is displaying on the second LED). Any suggestions about to minimize this?

4) This code works for my needs, since I will always have a two-digit number to display and I'm getting that number as two single digits. But, maybe it would be cooler to make it more universal, and I'd love to know if people see more efficient ways to structure things.

Here is the wiring:

Notes on wiring: according to various knowledgeable folks I've asked, this is unfortunately as charlieplexed as two 7-segment LEDs can be, due to the shared anode (or cathode). The pin savings for charlieplexing two 7-segment LEDs versus multiplexing is only a single pin. The upside is that you can drive up to eight 7-segment LEDs with the same number of pins! I have only tested this wiring and my code with two LEDs but expanding to more should be possible in accordance with the diagrams here:

http://www.instructables.com/id/SK96UKMF4VNMDEU/

or here:

http://www.maxim-ic.com/appnotes.cfm/appnote_number/1880

BTW, I left the decimal point out of my wiring because I don't need it, but it would be added with another data pin which goes to the first decimal point, which goes to the second decimal point, which the same arrangement of resistors as on the other LEDs. Another place would also have to be added in all of the related arrays in the code as well.

Here is the sketch:

http://www.politepix.com/photos/charlieplexed_7Seg.pde

Code notes: I think that in order to add another led, you'd just have to make changes in the following places:

1) add a thirdNumber variable 2) add the next set of 7 pairs to ledPairs 3) add a thirdLed byte with the respective on/off patterns 4) get the thirdLed array into the entireNumber array 5) change the number 14 to 21 in all of the 'for' functions which get the array contents

but I haven't tested it. If anyone has more 7-segments lying around than I do and wants to give it a go, I'd be interested to hear if it works.

OK, thanks for any feedback, and if anyone is in my approximate neighborhood and wants to compare notes on where to get things here, or maybe go in on shared shipments from the US, drop me a line.

Oh my… so many things to address!

(BTW: Berlin my favorite tourism destination… great city.)

  1. In the “bad old days” we’d do anything to save a pin. And there’s still some aesthetic pleasure in doing so… but life is short. Make life easy for yourself. “Give up” two pins JUST to “select digit” control. Two pins will allow you to have 3 digits. With just a little extra circuitry, 3 “select digit” pins let you control 7 digits. If you can’t bear the “wasted” pins, you can use some of them in the circuits to read a matrix keypad… as WELL as for putting things on the 7seg displays. (If you want the extra coding headaches!)

  2. I’m puzzled that the circuit worked without the 5v supply to the transistors. Could someone more knowledgeable comment? Is current “leaking” through the transistor’s base?

  3. Resistors: You’re right, I think: You can cut your resistor count in half: E.g. on “Data 8”, put a 220R on the line right by the “Data 8” (on your diagram, BEFORE the line splits to digit A and digit B, and get rid of the two resistors “close” to the digit. (Again… I hope others will check my thought on this point.)

  4. Ghosting… I haven’t looked at your code. It would probably “work” without “getting fancy”, but for best operation, I’d be inclined to set the code to…

Start with all segaments off.

Select a digit
Turn on necessary segments.
Wait a longish moment
Turn off all segments
Wait a short moment

Repeat as necessary.

===

Hope some of that is useful.

Tom