Dimming - what equation do you use to make dimming look linear to human eye?

Hi,

I was just wondering what equation do you use to calculate PWM to make the brightness look linear to a human eye while dimming? I was searching through the web and found a lot of different equations. I know the perception of brightness is exponentional. I found this:

Round(((x^(10/input_limit)-1)/(x-1)) * output_limit)

which gives these values:

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 21, 22, 24, 25, 27, 28, 30, 32, 33, 35, 37, 39, 41, 43, 45, 47, 49, 52, 54, 56, 59, 61, 64, 66, 69, 72, 75, 78, 81, 84, 87, 91, 94, 98, 101, 105, 109, 113, 117, 121, 125, 130, 134, 139, 144, 149, 154, 159, 165, 170, 176, 182, 188, 194, 200, 207, 214, 221, 228, 235, 243, 250, 258, 267, 275, 284, 293, 302, 311, 321, 331, 342, 352, 363, 374, 386, 398, 410, 422, 435, 449, 462, 476, 491, 506, 521, 537, 553, 570, 587, 605, 623, 641, 661, 680, 701, 721, 743, 765, 788, 811, 835, 860, 885, 912, 939, 966, 995, 1023]

in practice I'm using x = value * value, which gives me 64 values of brightness if I have 12bit PWM driver (like TLC5940)

Anyone simplified the equation or came with something simple, better or faster?

As far as I know, the human eye has a log10 for light intensity. I think that's in the formula by x^10.

But there is a lot written about, with a lot of different calculations. Even in this forum: http://arduino.cc/forum/index.php?topic=69083.0 I looks to me that at the end, it's all in the eye of the beholder.

Light level fall off is calculated using Inverse-square law http://en.wikipedia.org/wiki/Inverse-square_law

or 32-step on 10bit arduino

??? The arduino PWM output only has a 8 bit resoloution.

Light level fall off is calculated using Inverse-square law

True but not relevant here.

Anyone simplified the equation or came with something simple,

This is a tricky one and you are best using a look up table to get your values. Use the calculated values as a start and then manually adjust them so you get it as smooth as you like. However, it is a difficult thing to do. Also look up gamma correction.

You're right. My bad. ADC is 10bit, PWM is only 8bit