Go Down

Topic: A Better Fade? (Read 1 time) previous topic - next topic

KirAsh4

Ok, I admit this is all about how we perceive light.  Our eyes aren't bionic implants so our brains compensate.  But, I wonder if anyone has either thought about or figured out a better way to do this.

Let's say you are fading an LED from 0 up to 255 then back down to 0 in +1/-1 increments (let's call it a 'pulse').  Well, from 0 to about 175~200, you'll notice it.  But going above that, the change is so minute that it's barely noticeable.  Yes you can notice it, but it's not as dramatic a change as going from say 100 to 150.

So I thought maybe when one reaches those higher numbers, instead of continuing with a +1 step, change to a +2 step, so the fade reaches max intensity faster.  Then I thought, there's got to be a better way.  Maybe a formula?  Or maybe I'm just going about it all wrong.  I may even be over thinking it, who knows.  I just know that when I'm fading an LED up to max then down to 0 again, it just seems to stay near it's max intensity longer than any other range.  I know it's not, but the light intensity makes it appear that way.

So is there a better way for a smoother "pulsing" of an LED?

jraskell

A logarithmic or exponential formula would probably provide a visibly smooth enough fade on/off.  It may not be a perfectly accurate method, but likely close enough that the human eye won't perceive any inconsistencies.

dhenry

Quote
So is there a better way for a smoother "pulsing" of an LED?


Google gamma correction.

It can be done quickly with a look-up table.

fungus


I just know that when I'm fading an LED up to max then down to 0 again, it just seems to stay near it's max intensity longer than any other range.  I know it's not, but the light intensity makes it appear that way.


No, it probably is. Light output from a LED isn't linear.


So is there a better way for a smoother "pulsing" of an LED?


Yes. Use a logarithmic curve.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

MarkT



I just know that when I'm fading an LED up to max then down to 0 again, it just seems to stay near it's max intensity longer than any other range.  I know it's not, but the light intensity makes it appear that way.


No, it probably is. Light output from a LED isn't linear.



I think we're talking about PWM driving an LED, so the _average_ light output is theoretically linear in the PWM duty-cycle.  Self-heating reduces efficiency somewhat so linearity is best at lower output powers.  The human eye has _no_ _chance_ of detecting this degree of non-linearity since the response curve is roughly logarithmic over many orders of magnitude (5 or so)
[ I won't respond to messages, use the forum please ]

KirAsh4

Cool.  Any particular code examples anywhere?

Go Up