EmbeddedRelated.com
Forums
Memfault Beyond the Launch

PWM LED Array

Started by Gene May 22, 2011
On Sunday, May 22, 2011 7:20:02 PM UTC-4, linnix wrote:
> BTW, why PIC32? There must be other reasons than just driving LEDs.
It will also have a key matrix and a 16 bit lcd attached. There won't be a whole lot of pins left, ergo my thought about using a driver via i2c/spi or similar, perhaps.
Hi Gene,

On 5/22/2011 3:34 PM, Gene wrote:
>> Is this a 1x63 array? 3x21? How many lamps do you intend to >> have lit concurrently? how many "intensities" do you seek? > > The array configuration is one of the things that I'm uncertain on. > I would think that it'd be configured based on the end method of > driving said array. I'd need all on at the same time, with at least > a few intensity levels (5 or so would be plenty) for all LEDs.
Wait -- you want to treat them all AS IF they were a single lamp? I.e., two states: all on (at some "dimness level") or all *off*? *Not* 1 on, 2 on, 26 on, etc.? (which begs the question, why not use "some number on" to give you your variable intensity? unless you need illumination over a wider area, etc.)
On 5/22/2011 4:31 PM, linnix wrote:
> On May 22, 4:22 pm, Rich Webb<bbew...@mapson.nozirev.ten> wrote: >> On Sun, 22 May 2011 15:34:58 -0700 (PDT), Gene<profii...@gmail.com> >> wrote: >> >>> On Sunday, May 22, 2011 4:58:42 PM UTC-4, D Yuniskis wrote: >>>> [grrr... how about learning to break your lines at something like >>>> 70 characters?? I've taken the liberty to *chop* off everything that >>>> extends beyond the width of my window... no fun, eh? :>] >> >>> Sorry; my netiquette has gotten rusty it seems :( >> >>>> Is this a 1x63 array? 3x21? How many lamps do you intend to >>>> have lit concurrently? how many "intensities" do you seek? >> >>> The array configuration is one of the things that I'm uncertain on. >>> I would think that it'd be configured based on the end method of >>> driving said array. I'd need all on at the same time, with at least >>> a few intensity levels (5 or so would be plenty) for all LEDs. >> >> Well, let's back of the envelope this. Figure a nominal 2 V drop per LED >> and you've got 5 V to work with so run two in series, 32 times. You want >> to PWM so figure a BJT switch with, say, 0.5 Vce at saturation, so a >> swag is 4.5 V per pair, and 32 pairs. (If you really want 63 and not 64, >> put some electrical tape over the 64th, or throw some regular diodes >> there in its place.) >> >> For 500 mA max at the USB port, assuming a proper dialog with the port >> to get permission to draw more than 200 mA, you can push about 15 mA >> through each pair. Less, really, since the processor will want some and >> some will be lost in other ways. So, say you look for LEDs that are >> adequately bright at no more than 10 mA. A 47 ohm current limiting >> resistor for each pair might be a starting point. > > PIC32 (min 64 pins) has only 5 PWM outputs. So, you need transistors > to buffer more than 18mA (max) per port. PIC24 has 9 PWM, BTW.
If the OP is only interested in 5 light levels, you don't need a "real" PWM channel (do it "old school")
Gene wrote:

>...using a driver >via i2c/spi or similar, perhaps.
I2C: Check TI's TLC59116, NXP's PCA9635, etc. They control 16 LEDs, could be coerced to control 32 by multiplexing the common side of the LEDs with a couple of transistors. -- Roberto Waltman [ Please reply to the group, return address is invalid ]
On May 22, 5:10=A0pm, Gene <profii...@gmail.com> wrote:
> On Sunday, May 22, 2011 7:20:02 PM UTC-4, linnix wrote: > > BTW, why PIC32? =A0There must be other reasons than just driving LEDs. > > It will also have a key matrix and a 16 bit lcd attached. There won't > be a whole lot of pins left, ergo my thought about using a driver > via i2c/spi or similar, perhaps.
Actually, you can probably drive all of them with a single pin and power transistor. I2C/SPI would need more than one pin.
On May 22, 5:17=A0pm, D Yuniskis <not.going.to...@seen.com> wrote:
> Hi Gene, > > On 5/22/2011 3:34 PM, Gene wrote: > > >> Is this a 1x63 array? =A03x21? =A0How many lamps do you intend to > >> have lit concurrently? =A0how many "intensities" do you seek? > > > The array configuration is one of the things that I'm uncertain on. > > I would think that it'd be configured based on the end method of > > driving said array. I'd need all on at the same time, with at least > > a few intensity levels (5 or so would be plenty) for all LEDs. > > Wait -- you want to treat them all AS IF they were a single lamp? > I.e., two states: =A0all on (at some "dimness level") or all *off*? > *Not* 1 on, 2 on, 26 on, etc.? > > (which begs the question, why not use "some number on" to give you > your variable intensity? =A0unless you need illumination over a > wider area, etc.)
Sound like LCD backlite. It he said so originally, we wouldn't have to go through all those guessings.
On May 22, 5:10=A0pm, Gene <profii...@gmail.com> wrote:
> On Sunday, May 22, 2011 7:20:02 PM UTC-4, linnix wrote: > > BTW, why PIC32? =A0There must be other reasons than just driving LEDs. > > It will also have a key matrix and a 16 bit lcd attached. There won't > be a whole lot of pins left, ergo my thought about using a driver > via i2c/spi or similar, perhaps.
Next time, try something like this: Question: What is the best way to drive 63 backlite LEDs for the LCD panel of a PIC32, with upto 5V 500mA USB bus power. Answer: PWM the base of a 2N2222, with 32 pairs of LEDs tied between collector and a 10 ohms resistor from 5V VBUS.
On 5/22/2011 6:19 PM, D Yuniskis wrote:
> On 5/22/2011 4:31 PM, linnix wrote: >> On May 22, 4:22 pm, Rich Webb<bbew...@mapson.nozirev.ten> wrote: >>> On Sun, 22 May 2011 15:34:58 -0700 (PDT), Gene<profii...@gmail.com> >>> wrote: >>> >>>> On Sunday, May 22, 2011 4:58:42 PM UTC-4, D Yuniskis wrote: >>>>> [grrr... how about learning to break your lines at something like >>>>> 70 characters?? I've taken the liberty to *chop* off everything that >>>>> extends beyond the width of my window... no fun, eh? :>] >>> >>>> Sorry; my netiquette has gotten rusty it seems :( >>> >>>>> Is this a 1x63 array? 3x21? How many lamps do you intend to >>>>> have lit concurrently? how many "intensities" do you seek? >>> >>>> The array configuration is one of the things that I'm uncertain on. >>>> I would think that it'd be configured based on the end method of >>>> driving said array. I'd need all on at the same time, with at least >>>> a few intensity levels (5 or so would be plenty) for all LEDs. >>> >>> Well, let's back of the envelope this. Figure a nominal 2 V drop per LED >>> and you've got 5 V to work with so run two in series, 32 times. You want >>> to PWM so figure a BJT switch with, say, 0.5 Vce at saturation, so a >>> swag is 4.5 V per pair, and 32 pairs. (If you really want 63 and not 64, >>> put some electrical tape over the 64th, or throw some regular diodes >>> there in its place.) >>> >>> For 500 mA max at the USB port, assuming a proper dialog with the port >>> to get permission to draw more than 200 mA, you can push about 15 mA >>> through each pair. Less, really, since the processor will want some and >>> some will be lost in other ways. So, say you look for LEDs that are >>> adequately bright at no more than 10 mA. A 47 ohm current limiting >>> resistor for each pair might be a starting point. >> >> PIC32 (min 64 pins) has only 5 PWM outputs. So, you need transistors >> to buffer more than 18mA (max) per port. PIC24 has 9 PWM, BTW. > > If the OP is only interested in 5 light levels, you don't > need a "real" PWM channel (do it "old school")
I too was wondering why so many PWM channels were required for a non-linear output. Even a multiplexed array of diodes can get every LED a different level of intensity. Just limit the number of levels, as D Yuniskis stated. hamilton
On Sun, 22 May 2011 17:19:34 -0700, D Yuniskis
<not.going.to.be@seen.com> wrote:

>On 5/22/2011 4:31 PM, linnix wrote: >> On May 22, 4:22 pm, Rich Webb<bbew...@mapson.nozirev.ten> wrote: >>> On Sun, 22 May 2011 15:34:58 -0700 (PDT), Gene<profii...@gmail.com> >>> wrote: >>> >>>> On Sunday, May 22, 2011 4:58:42 PM UTC-4, D Yuniskis wrote: >>>>> [grrr... how about learning to break your lines at something like >>>>> 70 characters?? I've taken the liberty to *chop* off everything that >>>>> extends beyond the width of my window... no fun, eh? :>] >>> >>>> Sorry; my netiquette has gotten rusty it seems :( >>> >>>>> Is this a 1x63 array? 3x21? How many lamps do you intend to >>>>> have lit concurrently? how many "intensities" do you seek? >>> >>>> The array configuration is one of the things that I'm uncertain on. >>>> I would think that it'd be configured based on the end method of >>>> driving said array. I'd need all on at the same time, with at least >>>> a few intensity levels (5 or so would be plenty) for all LEDs. >>> >>> Well, let's back of the envelope this. Figure a nominal 2 V drop per LED >>> and you've got 5 V to work with so run two in series, 32 times. You want >>> to PWM so figure a BJT switch with, say, 0.5 Vce at saturation, so a >>> swag is 4.5 V per pair, and 32 pairs. (If you really want 63 and not 64, >>> put some electrical tape over the 64th, or throw some regular diodes >>> there in its place.) >>> >>> For 500 mA max at the USB port, assuming a proper dialog with the port >>> to get permission to draw more than 200 mA, you can push about 15 mA >>> through each pair. Less, really, since the processor will want some and >>> some will be lost in other ways. So, say you look for LEDs that are >>> adequately bright at no more than 10 mA. A 47 ohm current limiting >>> resistor for each pair might be a starting point. >> >> PIC32 (min 64 pins) has only 5 PWM outputs. So, you need transistors >> to buffer more than 18mA (max) per port. PIC24 has 9 PWM, BTW. > >If the OP is only interested in 5 light levels, you don't >need a "real" PWM channel (do it "old school")
[Crazy usenet. I can see posts from linnix timestamped before and after that one but... not that one. %!#$! ::sigh:: ] Yes, I was imagining one PWM channel driving one transistor that then tickled the bases of all of the 32 LED string transistors in parallel. Rather a brute force approach, of course. Since they're operating as saturation switches, minor differences in the transistor characteristics should be mostly a wash. -- Rich Webb Norfolk, VA
On May 22, 6:14=A0pm, Rich Webb <bbew...@mapson.nozirev.ten> wrote:
> On Sun, 22 May 2011 17:19:34 -0700, D Yuniskis > > > > > > > > > > <not.going.to...@seen.com> wrote: > >On 5/22/2011 4:31 PM, linnix wrote: > >> On May 22, 4:22 pm, Rich Webb<bbew...@mapson.nozirev.ten> =A0wrote: > >>> On Sun, 22 May 2011 15:34:58 -0700 (PDT), Gene<profii...@gmail.com> > >>> wrote: > > >>>> On Sunday, May 22, 2011 4:58:42 PM UTC-4, D Yuniskis wrote: > >>>>> [grrr... how about learning to break your lines at something like > >>>>> 70 characters?? =A0I've taken the liberty to *chop* off everything =
that
> >>>>> extends beyond the width of my window... no fun, eh? =A0:>] > > >>>> Sorry; my netiquette has gotten rusty it seems :( > > >>>>> Is this a 1x63 array? =A03x21? =A0How many lamps do you intend to > >>>>> have lit concurrently? =A0how many "intensities" do you seek? > > >>>> The array configuration is one of the things that I'm uncertain on. > >>>> I would think that it'd be configured based on the end method of > >>>> driving said array. I'd need all on at the same time, with at least > >>>> a few intensity levels (5 or so would be plenty) for all LEDs. > > >>> Well, let's back of the envelope this. Figure a nominal 2 V drop per =
LED
> >>> and you've got 5 V to work with so run two in series, 32 times. You w=
ant
> >>> to PWM so figure a BJT switch with, say, 0.5 Vce at saturation, so a > >>> swag is 4.5 V per pair, and 32 pairs. (If you really want 63 and not =
64,
> >>> put some electrical tape over the 64th, or throw some regular diodes > >>> there in its place.) > > >>> For 500 mA max at the USB port, assuming a proper dialog with the por=
t
> >>> to get permission to draw more than 200 mA, you can push about 15 mA > >>> through each pair. Less, really, since the processor will want some a=
nd
> >>> some will be lost in other ways. So, say you look for LEDs that are > >>> adequately bright at no more than 10 mA. A 47 ohm current limiting > >>> resistor for each pair might be a starting point. > > >> PIC32 (min 64 pins) has only 5 PWM outputs. =A0So, you need transistor=
s
> >> to buffer more than 18mA (max) per port. =A0PIC24 has 9 PWM, BTW. > > >If the OP is only interested in 5 light levels, you don't > >need a "real" PWM channel (do it "old school")
Just one channel. The issues were unclear before.
> > [Crazy usenet. I can see posts from linnix timestamped before and after > that one but... not that one. %!#$! =A0::sigh:: ] > > Yes, I was imagining one PWM channel driving one transistor that then > tickled the bases of all of the 32 LED string transistors in parallel. > Rather a brute force approach, of course. Since they're operating as > saturation switches, minor differences in the transistor characteristics > should be mostly a wash.
I was thinking just one tiny metal can (2N2222) that can handle 500mA collector current. One of my first transistor and still as good as any.

Memfault Beyond the Launch