Archive for December 21st, 2009
TLC5916 LED Driver Current Monotonicity Hack
Posted by Ed in Electronics Workbench, Software on 21-December-2009
I’m using Texas Instruments TLC5916 constant-current LED driver chips for my my friend’s Totally Featureless Clock. An 8-bit configuration value sets the output current, with the external resistor defining the maximum value as described there.
The problem is that the current-versus-config-value curve has a non-monotonic discontinuity in the middle, where the Current Multiplier bit switches from 0 to 1. I don’t know in which alternate universe this design decision made sense, but right here and now…
It. Does. Not.
Why it’s a problem: the LED brightness tracks room illumination as seen by a CdS photoresistor, averaged over maybe half a minute. The brightness changes very slowly, so the jump when it goes from 0x7f to 0×80 is really eyecatching. At least to me, anyway.
Eyeballometric measurement of the curve shows the current at 0×80 pretty much matches the current at 0×60, soooo let’s just shove the second quarter of the curve (between 0×40 and 0x7f) downward until it meets the high-current value at 0×80.
This code does the trick:
if ((Brightness >= 0x40) && (Brightness <= 0x7f)) {
Brightness = 0x40 + ((Brightness & 0x3f) >> 1);
}
Basically, that maps 0x7f to 0x5f. The output current for 0x5f is pretty close to the current for 0×80, making the step pretty much a non-issue.
You could, if you were fussy enough, work out the actual current mapping values from the data sheet equations and make the ends match up perfectly.


Blowback