# True LINEAR LEDs PWM

Hello,

for those of you who have kindly followed me in my previous post...you already know that I am experimenting with LED PWM.

Now, clearly the LEDs don't light up linearly to the PWM but I wanted to get the smoothest transition possible, so I thought of a test that I could run to determine precisely how the LEDs light up accordingly to the PWM so to be able to use the numerical data to light them up in a more linear way.

I write this post, first of all, to understand if I might be on the correct path to deal with what I am facing and, secondly, with the hope that the data collected may be of help for others (as it is quite boring to do this...).

So here it's how it works...
I've 3D printed a black cone (30 cm long), one side open the width of the LED (in my first case 10mm, white LED), the other side it fits on my exposimeter (Sekonic L-758D Digital Master, for those who are interested).
I've attached a 10mm white LED (driven with a MOSFET with a 12V input) on one side and the exposimeter at the other side (set on EV mode) and I've gone through all the PWM values taking reading of them.

Here is the, unsurprisingly, result:

Now, the idea is to take only the values where there is a true increment in lightness and create an array to use in any for cycle (or whatever you may use) to create a dimming effect, so to have a better light transition (I hope I explained myself, sorry, I'm not a native speaker).

If you have any comments, ideas, I'll be glad to hear them and I hope you may find this interesting.
If you do, please let me know and I'll take readings also for 5mm and 3mm LEDs and I'll post the numerical values.

Alesssandro

I’ve found the simplest way is a 256 byte array with a lookup of the appropriate value needed.
There are a few on the web, and it’s simple to tweak the values if you want to modify the curve.

Put the array in FLASH as a constant to save RAM.

You could do it algorithmically, nut the simple array lookup is faster and probably uses less program memory anyway !

Actually, PWM is perfectly linear but your eyes & brain are not. I’m not a photographer but I assume the light meter is calibrated similar to perception.

Our perception is logarithmic/proportional. If we go from a PWM value of 1 to 2, that’s a very noticeable 100% increase but when we go from 254 to 255 that’s an unnoticeable change of less than 1/2 %.

That’s an interesting interpretation...

Our perception is logarithmic/proportional. If we go from a PWM value of 1 to 2, that's a very noticeable 100% increase but when we go from 254 to 255 that's an unnoticeable change of less than 1/2 %.