EmbeddedRelated.com
Forums

Interfacing an LPC to a cluster of 7 segment displays

Started by Jean-Sebastien Stoezel December 6, 2009
Hi,

I would like to interface 9 7-segment displays to an LPC
microcontroller. I will be using a standard multiplexing scheme, with
an enabler for each digit, and shared segment lines for all.

I have several questions regarding the way the multiplexing has to be
handled, and the way it needs to be interfaced.

- First, isn't 9 digits too much for multiplexing? Am I going to
notice flickering if I try to drive too many digits?
- I would also like to control the intensity for each digit
programmatically, that is PWMing the enabler line. Same question here,
are 9 digits too much for this kind of control?
- LPC devices are limited to 4mA on their outputs so I guess I need to
use transistors to driver the segments and the digit enablers (the
seven segment displays require 20mA per segment). I've seen schematics
with NMOS, bipolars... What is best here? What do you have to take
into consideration for making a choice? Switching frequency,
impedance?
- Could anybody provide a schematic for interfacing the
microcontroller to a 7 segment display, knowing there needs to be a
driver for each line, and a driver for the digit enabler?

Thanks!
Jean

An Engineer's Guide to the LPC2100 Series

Hi,

As long as each digit gets driven more than about 60 times each second, you shouldn't see flicker. The human eye isn't fast enough to see things that change quicker than that. In convenient round numbers, if you visit a digit for one millisecond, then move on to the next, for a total scan time of nine milliseconds, you won't have to worry about flicker. LPC class controllers are plenty fast enough to keep up with that and have lots of processor left over.

PWMing the enable line should work fine, provided the thing driving the enable line can handle the current. (More about that in a moment.) To avoid strange visual artifacts, the PWM frequency should be substantially higher than your scan frequency. If you're driving each digit for one millisecond, pick a PWM frequency around 10 kHz or 20 kHz or so.

Here's your key design challenge: if you are scanning nine digits, each digit is only on for one ninth of the total time. Therefore, it's only one ninth as bright. You can compensate for that by increasing the current through the LEDs. If you drive each digit with nine times the current, for one ninth of the time, it will appear to be the same brightness as an LED driven with one times the current for 100% of the time. There's a limit, though. If you try and force too much current through the LED you'll damage it. This is a common way to drive LEDs, so many LED spec sheets have a peak pulse current specification. If you're not sure, post the LED part number and I'll take a look at it. This peak current spec will probably set the upper limit for how bright your scanned LEDs can appear.

You're right that you're not going to get an LPC output pin to supply sufficient current directly. A transistor connected to the outputs will fix that problem nicely. The switching frequencies required (a few tens of kHz, tops) are quite low by transistor standards and there aren't any large switched capacitive or inductive elements to complicate your design. You can probably safely ignore all the frequency-related aspects of selecting a transistor since any one you pick will be fast enough. You can treat it as a DC circuit which is either on or off. What you do need to be worried about is the ability of the transistor to handle the current you'll be switching, and, how much power it will dissipate when it's turned on. The other consideration is whether you can drive the transistor with the relatively small voltages (FET types) or currents (bipolar types) available from an LPC pin.

I figure you'll need 17 transistors. Seven for the segment drivers, nine for the digit selects, and one for the PWM brightness control. You might be able to do it with less with a little clever software.

I would hesitate to give you a schematic without knowing a bit more about your circuit. Are your displays common-anode or common-cathode? What voltage is supplying the LEDs? Is your processor running at 3.3V?

Without doing any calculations, my gut feel is that is should work. My greatest concern would be whether the LEDs will be bright enough.

Cheers, Norman

--- In l..., Jean-Sebastien Stoezel wrote:
>
> Hi,
>
> I would like to interface 9 7-segment displays to an LPC
> microcontroller. I will be using a standard multiplexing scheme, with
> an enabler for each digit, and shared segment lines for all.
>
> I have several questions regarding the way the multiplexing has to be
> handled, and the way it needs to be interfaced.
>
> - First, isn't 9 digits too much for multiplexing? Am I going to
> notice flickering if I try to drive too many digits?
> - I would also like to control the intensity for each digit
> programmatically, that is PWMing the enabler line. Same question here,
> are 9 digits too much for this kind of control?
> - LPC devices are limited to 4mA on their outputs so I guess I need to
> use transistors to driver the segments and the digit enablers (the
> seven segment displays require 20mA per segment). I've seen schematics
> with NMOS, bipolars... What is best here? What do you have to take
> into consideration for making a choice? Switching frequency,
> impedance?
> - Could anybody provide a schematic for interfacing the
> microcontroller to a 7 segment display, knowing there needs to be a
> driver for each line, and a driver for the digit enabler?
>
> Thanks!
> Jean
>

Norman:

Thank you for taking the time to provide such a detailed answer.

You are right the number of transistors could be reduced by using techniques
such as charlieplexing.

I plan to use common cathode displays, but that's because I've seen them
used in most schematics I found on the web. I plan to supply the LEDs at the
same voltage as the microcontroller, that is 3.3V.

