EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Questions on LED PWM

Started by Mike Silva October 5, 2008
I need to drive some RGB LEDs to generate a bit of eye candy and I'm
wondering if anybody has some experience on a few questions.  First,
I'm thinking of using 5 bits of intensity per color since the entire
RGB value would fit nicely in 16 bits.  Anybody have an opinion
whether 32 intensity levels for an LED is "smooth enough" or
"disconcertingly jumpy"?  The LEDs are going to be pretty busy so I
think (hope) I might be able to get away with fewer steps than
otherwise.

2nd question, how would the eye perceive the linearity of 32 equal
intensity steps (that is, ON times of e.g. 100us, 200us, 300us ...
3100us out of 3100us)?  I'm wondering if I may need to go to unequal
intensity steps to get a more apparently linear intensity ramp.
Anybody have experience with this?

I'll be wiring this up and playing with it before too long, but in the
meantime I thought I'd find out if anybody else has dealt with these
questions.  Many thanks!

Mike

Mike Silva wrote:

> 2nd question, how would the eye perceive the linearity of 32 equal > intensity steps (that is, ON times of e.g. 100us, 200us, 300us ... > 3100us out of 3100us)? I'm wondering if I may need to go to unequal > intensity steps to get a more apparently linear intensity ramp. > Anybody have experience with this?
Some articles about it: http://www.telescope-optics.net/eye_spectral_response.htm http://en.wikipedia.org/wiki/Weber-Fechner_law Looks like it is logarithmic. Another example is the magnitude value used for measuring star brigthness: http://en.wikipedia.org/wiki/Apparent_magnitude This means the perceived intensity p=2.5*log(r), with r=real intensity => r=10^(p/2.5). Maybe there are some additional non-linearities if your PWM rate is near 0% or near 100%, but for good looking results use a high resolution PWM and use a logarithmic lookup table. Another interesting article about intensity correction: http://en.wikipedia.org/wiki/Gamma_correction -- Frank Buss, fb@frank-buss.de http://www.frank-buss.de, http://www.it4-systems.de
Use 6 bits for _green_, since human eyes is more sensitive to green lights.

Mike Silva <snarflemike@yahoo.com> writes:

> I need to drive some RGB LEDs to generate a bit of eye candy and I'm > wondering if anybody has some experience on a few questions. First, > I'm thinking of using 5 bits of intensity per color since the entire > RGB value would fit nicely in 16 bits. Anybody have an opinion > whether 32 intensity levels for an LED is "smooth enough" or > "disconcertingly jumpy"? The LEDs are going to be pretty busy so I > think (hope) I might be able to get away with fewer steps than > otherwise. > > 2nd question, how would the eye perceive the linearity of 32 equal > intensity steps (that is, ON times of e.g. 100us, 200us, 300us ... > 3100us out of 3100us)? I'm wondering if I may need to go to unequal > intensity steps to get a more apparently linear intensity ramp. > Anybody have experience with this? > > I'll be wiring this up and playing with it before too long, but in the > meantime I thought I'd find out if anybody else has dealt with these > questions. Many thanks! > > Mike
Mike Silva wrote:
> I need to drive some RGB LEDs to generate a bit of eye candy and I'm > wondering if anybody has some experience on a few questions. First, > I'm thinking of using 5 bits of intensity per color since the entire > RGB value would fit nicely in 16 bits. Anybody have an opinion > whether 32 intensity levels for an LED is "smooth enough" or > "disconcertingly jumpy"? The LEDs are going to be pretty busy so I > think (hope) I might be able to get away with fewer steps than > otherwise. > > 2nd question, how would the eye perceive the linearity of 32 equal > intensity steps (that is, ON times of e.g. 100us, 200us, 300us ... > 3100us out of 3100us)? I'm wondering if I may need to go to unequal > intensity steps to get a more apparently linear intensity ramp. > Anybody have experience with this? > > I'll be wiring this up and playing with it before too long, but in the > meantime I thought I'd find out if anybody else has dealt with these > questions. Many thanks! > > Mike
Look at some of the LED driver devices, with PWM. That will give you an idea of ranges - often they have a RGB section, and a separate brightness control, so that you are not relying on the Colour bits for wide dynamic range. Depends if you want this to operate over a daylight/nightime dynamic range, or just a narrower range. -jg
Mike Silva wrote:
> > I need to drive some RGB LEDs to generate a bit of eye candy and > I'm wondering if anybody has some experience on a few questions. > First, I'm thinking of using 5 bits of intensity per color since > the entire RGB value would fit nicely in 16 bits. Anybody have > an opinion whether 32 intensity levels for an LED is "smooth > enough" or "disconcertingly jumpy"? The LEDs are going to be > pretty busy so I think (hope) I might be able to get away with > fewer steps than otherwise. > > 2nd question, how would the eye perceive the linearity of 32 > equal intensity steps (that is, ON times of e.g. 100us, 200us, > 300us ... 3100us out of 3100us)? I'm wondering if I may need to > go to unequal intensity steps to get a more apparently linear > intensity ramp. Anybody have experience with this?
I suspect you will want to multiplex drive the display, just to save wires, drivers, etc. That means you will have a time pattern to fire each one. The only reasonable (IMO) control of intensity will be the length of activation pulse in that pattern (which can be delivered to only one end, if desired). This lets you fool with the intensities with a value to time converter somewhere. Note that you can deliver the three colors in three different time slots, provided the multiplex frequency is high enough. -- [mail]: Chuck F (cbfalconer at maineline dot net) [page]: <http://cbfalconer.home.att.net> Try the download section.
Op Mon, 06 Oct 2008 04:24:53 +0200 schreef Mike Silva  
<snarflemike@yahoo.com>:
> I need to drive some RGB LEDs to generate a bit of eye candy and I'm > wondering if anybody has some experience on a few questions. First, > I'm thinking of using 5 bits of intensity per color since the entire > RGB value would fit nicely in 16 bits. Anybody have an opinion > whether 32 intensity levels for an LED is "smooth enough" or > "disconcertingly jumpy"? The LEDs are going to be pretty busy so I > think (hope) I might be able to get away with fewer steps than > otherwise.
Obviously, this depends heavily on the output power and the transition time. But if it is not enough, you could think about a simple routine that will transition between two 16-bit colours in several steps using 24-bit precision. -- Gemaakt met Opera's revolutionaire e-mailprogramma: http://www.opera.com/mail/


