Best way to multiplex 7-segment
Clint
Posts: 95
I have a four digit, 7-segment common anode LED display. Each segment draws 10mA. I want to multiplex it with the Propeller using the fewest possible I/O and no external circuitry (except for resistors) if possible.
Normally I would have 7 outputs dedicated to the 7 segments and four outputs dedicated to each digit's common anode. But if I multiplex it this way, there would be 70mA through the anode outputs, which excedes the Propellers 40mA output rating.
Is there a better way to wire this and manage the current of the display?
Thanks for any help.
Normally I would have 7 outputs dedicated to the 7 segments and four outputs dedicated to each digit's common anode. But if I multiplex it this way, there would be 70mA through the anode outputs, which excedes the Propellers 40mA output rating.
Is there a better way to wire this and manage the current of the display?
Thanks for any help.
Comments
You're only looking at 4 PNP transistors and their base resistors. If you're considering SMT, this won't take much room.
Post Edited (Mike Green) : 7/4/2010 5:03:46 PM GMT
Scanned them around 80 Hz with an interrupt routine which also scanned for a key down in a 28 switch keypad (arranged 4 x 7; 00..0F for the hex keys and 10..1B for the remaining keys. Required 10 or 20 valid 'key down' events without a key up event to declare a valid key push. Worked slick for the keypads, and no flicker on the LEDs. And adequate brightness for seeing the LEDs. Only one segment is on at a time. The dp-segments were used to indicate certain modes of operation (labeled below the LED dp segment
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
If I have to go to a transister array, that doesn't break the bank, but it means a little more soldering I'd like to avoid.
I'd love to hear other ideas. This may be a dumb one, but what if I connect two output pins to one common anode? I'm guessing there's no guarantee the two outputs would get half current each.
The easiest solution is to use a transistor array and a resistor array for the base resistors. You could use an MOSFET (P-channel) array and save on the resistors, but I don't know of a P-channel 3.3V logic-level array.
Post Edited (Mike Green) : 7/4/2010 6:13:02 PM GMT
4*7= 28 led cathodes to sink to ground.
Are you willing to use 28pins on the prop?
In that case:
In software just make sure that no more than
4pins·are selected as Output with a 0 at any time.
So do only 1 segment for each digit, only A first next B....
loop:
Turn all pins to input.
innerloop: (do it 4 times)
If (letter+innerloop) segement should be on in each digit.
Turn responding·pin from input to output with a 0.
end innerloop
Wait a microsecond.
Inc letter
Go to loop
You would get a 14% duty cycle.
No need to use resistors in the final product.
But while you write the software in would be helpfull
in case it get stuck and leave a LED segment on for to long.
Using less pins, special·NPN Transistor charlingplexing could be
Let me draw something up.
Here is regular charliplexing I did with 8% duty cycle.
http://www.youtube.com/watch?v=8apRaZQbv5w
Post Edited (tonyp12) : 7/4/2010 7:30:34 PM GMT
no tested, but should work.
You would still have to make sure no more than 4 led's are on at anytime.
Turn pin 1 to output with a 1·(select first segment)
Turn pin 2 to input (set A-segment off)
Turn pin 3 to output with a 0 (set B-Segment On lit)
Below will·NOT work, as in this example the·digit A segment (pin2) is also connected to digit 2 NPN·transistor
So it would also turn on·digit 2
Post Edited (tonyp12) : 7/5/2010 1:36:16 PM GMT
*EDIT* Wow thank you for the response! This concept looks promising. I'll investigate further.
Post Edited (Clint) : 7/4/2010 10:07:50 PM GMT
If you are using an SX chip, those are great for directly driving multiple 7 segment displays. There is even a sample application of a serial driven 4 digit 7 segment display in the SX/B examples on the parallax website and in the IDE. It is one of my primary uses for the SX. You end up using only one pin on the prop. I bought a maxim driver and never used it because the SX works pretty well and handles the current. I'm sure it won't be as easy on the propeller due to tighter current limitations, though mike green's approach of four NPNs is a good one too.
Do let us know what approach you decide to take!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Talbot
New Market, MD, USA
Would it be possible to use a cheap .23
317T with a couple of resistors to set it
to the proper drive V for the LEDs and then
eliminate all the LED resistors and just switch
the LEDs with cheap npn transistors controlled
by the props pins...directly from the output V
of the regulator ???
Usually there is 5v on any board that you
could feed the 317T with. This regulator
could drive a lot of LEDs I would think.
You could adjust brightness by varying
the regulators output V. You could even use a
pot to alter between barely on and full brightness.
If you had a lot of LEDs then it would be nice
to just eliminate all those resistors.
I love charlieplexing...there is just something
cool about driving so many LEDs with just
a few pins. it's elegant.
The current limiting resistors for the LEDs would be in the leads to the Prop I/O pins for the segment cathodes. 200 Ohms looks like it would work at 3.3V with most red LEDs.. That's 3.3V - 0.3V {for the saturated switching transistor} - 0.3V {for the segment driver I/O pin} - 1.7V {for the LED itself (if red)} = 1V. By Ohm's Law, with a 5mA LED current, that gives 200 Ohms for the current limiting resistor.· For 10mA, they'd be 100 Ohms.
Post Edited (Mike Green) : 7/5/2010 5:48:28 PM GMT
So far the solution I like the most, if it will work, is to run the segments at lower current. That would only require current limiting resistors, which I can get in a DIP array. Second choice is transistors for the common anodes. Until my prop arrives and I start playing with it, I'm not really sure what direction I'll take but I really appreciate all the discussion and info.
There are already objects in the obex for driving them
best regards
Stefan
Firstly, charlieplexing works great..... for discrete leds. And then only if you require but a few to appear ON at the same time. In fact only one IS on at a time, and the multiplexing ratios get absurd very quickly as the need for more "simultaneous" leds goes up, unless you can do groupings where certain combinations can never happen.
If you wish to use an SX, then the 4 digit display can be driven (multiplexed) directly from the I/O pins.... no transistors needed. Furthermore adding software to combine in your encoder is a piece of cake, and you will NOT get any flickering. But you must operate the interrupt with a scheduler rather than directly on the routines, and I can show you how to do that by looking at my contest entry from years ago. Multi-threading RTOS for the SX.
Cheers,
Peter (pjv)
charlieplexing·i believe·can be done with two common anode & two common cathode displays.. ill SIM it in the am.. gonna let this one simmer on the burner overnight.. interesting idea indeed . . . i love good electronic·mental riddles..
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Quicker answers in the #propeller chat channel on freenode.net. Don't know squat about IRC? Download Pigin! So easy a caveman could do it...
http://folding.stanford.edu/ - Donating some CPU/GPU downtime just might lead to a cure for cancer! My team stats.
Post Edited (RinksCustoms) : 7/6/2010 3:17:04 PM GMT
You'll need:
- 2 common anode 7 seg disp
- 2 commom cathode 7 seg disp
- 7 330 ohm resistors
- 9 I/O's (one I/O for every 2 additional displays)
see picture for connections. How to make it work: you have your arbitrary bit patterns preset·for a seven segment display in lookdown/up's to be output on pins 0..7, it depends on which digit you are writing to but lets say were putting a "3" on the least significant digit, so·your bit pattern would be ("a" being MSB and "g" being LSB in blue) 0X 1111001. The MSB here represents the display B pin to the prop (red) wich we set to output Low. The green X in this example represents the display A connection, which is set to input. To put the "3" on U4 you simply invert the whole bit pattern and keep the "X" pin an input. You would switch the 0X to X0 bits to select the U1/U3 displays. The 330 ohm resistors/dip pack are for current limiting the segments to 5mA. Im a bit rusty on coding spin so ill spare some ridicule and embarassment by not coding an example right now. This is the bare minimum solution to what your trying to do.Hope this helps.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Quicker answers in the #propeller chat channel on freenode.net. Don't know squat about IRC? Download Pigin! So easy a caveman could do it...
http://folding.stanford.edu/ - Donating some CPU/GPU downtime just might lead to a cure for cancer! My team stats.
Post Edited (RinksCustoms) : 7/6/2010 6:26:02 PM GMT
(Provided that·Clint can change two of his common anode displays to common cathode)
5mA would normally be enough, here it is combined with 25% duty cycle.....but it should be worth trying.
Post Edited (nohab) : 7/7/2010 5:43:15 AM GMT