This is the type of display I want to use:
http://www.KingbrightUSA.com/images/catalog/SPEC/ACPSC04-41SURKWA.pdf

I'm not sure what I was thinking when I wrote the initial email, these are
not 7-segment displays, these are 16 segments... I guess the concept is the
sam,e though the digit enabler transistor have to withstand twice the
current.

Maximum brightness is a concern in my application since these displays will
be used outside. I've chosen very high brightness display, as I hope this
will compensate for the loss of brightness due to the multiplexing.

What would you use as drivers? From what I understand bipolars are driven
using current, MOSFET using voltage...
Say each segment requires 20mA (30mA is the absolute maximum rating), then
worst case supply for a digit will be 320mA. If I use bipolars to enable the
digits then this may put a bit more strain on the microcontroller's outputs
(with a gain of 100, the base current would be at 3.2mA, getting closer to
the 4mA limit).

Ideally I would like to use a schematic where the current for each segment
is set with only one resistor. This is so I can easily change the maximum
current for all the segments and limit the part count.
For now though I haven't figured that out, and I plan to use a transistor in
"series" with each segment, and a transistor in "series" with each digit
enabler... I've also seen schematics where the segments are driven with a
transistor as an inverter...

What do you think?

Thanks again for your help,
Jean
On Sat, Dec 5, 2009 at 11:48 PM, Norman wrote:

> Hi,
>
> As long as each digit gets driven more than about 60 times each second, you
> shouldn't see flicker. The human eye isn't fast enough to see things that
> change quicker than that. In convenient round numbers, if you visit a digit
> for one millisecond, then move on to the next, for a total scan time of nine
> milliseconds, you won't have to worry about flicker. LPC class controllers
> are plenty fast enough to keep up with that and have lots of processor left
> over.
>
> PWMing the enable line should work fine, provided the thing driving the
> enable line can handle the current. (More about that in a moment.) To avoid
> strange visual artifacts, the PWM frequency should be substantially higher
> than your scan frequency. If you're driving each digit for one millisecond,
> pick a PWM frequency around 10 kHz or 20 kHz or so.
>
> Here's your key design challenge: if you are scanning nine digits, each
> digit is only on for one ninth of the total time. Therefore, it's only one
> ninth as bright. You can compensate for that by increasing the current
> through the LEDs. If you drive each digit with nine times the current, for
> one ninth of the time, it will appear to be the same brightness as an LED
> driven with one times the current for 100% of the time. There's a limit,
> though. If you try and force too much current through the LED you'll damage
> it. This is a common way to drive LEDs, so many LED spec sheets have a peak
> pulse current specification. If you're not sure, post the LED part number
> and I'll take a look at it. This peak current spec will probably set the
> upper limit for how bright your scanned LEDs can appear.
>
> You're right that you're not going to get an LPC output pin to supply
> sufficient current directly. A transistor connected to the outputs will fix
> that problem nicely. The switching frequencies required (a few tens of kHz,
> tops) are quite low by transistor standards and there aren't any large
> switched capacitive or inductive elements to complicate your design. You can
> probably safely ignore all the frequency-related aspects of selecting a
> transistor since any one you pick will be fast enough. You can treat it as a
> DC circuit which is either on or off. What you do need to be worried about
> is the ability of the transistor to handle the current you'll be switching,
> and, how much power it will dissipate when it's turned on. The other
> consideration is whether you can drive the transistor with the relatively
> small voltages (FET types) or currents (bipolar types) available from an LPC
> pin.
>
> I figure you'll need 17 transistors. Seven for the segment drivers, nine
> for the digit selects, and one for the PWM brightness control. You might be
> able to do it with less with a little clever software.
>
> I would hesitate to give you a schematic without knowing a bit more about
> your circuit. Are your displays common-anode or common-cathode? What voltage
> is supplying the LEDs? Is your processor running at 3.3V?
>
> Without doing any calculations, my gut feel is that is should work. My
> greatest concern would be whether the LEDs will be bright enough.
>
> Cheers, Norman
> --- In l... , Jean-Sebastien
> Stoezel wrote:
> >
> > Hi,
> >
> > I would like to interface 9 7-segment displays to an LPC
> > microcontroller. I will be using a standard multiplexing scheme, with
> > an enabler for each digit, and shared segment lines for all.
> >
> > I have several questions regarding the way the multiplexing has to be
> > handled, and the way it needs to be interfaced.
> >
> > - First, isn't 9 digits too much for multiplexing? Am I going to
> > notice flickering if I try to drive too many digits?
> > - I would also like to control the intensity for each digit
> > programmatically, that is PWMing the enabler line. Same question here,
> > are 9 digits too much for this kind of control?
> > - LPC devices are limited to 4mA on their outputs so I guess I need to
> > use transistors to driver the segments and the digit enablers (the
> > seven segment displays require 20mA per segment). I've seen schematics
> > with NMOS, bipolars... What is best here? What do you have to take
> > into consideration for making a choice? Switching frequency,
> > impedance?
> > - Could anybody provide a schematic for interfacing the
> > microcontroller to a 7 segment display, knowing there needs to be a
> > driver for each line, and a driver for the digit enabler?
> >
> > Thanks!
> > Jean
> >
>
I drive 16 7-segment displays (arranged as 4 4-digit displays) using a Maxim chip. I can't lay my hands on the board right now but it is probably the MAX6954 although Maxim has others.

When driving 16 segment displays, the chip can only multiplex 8 digits - bummer. Everything has a limit...

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

The advantage to this approach is that I get far more functionality and I only tie up 3 pins on the uC - SSEL, MOSI and SCK from the SPI gadget. I only change the contents, I don't tie up a bunch of pins and I certainly don't use much uC time.

Actually, this particular display is tied to an FPGA project.

Richard

Hey Richard,

I used an Max6951 on my previous board. They work well with 7-segment
displays. For my next board I'm switching to alphanumeric displays. The
max6951 doesn't do alphanumeric displays. These chips are also expensive.

Another thing is that I'm trying to limit the part count on my board. I end
up with a microcontroller that has enough unused pins to control all the
displays, and don't take advantage. This is why I really want tot do the
controlling with the microcontroller and why I'm not using the max chips.

Thanks for your help though,
Jean

On Sun, Dec 6, 2009 at 8:35 AM, rtstofer wrote:

> I drive 16 7-segment displays (arranged as 4 4-digit displays) using a
> Maxim chip. I can't lay my hands on the board right now but it is probably
> the MAX6954 although Maxim has others.
>
> When driving 16 segment displays, the chip can only multiplex 8 digits -
> bummer. Everything has a limit...
>
> http://www.maxim-ic.com/appnotes.cfm/appnote_number/3212
>
> The advantage to this approach is that I get far more functionality and I
> only tie up 3 pins on the uC - SSEL, MOSI and SCK from the SPI gadget. I
> only change the contents, I don't tie up a bunch of pins and I certainly
> don't use much uC time.
>
> Actually, this particular display is tied to an FPGA project.
>
> Richard
>
>
>
Hi,

>>worst case supply for a digit will be 320mA.
Usually total current through a microcontroller is limited less than sum of
current of outputs. It is better to check in datasheet.

Best regards
Vladimir
----- Original Message -----
From: "Jean-Sebastien Stoezel"
To:
Sent: Sunday, December 06, 2009 12:36 PM
Subject: Re: [lpc2000] Re: Interfacing an LPC to a cluster of 7 segment
displays
Norman:

Thank you for taking the time to provide such a detailed answer.

You are right the number of transistors could be reduced by using techniques
such as charlieplexing.

I plan to use common cathode displays, but that's because I've seen them
used in most schematics I found on the web. I plan to supply the LEDs at the
same voltage as the microcontroller, that is 3.3V.

This is the type of display I want to use:
http://www.KingbrightUSA.com/images/catalog/SPEC/ACPSC04-41SURKWA.pdf

I'm not sure what I was thinking when I wrote the initial email, these are
not 7-segment displays, these are 16 segments... I guess the concept is the
sam,e though the digit enabler transistor have to withstand twice the
current.

Maximum brightness is a concern in my application since these displays will
be used outside. I've chosen very high brightness display, as I hope this
will compensate for the loss of brightness due to the multiplexing.

What would you use as drivers? From what I understand bipolars are driven
using current, MOSFET using voltage...
Say each segment requires 20mA (30mA is the absolute maximum rating), then
worst case supply for a digit will be 320mA. If I use bipolars to enable the
digits then this may put a bit more strain on the microcontroller's outputs
(with a gain of 100, the base current would be at 3.2mA, getting closer to
the 4mA limit).

Ideally I would like to use a schematic where the current for each segment
is set with only one resistor. This is so I can easily change the maximum
current for all the segments and limit the part count.
For now though I haven't figured that out, and I plan to use a transistor in
"series" with each segment, and a transistor in "series" with each digit
enabler... I've also seen schematics where the segments are driven with a
transistor as an inverter...

What do you think?

Thanks again for your help,
Jean
On Sat, Dec 5, 2009 at 11:48 PM, Norman wrote:

