Gamma correction and driving RGB color LEDs with PWM from a color table.

On gamma correction and driving RGB color LEDs with PWM from a color table.

When we have a PWM system driving red, green, and blue LEDs, and use a color table to select the color, as I do for example here:

formatting link
then that color table *normally* is used to set the DAC in the graphics card.

That DAC creates a voltage that is send to the CRT, and the CRT has a function of brightness versus drive voltage of y = x ^2.2. In LCD monitors this function is created in the firmware to be compatible to CRT monitors.

So, it is safe to assume that in color tables, as in for example in Linux in /usr/lib/X11/rgb.txt, the gamma is already corrected to the opposite curve: y = x^(1/2.2), so that it looks correct on a CRT or LCD monitor.

This would explain why I see more detail in the darker areas using this table with linear PWM, then in the lighter, the curve becomes *flatter* as brightness increases. So, to use these tables, we need to mimic a CRT curve, and correct the 0-255 values with y = x^(2.2).

CRT curve: brightness ^ . . . . . . . > drive voltage.

So, I will add reverse gamma correction to my application later.

Reply to
Jan Panteltje
Loading thread data ...

On a sunny day (Sun, 25 Jan 2009 11:30:25 GMT) it happened Jan Panteltje wrote in :

Done, col_pic-0.4 is public now:

formatting link

Reply to
Jan Panteltje

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.