Mike Silva wrote:

>I need to drive some RGB LEDs to generate a bit of eye candy and I'm >wondering if anybody has some experience on a few questions. First, >I'm thinking of using 5 bits of intensity per color since the entire >RGB value would fit nicely in 16 bits. Anybody have an opinion >whether 32 intensity levels for an LED is "smooth enough" or >"disconcertingly jumpy"? The LEDs are going to be pretty busy so I >think (hope) I might be able to get away with fewer steps than >otherwise. > >2nd question, how would the eye perceive the linearity of 32 equal >intensity steps (that is, ON times of e.g. 100us, 200us, 300us ... >3100us out of 3100us)? I'm wondering if I may need to go to unequal >intensity steps to get a more apparently linear intensity ramp. >Anybody have experience with this? > >I'll be wiring this up and playing with it before too long, but in the >meantime I thought I'd find out if anybody else has dealt with these >questions. Many thanks!
Depending on what you are displaying, you might find that the difference between 00000/00000/00000(all off) and 00000/00000/00001 is especially noticable, and that the color shifts at the lower end of brightness -- not enough resolution to keep the ratios right. An old trick is to use that extra bit to reduce the brightness of all three colors by a factor of 4, thus giving 7 bits of resolution at the dim end of the range. -- Guy Macon <http://www.GuyMacon.com/>
On Oct 6, 7:34=A0am, Guy Macon <http://www.GuyMacon.com/> wrote:
> Mike Silva wrote: > >I need to drive some RGB LEDs to generate a bit of eye candy and I'm > >wondering if anybody has some experience on a few questions. =A0First, > >I'm thinking of using 5 bits of intensity per color since the entire > >RGB value would fit nicely in 16 bits. =A0Anybody have an opinion > >whether 32 intensity levels for an LED is "smooth enough" or > >"disconcertingly jumpy"? =A0The LEDs are going to be pretty busy so I > >think (hope) I might be able to get away with fewer steps than > >otherwise. > > >2nd question, how would the eye perceive the linearity of 32 equal > >intensity steps (that is, ON times of e.g. 100us, 200us, 300us ... > >3100us out of 3100us)? =A0I'm wondering if I may need to go to unequal > >intensity steps to get a more apparently linear intensity ramp. > >Anybody have experience with this? > > >I'll be wiring this up and playing with it before too long, but in the > >meantime I thought I'd find out if anybody else has dealt with these > >questions. =A0Many thanks! > > Depending on what you are displaying, you might find that the > difference between 00000/00000/00000(all off) and 00000/00000/00001 > is especially noticable, and that the color shifts at the lower > end of brightness -- not enough resolution to keep the ratios right. > An old trick is to use that extra bit to reduce the brightness of > all three colors by a factor of 4, thus giving 7 bits of resolution > at the dim end of the range. =A0 =A0 =A0
That's a very clever idea and I'll be sure to look at it. Since I was going to manipulate the colors as 24 bit data anyway (and only transmit it as 16 bits) this sounds like a good fit. I was definitely thinking that that first level from all OFF would be too large a step, and that the colors at low resolution would be off (but since these will be very abstract patterns this latter may not matter at all, and may even add to the effect). And thanks to all who posted links and other info.
On Sun, 5 Oct 2008 19:24:53 -0700 (PDT), Mike Silva <snarflemike@yahoo.com> wrote:

>I need to drive some RGB LEDs to generate a bit of eye candy and I'm >wondering if anybody has some experience on a few questions. First, >I'm thinking of using 5 bits of intensity per color since the entire >RGB value would fit nicely in 16 bits. Anybody have an opinion >whether 32 intensity levels for an LED is "smooth enough" or >"disconcertingly jumpy"? The LEDs are going to be pretty busy so I >think (hope) I might be able to get away with fewer steps than >otherwise.
If you want a reasonably smooth fade, 256 levels per colour would be an absolute minumum.
On Mon, 06 Oct 2008 14:18:23 +0100, Mike Harrison
<mike@whitewing.co.uk> wrote:

>On Sun, 5 Oct 2008 19:24:53 -0700 (PDT), Mike Silva <snarflemike@yahoo.com> wrote: > >>I need to drive some RGB LEDs to generate a bit of eye candy and I'm >>wondering if anybody has some experience on a few questions. First, >>I'm thinking of using 5 bits of intensity per color since the entire >>RGB value would fit nicely in 16 bits. Anybody have an opinion >>whether 32 intensity levels for an LED is "smooth enough" or >>"disconcertingly jumpy"? The LEDs are going to be pretty busy so I >>think (hope) I might be able to get away with fewer steps than >>otherwise. > >If you want a reasonably smooth fade, 256 levels per colour would be an absolute minumum.
I agree (well, unless the changes are going to take place rather quickly like a second or two). The eye is insensitive to small brightness differences, but quite sensitive to small changes in brightness. Best regards, Spehro Pefhany -- "it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

Memfault Beyond the Launch