Switching 7 Segment Display 2.0V with 3.3V Source - Page 1
Forum section: electronics / projects

author: ulix
author_rank: Regular Contributor
timestamp: April 29, 2016, 07:09:20 pm
content: Hi,I want to multiplex a 4 digit 7 segment display. The display will be created out of the Kingbright ACSA03-41SYKWA-F01 (2V, 10mA).I have two questions:-Can I Multiplex every segment as well as every digit?- The Display will be mounted on a PCB, which is for education. Every Segment will be controlled by a MCU pin.The Problem is, how can I limit the current which flows trough the enable Pin for every digit? When there are 2 or 3 Segments turned on, the enable pin would have a current of 10-80mA flowing trough, which will destroy the mcu.Would a circut like this help me?Thank you

author: Buriedcode
author_rank: Super Contributor
timestamp: April 29, 2016, 07:51:08 pm
content: Not entirely sure what your problem is.. but, the standard way of driving seven-segment displays is to have a resistor for each segment LED, and use a transistor (npn fpr common cathode, pnp for common anode) for each digit. Some designs just use an IO for each common, and rely on the fact for a four digit display, each digit is on 25% duty and just hope the IO doesn't blow.

author: ulix
author_rank: Regular Contributor
timestamp: April 29, 2016, 07:55:41 pm
content: Hi,my problem is the voltage drop. I can't get 2V vor the display and run the transistor at saturation, with a 3.3V Source!Yes, I need for my display a pnp transistor....

author: Buriedcode
author_rank: Super Contributor
timestamp: April 29, 2016, 09:54:49 pm
content: I'm still unsure why you can't just use something like this:The resistors will limit the current for each segment. So for 2.0V forward drop of LED, 3.3-2 = 1.3V across the resistor. A 100ohm resistor gives 13 mA per segment.A 10k resistor would work jsut for for driving the transistors, and would mean the IO current for those is I = V/R = 3.3 - 0.6 / 10k = 2.7/10k = 0.27mA.

author: Ian.M
author_rank: Super Contributor
timestamp: April 29, 2016, 10:16:55 pm
content: You want the transistors to be in hard saturation, so you need excess base current. i.e HFE*Ib>IF_LEDI.d go for a factor of two excess. You need to push IF_LEDfairly close to its abs. max. limit to get adequate brightness as the duty cycle will only be 25%. Its likely that you will need lower base resistors than 10K.When calculting the series resistors in each segment line, you need to allow for the transistor Vce_sat and the I/O pin's saturation voltage at the desired current. If the I/O pind aren't rated to drive >20mA with less than 1V drop, you'll need a NPN common emitter transistor as a buffer for each segment line.N.B. the series resistors for the segments are highly dependent on the supply voltage. Making it operate at both 3.3V and 5V would be a lot more complex.

author: mmagin
author_rank: Frequent Contributor
timestamp: April 29, 2016, 10:22:47 pm
content: I think the darlingtons in a ULN2803 would be pretty good for this.

author: Zero999
author_rank: Super Contributor
timestamp: April 29, 2016, 10:23:44 pm
content: Quote from: ulix on April 29, 2016, 07:55:41 pmYou've got it configured as an emitter follower which will work, as long as the base-emitter voltage drop is taken count of when calculating resistor values.The LED current in the attached schematic will be about 20mA.

author: alank2
author_rank: Super Contributor
timestamp: April 30, 2016, 12:25:11 am
content: Generally the idea of multiplexing is to lower the pins required and/or simplify the circuit.You are somewhat locked into multiplexing a digit at a time because the part you mention is a common anode. 4 digits are very easy to multiplex.The short of this is that when that anode is switched/connected to VCC, you can then switch any of that digit's segments to ground through a resistor to light them. You want the resistor on the segment side because a single resistor on the anode side would make one segment bright, two segments less bright, three segments even less bright, etc.Typically you can switch the cathode side through the MCU directly - 10mA is workable for most port pins. You are right that multiplying that by 8 would be too much. That is when you'll need in your case a "high side driver" to switch the anode of each digit on and off. That could be as simple as a logic level FET or a PNP transistor with a base drive resistor.You may find that the LED's are bright enough even at a low enough current to drive the anode pin directly from the mcu. Some AVR"s can drive 40mA, so say 35mA / 8 = 4.375mA per segment. Multiplexing will dim that because you are only running each digit 25% of the time though, but depending on the display it might be workable.If it is for education you are going to want to make sure that even if it stops multiplexing, that the current maximum of each digit is not surpassed.The general idea of multiplexing is going to be an ISR based on a timer in the mcu that does this:take anodes of all digits LOW (with a high side driver/PNP this might be take the mcu pins for the 4 anodes HIGH).digit++if digit=4 then digit=0set pins for the values to be lit for the current digittake anode of the current digit HIGHGood luck!

