Pages: [1]   Go Down
Author Topic: A Better Fade?  (Read 922 times)
0 Members and 1 Guest are viewing this topic.
Colorado
Offline Offline
Edison Member
*
Karma: 47
Posts: 1562
Reviving dead brain cells with Arduinos.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

New Hampshire
Offline Offline
God Member
*****
Karma: 17
Posts: 781
There are 10 kinds of people, those who know binary, and those who don't.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 145
Posts: 5456
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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

0
Offline Offline
Shannon Member
****
Karma: 206
Posts: 12048
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

[ I won't respond to messages, use the forum please ]

Colorado
Offline Offline
Edison Member
*
Karma: 47
Posts: 1562
Reviving dead brain cells with Arduinos.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Cool.  Any particular code examples anywhere?
Logged

Pages: [1]   Go Up
Jump to: