Tuesday, November 20, 2007

LED Dimming

Recently, I’ve been seeing several projects using LEDs. One of the most interesting things to control on a LED is its brightness. Controlling LED brightness not only allows you to modulate the amount of light emitted by the LED but also compose colors if you are using a RGB (3-color) LED. I wrote this article to show the inner workings behind the LED dimming.

In order to control LED’s brightness we can use Pulse-Width Modulation (PWM.) The idea behind this mechanism is, given a desired brightness and a time period, which we call ‘T’, we’ve to set the percentage of ‘T’ in which the LED will be turned on and which one it will be turned off. We call Pulse Width to the time in which the LED is turned on (See figure).

Let’s say that during 50% of ‘T’ the LED is turned on and during 50% of ‘T’ it is turned off, the LED will emit an amount of light which we call L1. However, if we choose to turn it on during 75% percent of ‘T’ and to turn it off during 25% of ‘T’, the LED brightness will be L2, where L2>L1. We can conclude that LED brightness is proportional to the percentage of ‘T’ in which the LED is turned on (considering ‘T’ as a constant.)

Won’t I see a blinking LED instead of a constant brightness? No, but you have to choose the right value for the time period ‘T’. Human vision system has a property called persistence in which, changes that happen quickly aren’t detected by our vision system. Because of that, if we toggle the LED state (on and off) quickly we won’t see those changes, but a constant brightness (as long as we maintain the on-off ratio constant). The maximum recommend value for T is 0.01 seconds.

The hottest physical computing projects such as Arduino and CREATE USB Interface have implemented this kind of brightness controls.



The previous figure shows three different PWM setups.

No comments: