LED dimming using Binary Code Modulation

Complications

How fast to (not) flicker:

"24fps is fast enough for film, therefore 48hz is fast enough for me."

I'm afraid that isn't true. A 48hz LED will be easily identifiable as flickering and, indeed, distracting.

I can best describe the reason behind this by way of a thought-experiment:

Note: From personal experience, if you try this experiment in reality, make sure that the batteries for your LED device are well held - It's alarming how fast an AAA battery can travel from the end of a slingshot

Even if your LED's intended application does not involve it being swung around, it will move around relative to someone's gaze. As an observer's gaze passes across the LED, the on-and-off periods will be clearly visible and are likely to be distracting.

I would suggest using 240hz as a minimum for the base-frequency for any LED, and higher if the LED is expected to be moving quickly within a field-of-view, or in an environment where many eye-fixations are likely (<grouch> would designers of LED rear-lights for cars please take note</grouch>).

Gamma correction:

An LED running at 50% duty cycle appears much brighter than half the full brightness. This is because the eye's response to light is not linear.

To put it another way;

The solution is to apply gamma correction to the duty cycles, however this is way beyond the scope of this article (and my brain). Suffice to say, you'll need more than 8 bits of accuracy to have truly smooth fading with LEDs. As usual, AVRFreaks has a great thread that touches on this (and also on colour mixing).

Neither the flicker-rate nor the Gamma correction should be a problem for the majority of applications. 8 bits of LED dimming gives impressive results for relatively little work.