> Hi,
>
> As long as each digit gets driven more than about 60 times each second,
> you
> shouldn't see flicker. The human eye isn't fast enough to see things that
> change quicker than that. In convenient round numbers, if you visit a
> digit
> for one millisecond, then move on to the next, for a total scan time of
> nine
> milliseconds, you won't have to worry about flicker. LPC class controllers
> are plenty fast enough to keep up with that and have lots of processor
> left
> over.
>
> PWMing the enable line should work fine, provided the thing driving the
> enable line can handle the current. (More about that in a moment.) To
> avoid
> strange visual artifacts, the PWM frequency should be substantially higher
> than your scan frequency. If you're driving each digit for one
> millisecond,
> pick a PWM frequency around 10 kHz or 20 kHz or so.
>
> Here's your key design challenge: if you are scanning nine digits, each
> digit is only on for one ninth of the total time. Therefore, it's only one
> ninth as bright. You can compensate for that by increasing the current
> through the LEDs. If you drive each digit with nine times the current, for
> one ninth of the time, it will appear to be the same brightness as an LED
> driven with one times the current for 100% of the time. There's a limit,
> though. If you try and force too much current through the LED you'll
> damage
> it. This is a common way to drive LEDs, so many LED spec sheets have a
> peak
> pulse current specification. If you're not sure, post the LED part number
> and I'll take a look at it. This peak current spec will probably set the
> upper limit for how bright your scanned LEDs can appear.
>
> You're right that you're not going to get an LPC output pin to supply
> sufficient current directly. A transistor connected to the outputs will
> fix
> that problem nicely. The switching frequencies required (a few tens of
> kHz,
> tops) are quite low by transistor standards and there aren't any large
> switched capacitive or inductive elements to complicate your design. You
> can
> probably safely ignore all the frequency-related aspects of selecting a
> transistor since any one you pick will be fast enough. You can treat it as
> a
> DC circuit which is either on or off. What you do need to be worried about
> is the ability of the transistor to handle the current you'll be
> switching,
> and, how much power it will dissipate when it's turned on. The other
> consideration is whether you can drive the transistor with the relatively
> small voltages (FET types) or currents (bipolar types) available from an
> LPC
> pin.
>
> I figure you'll need 17 transistors. Seven for the segment drivers, nine
> for the digit selects, and one for the PWM brightness control. You might
> be
> able to do it with less with a little clever software.
>
> I would hesitate to give you a schematic without knowing a bit more about
> your circuit. Are your displays common-anode or common-cathode? What
> voltage
> is supplying the LEDs? Is your processor running at 3.3V?
>
> Without doing any calculations, my gut feel is that is should work. My
> greatest concern would be whether the LEDs will be bright enough.
>
> Cheers, Norman
> --- In l... , Jean-Sebastien
> Stoezel wrote:
> >
> > Hi,
> >
> > I would like to interface 9 7-segment displays to an LPC
> > microcontroller. I will be using a standard multiplexing scheme, with
> > an enabler for each digit, and shared segment lines for all.
> >
> > I have several questions regarding the way the multiplexing has to be
> > handled, and the way it needs to be interfaced.
> >
> > - First, isn't 9 digits too much for multiplexing? Am I going to
> > notice flickering if I try to drive too many digits?
> > - I would also like to control the intensity for each digit
> > programmatically, that is PWMing the enabler line. Same question here,
> > are 9 digits too much for this kind of control?
> > - LPC devices are limited to 4mA on their outputs so I guess I need to
> > use transistors to driver the segments and the digit enablers (the
> > seven segment displays require 20mA per segment). I've seen schematics
> > with NMOS, bipolars... What is best here? What do you have to take
> > into consideration for making a choice? Switching frequency,
> > impedance?
> > - Could anybody provide a schematic for interfacing the
> > microcontroller to a 7 segment display, knowing there needs to be a
> > driver for each line, and a driver for the digit enabler?
> >
> > Thanks!
> > Jean
>
Hi Jean,

You're very welcome.

I understand from your replies to Kurt and Richard that you'd like to avoid using dedicated driver chips since you have lots of I/O pins. That makes sense, however, I'm going to steer you in the dedicated driver direction as well. One device I've used that has worked well is:

http://www.onsemi.com/pub_link/Collateral/CAT4016-D.PDF

It's meant for common-anode rather than common-cathode displays, but it doesn't sound like you're too locked into your particular display. Alternately, you may be able to find a common-cathode compatible equivalent device. One CAT4016 can drive all 16 LED's in one of your displays.

Since I'm suggesting you spend a fair bit more money on LED driver circuitry, I should also give you my reasons:

1) LED brightness: this is a key performance spec for your application, and it could be a problem in the current scanned arrangement. On the datasheet you posted there's a "Peak Forward Current" in the Absolute Maximum Ratings section of 185 mA. With 9 displays, this suggests you can get the equivalent brightness of 20mA at 100% duty cycle, which is about where you want to be. However, as you're clearly aware, it's a bit unwise to use a spec in the "Absolute Maximum Ratings" section for any purpose other than ensuring the part doesn't go up in smoke during a fault condition. There isn't a peak forward current spec elsewhere in the datasheet, so, to be safe, I would probably estimate a number based on the relationship between the recommended DC forward current (20 mA) and the Absolute Max DC forward current (30mA). That 2/3 relationship suggests a safer peak forward current that will deliver about 2/3 of the maximum brightness. (By all means, question my estimate and get a definitive answer from Kingbright. I'm only guessing - they actually know.)

2) A more difficult problem is related to the supply voltage. You nominally have 3.3V available. (Less if the actual voltage is within spec but a bit lower than 3.3V.) From the spec sheet, with 20mA forward current the LED forward voltage drop could be as high as 2.5V. The voltage drop increases with increasing current. It's not clear what the voltage drop will be when pulsed at, say, 125mA, (or 185mA) but it's already problematic at 20mA. Here's why: 3.3V - 2.5V = 800 mV. The simple scanned arrangement we're considering has three switching elements in series with each LED. (segment driver, display enable, and brightness control) Each will have a voltage drop, (current x RDS-on for a FET, or, Vce.sat for a bipolar transistor). In addition you were hoping to set the current through each LED with a series resistor. The exact voltage-drop numbers will depend on the transistors chosen, but, three of them in series will likely use up most or all of the 800 mV you have available. This leaves little or no voltage drop for the current-setting resistor. The current that actually flows is going to be very sensitive to the unique characteristics of each of the individual LEDs and transistors. These will vary from device to device, and, with environmental factors such as temperature. You probably won't get the peak current you want, and, it won't be consistent. The bottom line is, I don't think there's enough supply voltage available to do the job properly.

3) Visual quality: the CAT4016 pulls a specified current through each LED. Since brightness is proportional to current, this means you'll get good segment-to-segment and display-to-display intensity matching, and, it will be less sensitive to changes in supply voltage, temperature, etc. (This isn't the only current-regulated LED driver out there. The moral is that for the best possible display quality, use a current-regulated type of driver - whoever makes it.)

4) Convenience: This device, or one like it, will solve all your problems. You can connect a PWM output to the BLANK input to control the intensity of the display. The display current is set by a single resistor which is something else you were looking for. It will drive as much current as you need, and, the 300 mV drop is well within the 600-800mV you have available. Finally, the interface is easy. It depends, of course, on how many of these you're going to build. If it isn't a large number, it's probably worth it just to spec the more expensive solution and be done with it. Given the tricky complications introduced by the low supply voltage, you might save yourself a lot of grief down the road by going with a pre-packaged solution.

To quickly address some of your other questions:
a) MOSFETs. These are indeed voltage-controlled switches. Typically you need to force a voltage difference between the gate and source and that opens or closes the channel between the source and drain terminals. The potential difficulty in your case is that you often need more than the 3.3V you have available in order to get the transistor turned fully on. There are devices that switch with low voltages, but, it's something you'd want to pay close attention to.
b) Bipolar transistors: You're right here as well (current activated) and you have the right formula based on the current gain of the transistor. Lower current load on a processor pin is definitely better, but, if the manufacturer spec says 4mA, then you're entitled to ask it to give you all four mA.
c) I'm not clever enough to come up with a simple scanned circuit using transistors in which you can set the per-segment current with a single resistor. The problem is that the current that flows through the shared path (common cathode or common anode) depends on how many segments are lit. A single fixed-resistance element will have a different voltage drop depending on the number of segments that are being driven. If anyone knows of a simple way to deal with that, I'd be interested in knowing what it is.

Hope that helps. Good luck.
Norman