author: Ian.M
author_rank: Super Contributor
timestamp: April 30, 2016, 12:55:28 am
content: Here's the more complex segment driver for applications where the supply voltage may vary. It drives the LED with an approximately constant current set by the emitter resistor. It also loads the MCU I/O pin a lot less than direct drive, about 1mA @5V and considerably less at 3.3V.N.B. it wont work well with displays with a high Vf with a 3.3V supply, there just isn't enough headroom once you've given up approx 1.3V to the constant current circuit. However with a typical low Vf red display, it will work nicely and will tolerate most forms of student abuse.

author: ulix
author_rank: Regular Contributor
timestamp: April 30, 2016, 06:24:32 pm
content: Thank you all for the great reply!I tried it out, it does work but very bad.What did i do? I multiplexed every segment and every digit. But when there are more digits involved, the intensity goes down. When only one segment is on, the brightness is ok (could be better).As LED to Ground Resistor I used 22Ohms and no Base Resisitor, this is what brought the best brightness. But it is not good.What to do now?

author: alank2
author_rank: Super Contributor
timestamp: April 30, 2016, 07:05:17 pm
content: Quote from: ulix on April 30, 2016, 06:24:32 pmPost your source code and schematic. You will want a base resistor. What transistor type and part number are you using?

author: ulix
author_rank: Regular Contributor
timestamp: April 30, 2016, 07:36:51 pm
content: Hi,I use for this (red leds - Common Anode) a 2n3904.Every Collector of a single Tranistor is connected with Source (3.3V), Emitter to Anode of the display and the Base to the mcu (msp430).Every Cathode of the display is connected to the mcu with a series resistor of 22OhmsThe one digit multiplexing looks like this:Code:#include "io430.h"int main( void ){// Stop watchdog timer to prevent time out resetWDTCTL = WDTPW + WDTHOLD;int i=0;P1DIR = BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7;P1OUT &= ~(BIT0 + BIT1 + BIT6 + BIT7);P1OUT |= (BIT2 + BIT3 + BIT4 + BIT5);while(1){P1OUT &= ~(BIT0 + BIT1 + BIT6 + BIT7);P1OUT |= ( BIT2 + BIT3 + BIT4 + BIT5);P1OUT &= ~(BIT2 + BIT3 + BIT4 + BIT5);P1OUT |= BIT0;for (i=0; i<100; i++);P1OUT &= ~(BIT0 + BIT1 + BIT6 + BIT7);P1OUT |= ( BIT2 + BIT3 + BIT4 + BIT5);P1OUT &= ~(BIT2 + BIT3 + BIT4 + BIT5);P1OUT |= BIT1;for (i=0; i<100; i++);P1OUT &= ~(BIT0 + BIT1 + BIT6 + BIT7);P1OUT |= ( BIT2 + BIT3 + BIT4 + BIT5);P1OUT &= ~(BIT2 + BIT3 + BIT4 + BIT5);P1OUT |= BIT6;for (i=0; i<100; i++);P1OUT &= ~(BIT0 + BIT1 + BIT6 + BIT7);P1OUT |= ( BIT2 + BIT3 + BIT4 + BIT5);P1OUT &= ~(BIT2 + BIT3 + BIT4 + BIT5);P1OUT |= BIT7;for (i=0; i<100; i++);}return 0;}The code for the Segment Multiplexing looks the same, I only switch on one segment and one digit, then the other segment..... next digit...

author: Kleinstein
author_rank: Super Contributor
timestamp: April 30, 2016, 07:53:32 pm
content: Usually there should be 7 or 8 resistors for the segments to the IO pins. So all 7/8 LEDs of one digit can light together.The common anodes are controlled by PNP transistors of P-channel low level MOSFETs (could be difficult to get). There is no more resistor for the Anodes, just the base resistor for PNPs.So there is something like a 100 mV loss for the PNPs. For a 10 mA segment current this would mean about 120 Ohms for the resistors and the IO port ouput resistance. Depending on the µC this means something like 30-100 Ohms for the resistors.Darlington drivers like ULN2003 are a poor choice at such a low voltage.

author: Mechatrommer
author_rank: Super Contributor
timestamp: May 01, 2016, 05:39:17 am
content: if brightness is not an issue, no transistor (direct mcu) will do... i use this setup (picture below), visibility is ok. 5V, 1Kohm to each lcd cathode (7 of them). max current source and sink = (5/1K)*7 = 35mA.

author: Zero999
author_rank: Super Contributor
timestamp: May 01, 2016, 09:32:51 am
content: Quote from: alank2 on April 30, 2016, 07:05:17 pmYou're right about the need for code and a schematic, in order to help but whether a base resistor is required or not, depends on how the transistor is configured. If it's an emitter follower (see my previous post) then there's no need for a base resistor which would just increase the voltage loss.

author: Ian.M
author_rank: Super Contributor
timestamp: May 01, 2016, 10:11:21 am
content: What are the specs of the port pins of the MCU you are using? IIRC most MSP430 series chips have fairly wimpy output source/sink current ratings and a fairly low per port or per chip limit that will cause problems direct driving the display if all segments are on.See:https://e2e.ti.com/support/microcontrollers/msp430/f/166/t/94929

author: ulix
author_rank: Regular Contributor
timestamp: May 05, 2016, 12:32:48 pm
content: Hi,the circuit would look like this.The PNPs because of the higher Current...

author: alank2
author_rank: Super Contributor
timestamp: May 05, 2016, 01:54:55 pm
content: What kind of PNP are you using? Make sure it is not Darlington. I haven't had a chance to look at the code you posted. I often use 1K for the base drive resistor. Also, to prevent one from bleeding into the next you may have to give the transistor time to turn off before changing the active segments so a little delay might need to be added.

author: macboy
author_rank: Super Contributor
timestamp: May 05, 2016, 02:30:14 pm
content: Quote from: ulix on April 29, 2016, 07:55:41 pm2 V is the forward voltage drop across the LEDs in the display. You don't need to supply 2 V, but you use this voltage to determine an appropriate current limiting resistor. R = (3.3 V - 2 V) / IF, where IFis the desired forward current, probably 5 mA or so (the 10 mA spec for the display is the maximum). Then, R = 270 ohm would be a good choice. Once it works, you can determine if you want it a little more or less bright and adjust accordingly.

author: alank2
author_rank: Super Contributor
timestamp: May 05, 2016, 02:49:58 pm
content: I'll add that you also have to take into account what the duty cycle is. If you like how a segment looks at 1mA at 100% duty cycle, you may have to up it to 3mA at 25% duty cycle.

author: Buriedcode
author_rank: Super Contributor
timestamp: May 05, 2016, 03:47:21 pm
content: I'm so confused why there is so many posts about this. The OP must have different requirements or just not understanding what people are saying.From what I gather in the posts from the OP, his seven-segment displays LED's have a forward voltage of 2V. He has a power supply of 3.3V. Almost every seven segment display circuit on the web uses a resistor per segment, and a transistor driver for the common anodes/cathodes. The latest schematic he posted is just fine. And yes, one has to take into account the fact that each display is only 'on' for a a fraction of the total dispaly refresh time, usually (but not always) 1/no. of displays. In his case, for 4 digits, a 25% duty cycle. This means it will appear about half as bright (non-linearity of the human eye). Therefore, the resistors should be chosen to provide maximum current to the LED segments when on, in order to get the highest brightness whilst not going over the limit.An equation I've posted to this guy twice now..R = (Vsupply - Vf)/LED current. Where Vf is the forward voltage of the LED (2.0V apparently). Vsupply is his 3.3V, and LED current, often given at 20mA for continuous.R = 3.3 - 2 / 0.02. = 1.2/0.02 = 60ohm. Nearest = 68 ohm. I would just go for 100 ohm unless the display is in full sunlight, but then there's no hope of reading it without expensive polarising filters.

author: ulix
author_rank: Regular Contributor
timestamp: May 05, 2016, 06:03:01 pm
content: Hi,thanks again for all your replys! The problem isn't that I don't understand the basic concept, I did, but talked to one professor of ours and he said it won't work! I was really really unsure!This is why I asked if every segment and every digit could be multiplexed, not only each digit. => I will multiplex only every digit! (See before)Sorry, I missed to add the name of the Transistor,will use a PNP 2N3906.Thanks a lot,