Showing posts with label LED. Show all posts
Showing posts with label LED. Show all posts

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.

Sunday, November 18, 2007

Control de luminosidad para LEDs

Muchos de los proyectos que vi últimamente, hacen uso de LEDs y una de las variables fundamentales a controlar cuando usamos LEDs es su brillo. Mediante el control de brillo no solo se puede iluminar mas o menos, si no también controlar el color resultante cuando utilizamos LEDs RGB (componiendo un color). Se me ocurrió escribir este articulo de forma tal de enteder como funcionan la mayoria de los controles de intensidad de lumínica de LEDs.

Una de las manera de implementar un control de intensidad de lumínica para LEDs es usando una técnica denominada PWM, Pulse-Width Modulation en ingles y Modulación de Ancho de Pulso en español. La idea de este mecanismo de control de intensidad es la siguiente, dado un intensidad lumínica deseada y un periodo 'T' que porcentaje de 'T' estará prendido el LED. El tiempo de encendido se lo denomina ancho de pulso (ver grafico).

Por ejemplo, si durante el 50% de 'T' el LED esta prendido y el otro 50% de 'T' el LED esta apagado lograre obtener una intensidad lumínica que llamamos L1. Si ahora decido que el LED este prendido un 75% del tiempo 'T' y apagado un 25% del tiempo 'T' lograre una intensidad lumínica L2. Podemos pensar sin temor a equivocarnos que L2 > L1, es decir el LED presentara mas brillo para el caso de 75% encendido que para el caso de 50% encendido. Concluimos que el brillo será proporcional al porcentaje de ‘T’ en el cual se encuentre encendido el LED o dicho de otra manera al valor medio de la salida que controla el LED.

Ahora una pregunta que puede surgir, ¿No veré el LED titilando constantemente? La respuesta es NO, siempre y cuando 'T' este bien elegido. El sistema de visión humano tiene una persistencia, es decir no detecta los cambios de manera instantánea, por lo tanto si 'T' es lo suficientemente chico como para que el ojo no vea los cambios "prendido" a "apagado", no veremos al LED titilando, en cambio percibiremos un nivel de brillo que para nosotros será constante mientras mantengamos constante la proporción tiempo prendido, tiempo apagado de ‘T’. El valor máximo recomendado para ‘T’ es de 0,01 segundos.

Este tipo de control ya se encuentra implementado en plataformas como Arduino, CREATE USB Interface y otras.
El gráfico muestra tres situaciones distintas de PWM.
En el tercer caso, el tiempo de encendido es mas grande y como consecuencia sera el caso de mayor voltaje medio.