--- In l..., Jean-Sebastien Stoezel wrote:
>
> Norman:
>
> Thank you for taking the time to provide such a detailed answer.
>
> You are right the number of transistors could be reduced by using techniques
> such as charlieplexing.
>
> I plan to use common cathode displays, but that's because I've seen them
> used in most schematics I found on the web. I plan to supply the LEDs at the
> same voltage as the microcontroller, that is 3.3V.
>
> This is the type of display I want to use:
> http://www.KingbrightUSA.com/images/catalog/SPEC/ACPSC04-41SURKWA.pdf
>
> I'm not sure what I was thinking when I wrote the initial email, these are
> not 7-segment displays, these are 16 segments... I guess the concept is the
> sam,e though the digit enabler transistor have to withstand twice the
> current.
>
> Maximum brightness is a concern in my application since these displays will
> be used outside. I've chosen very high brightness display, as I hope this
> will compensate for the loss of brightness due to the multiplexing.
>
> What would you use as drivers? From what I understand bipolars are driven
> using current, MOSFET using voltage...
> Say each segment requires 20mA (30mA is the absolute maximum rating), then
> worst case supply for a digit will be 320mA. If I use bipolars to enable the
> digits then this may put a bit more strain on the microcontroller's outputs
> (with a gain of 100, the base current would be at 3.2mA, getting closer to
> the 4mA limit).
>
> Ideally I would like to use a schematic where the current for each segment
> is set with only one resistor. This is so I can easily change the maximum
> current for all the segments and limit the part count.
> For now though I haven't figured that out, and I plan to use a transistor in
> "series" with each segment, and a transistor in "series" with each digit
> enabler... I've also seen schematics where the segments are driven with a
> transistor as an inverter...
>
> What do you think?
>
> Thanks again for your help,
> Jean
> On Sat, Dec 5, 2009 at 11:48 PM, Norman wrote:
>
> >
> >
> > Hi,
> >
> > As long as each digit gets driven more than about 60 times each second, you
> > shouldn't see flicker. The human eye isn't fast enough to see things that
> > change quicker than that. In convenient round numbers, if you visit a digit
> > for one millisecond, then move on to the next, for a total scan time of nine
> > milliseconds, you won't have to worry about flicker. LPC class controllers
> > are plenty fast enough to keep up with that and have lots of processor left
> > over.
> >
> > PWMing the enable line should work fine, provided the thing driving the
> > enable line can handle the current. (More about that in a moment.) To avoid
> > strange visual artifacts, the PWM frequency should be substantially higher
> > than your scan frequency. If you're driving each digit for one millisecond,
> > pick a PWM frequency around 10 kHz or 20 kHz or so.
> >
> > Here's your key design challenge: if you are scanning nine digits, each
> > digit is only on for one ninth of the total time. Therefore, it's only one
> > ninth as bright. You can compensate for that by increasing the current
> > through the LEDs. If you drive each digit with nine times the current, for
> > one ninth of the time, it will appear to be the same brightness as an LED
> > driven with one times the current for 100% of the time. There's a limit,
> > though. If you try and force too much current through the LED you'll damage
> > it. This is a common way to drive LEDs, so many LED spec sheets have a peak
> > pulse current specification. If you're not sure, post the LED part number
> > and I'll take a look at it. This peak current spec will probably set the
> > upper limit for how bright your scanned LEDs can appear.
> >
> > You're right that you're not going to get an LPC output pin to supply
> > sufficient current directly. A transistor connected to the outputs will fix
> > that problem nicely. The switching frequencies required (a few tens of kHz,
> > tops) are quite low by transistor standards and there aren't any large
> > switched capacitive or inductive elements to complicate your design. You can
> > probably safely ignore all the frequency-related aspects of selecting a
> > transistor since any one you pick will be fast enough. You can treat it as a
> > DC circuit which is either on or off. What you do need to be worried about
> > is the ability of the transistor to handle the current you'll be switching,
> > and, how much power it will dissipate when it's turned on. The other
> > consideration is whether you can drive the transistor with the relatively
> > small voltages (FET types) or currents (bipolar types) available from an LPC
> > pin.
> >
> > I figure you'll need 17 transistors. Seven for the segment drivers, nine
> > for the digit selects, and one for the PWM brightness control. You might be
> > able to do it with less with a little clever software.
> >
> > I would hesitate to give you a schematic without knowing a bit more about
> > your circuit. Are your displays common-anode or common-cathode? What voltage
> > is supplying the LEDs? Is your processor running at 3.3V?
> >
> > Without doing any calculations, my gut feel is that is should work. My
> > greatest concern would be whether the LEDs will be bright enough.
> >
> > Cheers, Norman
> >
> >
> > --- In l... , Jean-Sebastien
> > Stoezel wrote:
> > >
> > > Hi,
> > >
> > > I would like to interface 9 7-segment displays to an LPC
> > > microcontroller. I will be using a standard multiplexing scheme, with
> > > an enabler for each digit, and shared segment lines for all.
> > >
> > > I have several questions regarding the way the multiplexing has to be
> > > handled, and the way it needs to be interfaced.
> > >
> > > - First, isn't 9 digits too much for multiplexing? Am I going to
> > > notice flickering if I try to drive too many digits?
> > > - I would also like to control the intensity for each digit
> > > programmatically, that is PWMing the enabler line. Same question here,
> > > are 9 digits too much for this kind of control?
> > > - LPC devices are limited to 4mA on their outputs so I guess I need to
> > > use transistors to driver the segments and the digit enablers (the
> > > seven segment displays require 20mA per segment). I've seen schematics
> > > with NMOS, bipolars... What is best here? What do you have to take
> > > into consideration for making a choice? Switching frequency,
> > > impedance?
> > > - Could anybody provide a schematic for interfacing the
> > > microcontroller to a 7 segment display, knowing there needs to be a
> > > driver for each line, and a driver for the digit enabler?
> > >
> > > Thanks!
> > > Jean
> > >
> >
> >
>

Thanks al for taking the time to answer my question in such details.

Jean

On Sun, Dec 6, 2009 at 1:43 PM, Norman wrote:

> Hi Jean,
>
> You're very welcome.
>
> I understand from your replies to Kurt and Richard that you'd like to avoid
> using dedicated driver chips since you have lots of I/O pins. That makes
> sense, however, I'm going to steer you in the dedicated driver direction as
> well. One device I've used that has worked well is:
>
> http://www.onsemi.com/pub_link/Collateral/CAT4016-D.PDF
>
> It's meant for common-anode rather than common-cathode displays, but it
> doesn't sound like you're too locked into your particular display.
> Alternately, you may be able to find a common-cathode compatible equivalent
> device. One CAT4016 can drive all 16 LED's in one of your displays.
>
> Since I'm suggesting you spend a fair bit more money on LED driver
> circuitry, I should also give you my reasons:
>
> 1) LED brightness: this is a key performance spec for your application, and
> it could be a problem in the current scanned arrangement. On the datasheet
> you posted there's a "Peak Forward Current" in the Absolute Maximum Ratings
> section of 185 mA. With 9 displays, this suggests you can get the equivalent
> brightness of 20mA at 100% duty cycle, which is about where you want to be.
> However, as you're clearly aware, it's a bit unwise to use a spec in the
> "Absolute Maximum Ratings" section for any purpose other than ensuring the
> part doesn't go up in smoke during a fault condition. There isn't a peak
> forward current spec elsewhere in the datasheet, so, to be safe, I would
> probably estimate a number based on the relationship between the recommended
> DC forward current (20 mA) and the Absolute Max DC forward current (30mA).
> That 2/3 relationship suggests a safer peak forward current that will
> deliver about 2/3 of the maximum brightness. (By all means, question my
> estimate and get a definitive answer from Kingbright. I'm only guessing -
> they actually know.)
>
> 2) A more difficult problem is related to the supply voltage. You nominally
> have 3.3V available. (Less if the actual voltage is within spec but a bit
> lower than 3.3V.) From the spec sheet, with 20mA forward current the LED
> forward voltage drop could be as high as 2.5V. The voltage drop increases
> with increasing current. It's not clear what the voltage drop will be when
> pulsed at, say, 125mA, (or 185mA) but it's already problematic at 20mA.
> Here's why: 3.3V - 2.5V = 800 mV. The simple scanned arrangement we're
> considering has three switching elements in series with each LED. (segment
> driver, display enable, and brightness control) Each will have a voltage
> drop, (current x RDS-on for a FET, or, Vce.sat for a bipolar transistor). In
> addition you were hoping to set the current through each LED with a series
> resistor. The exact voltage-drop numbers will depend on the transistors
> chosen, but, three of them in series will likely use up most or all of the
> 800 mV you have available. This leaves little or no voltage drop for the
> current-setting resistor. The current that actually flows is going to be
> very sensitive to the unique characteristics of each of the individual LEDs
> and transistors. These will vary from device to device, and, with
> environmental factors such as temperature. You probably won't get the peak
> current you want, and, it won't be consistent. The bottom line is, I don't
> think there's enough supply voltage available to do the job properly.
>
> 3) Visual quality: the CAT4016 pulls a specified current through each LED.
> Since brightness is proportional to current, this means you'll get good
> segment-to-segment and display-to-display intensity matching, and, it will
> be less sensitive to changes in supply voltage, temperature, etc. (This
> isn't the only current-regulated LED driver out there. The moral is that for
> the best possible display quality, use a current-regulated type of driver -
> whoever makes it.)
>
> 4) Convenience: This device, or one like it, will solve all your problems.
> You can connect a PWM output to the BLANK input to control the intensity of
> the display. The display current is set by a single resistor which is
> something else you were looking for. It will drive as much current as you
> need, and, the 300 mV drop is well within the 600-800mV you have available.
> Finally, the interface is easy. It depends, of course, on how many of these
> you're going to build. If it isn't a large number, it's probably worth it
> just to spec the more expensive solution and be done with it. Given the
> tricky complications introduced by the low supply voltage, you might save
> yourself a lot of grief down the road by going with a pre-packaged solution.
>
> To quickly address some of your other questions:
> a) MOSFETs. These are indeed voltage-controlled switches. Typically you
> need to force a voltage difference between the gate and source and that
> opens or closes the channel between the source and drain terminals. The
> potential difficulty in your case is that you often need more than the 3.3V
> you have available in order to get the transistor turned fully on. There are
> devices that switch with low voltages, but, it's something you'd want to pay
> close attention to.
> b) Bipolar transistors: You're right here as well (current activated) and
> you have the right formula based on the current gain of the transistor.
> Lower current load on a processor pin is definitely better, but, if the
> manufacturer spec says 4mA, then you're entitled to ask it to give you all
> four mA.
> c) I'm not clever enough to come up with a simple scanned circuit using
> transistors in which you can set the per-segment current with a single
> resistor. The problem is that the current that flows through the shared path
> (common cathode or common anode) depends on how many segments are lit. A
> single fixed-resistance element will have a different voltage drop depending
> on the number of segments that are being driven. If anyone knows of a simple
> way to deal with that, I'd be interested in knowing what it is.
>
> Hope that helps. Good luck.
>
> Norman
>
> --- In l... , Jean-Sebastien
> Stoezel wrote:
> >
> > Norman:
> >
> > Thank you for taking the time to provide such a detailed answer.
> >
> > You are right the number of transistors could be reduced by using
> techniques
> > such as charlieplexing.
> >
> > I plan to use common cathode displays, but that's because I've seen them
> > used in most schematics I found on the web. I plan to supply the LEDs at
> the
> > same voltage as the microcontroller, that is 3.3V.
> >
> > This is the type of display I want to use:
> > http://www.KingbrightUSA.com/images/catalog/SPEC/ACPSC04-41SURKWA.pdf
> >
> > I'm not sure what I was thinking when I wrote the initial email, these
> are
> > not 7-segment displays, these are 16 segments... I guess the concept is
> the
> > sam,e though the digit enabler transistor have to withstand twice the
> > current.
> >
> > Maximum brightness is a concern in my application since these displays
> will
> > be used outside. I've chosen very high brightness display, as I hope this
> > will compensate for the loss of brightness due to the multiplexing.
> >
> > What would you use as drivers? From what I understand bipolars are driven
> > using current, MOSFET using voltage...
> > Say each segment requires 20mA (30mA is the absolute maximum rating),
> then
> > worst case supply for a digit will be 320mA. If I use bipolars to enable
> the
> > digits then this may put a bit more strain on the microcontroller's
> outputs
> > (with a gain of 100, the base current would be at 3.2mA, getting closer
> to
> > the 4mA limit).
> >
> > Ideally I would like to use a schematic where the current for each
> segment
> > is set with only one resistor. This is so I can easily change the maximum
> > current for all the segments and limit the part count.
> > For now though I haven't figured that out, and I plan to use a transistor
> in
> > "series" with each segment, and a transistor in "series" with each digit
> > enabler... I've also seen schematics where the segments are driven with a
> > transistor as an inverter...
> >
> > What do you think?
> >
> > Thanks again for your help,
> > Jean
> >
> >
> > On Sat, Dec 5, 2009 at 11:48 PM, Norman wrote:
> >
> > >
> > >
> > > Hi,
> > >
> > > As long as each digit gets driven more than about 60 times each second,
> you
> > > shouldn't see flicker. The human eye isn't fast enough to see things
> that
> > > change quicker than that. In convenient round numbers, if you visit a
> digit
> > > for one millisecond, then move on to the next, for a total scan time of
> nine
> > > milliseconds, you won't have to worry about flicker. LPC class
> controllers
> > > are plenty fast enough to keep up with that and have lots of processor
> left
> > > over.
> > >
> > > PWMing the enable line should work fine, provided the thing driving the
> > > enable line can handle the current. (More about that in a moment.) To
> avoid
> > > strange visual artifacts, the PWM frequency should be substantially
> higher
> > > than your scan frequency. If you're driving each digit for one
> millisecond,
> > > pick a PWM frequency around 10 kHz or 20 kHz or so.
> > >
> > > Here's your key design challenge: if you are scanning nine digits, each
> > > digit is only on for one ninth of the total time. Therefore, it's only
> one
> > > ninth as bright. You can compensate for that by increasing the current
> > > through the LEDs. If you drive each digit with nine times the current,
> for
> > > one ninth of the time, it will appear to be the same brightness as an
> LED
> > > driven with one times the current for 100% of the time. There's a
> limit,
> > > though. If you try and force too much current through the LED you'll
> damage
> > > it. This is a common way to drive LEDs, so many LED spec sheets have a
> peak
> > > pulse current specification. If you're not sure, post the LED part
> number
> > > and I'll take a look at it. This peak current spec will probably set
> the
> > > upper limit for how bright your scanned LEDs can appear.
> > >
> > > You're right that you're not going to get an LPC output pin to supply
> > > sufficient current directly. A transistor connected to the outputs will
> fix
> > > that problem nicely. The switching frequencies required (a few tens of
> kHz,
> > > tops) are quite low by transistor standards and there aren't any large
> > > switched capacitive or inductive elements to complicate your design.
> You can
> > > probably safely ignore all the frequency-related aspects of selecting a
> > > transistor since any one you pick will be fast enough. You can treat it
> as a
> > > DC circuit which is either on or off. What you do need to be worried
> about
> > > is the ability of the transistor to handle the current you'll be
> switching,
> > > and, how much power it will dissipate when it's turned on. The other
> > > consideration is whether you can drive the transistor with the
> relatively
> > > small voltages (FET types) or currents (bipolar types) available from
> an LPC
> > > pin.
> > >
> > > I figure you'll need 17 transistors. Seven for the segment drivers,
> nine
> > > for the digit selects, and one for the PWM brightness control. You
> might be
> > > able to do it with less with a little clever software.
> > >
> > > I would hesitate to give you a schematic without knowing a bit more
> about
> > > your circuit. Are your displays common-anode or common-cathode? What
> voltage
> > > is supplying the LEDs? Is your processor running at 3.3V?
> > >
> > > Without doing any calculations, my gut feel is that is should work. My
> > > greatest concern would be whether the LEDs will be bright enough.
> > >
> > > Cheers, Norman
> > >
> > >
> > > --- In l... > 40yahoogroups.com>, Jean-Sebastien
>
> > > Stoezel wrote:
> > > >
> > > > Hi,
> > > >
> > > > I would like to interface 9 7-segment displays to an LPC
> > > > microcontroller. I will be using a standard multiplexing scheme, with
> > > > an enabler for each digit, and shared segment lines for all.
> > > >
> > > > I have several questions regarding the way the multiplexing has to be
> > > > handled, and the way it needs to be interfaced.
> > > >
> > > > - First, isn't 9 digits too much for multiplexing? Am I going to
> > > > notice flickering if I try to drive too many digits?
> > > > - I would also like to control the intensity for each digit
> > > > programmatically, that is PWMing the enabler line. Same question
> here,
> > > > are 9 digits too much for this kind of control?
> > > > - LPC devices are limited to 4mA on their outputs so I guess I need
> to
> > > > use transistors to driver the segments and the digit enablers (the
> > > > seven segment displays require 20mA per segment). I've seen
> schematics
> > > > with NMOS, bipolars... What is best here? What do you have to take
> > > > into consideration for making a choice? Switching frequency,
> > > > impedance?
> > > > - Could anybody provide a schematic for interfacing the
> > > > microcontroller to a 7 segment display, knowing there needs to be a
> > > > driver for each line, and a driver for the digit enabler?
> > > >
> > > > Thanks!
> > > > Jean
> > > >
> > >
> > >
> > >
> >
>