05-01-2012, 09:55 AM
|
#2 |
| |
I didn't read that other thread, but to answer your question on how you do a dimmer with LEDs, it is done with pulse width modulating (PWM) them.
For automated control, they probably use a microcontroller and a real time clock (to get time of day information).
A microcontroller will usual handle PWM by using a counter. Every clock cycle it will 'count' and compare the value to a threshold value. If it passes the threshold, it turns the LED off and continues to count. When the counter rolls over back to zero, it turns the LED back on.
By changing the threshold, you change how long the LED is on during a time period. The longer it is on, the brighter it will be because it approaches the point where it is constantly on anyways. The shorter the pulse, the dimmer.
Without knowledge of assembly or C, programming a microcontroller will be quite a challenge, but not impossible.
To go further with an RGB LED you can use this method to generate every possible color (well, lots of colors anyways). An RGB LED has three LEDs in it; red, green, blue. As we all know, from those primary colors you can make any other color. So by using PWM on each LED individually you can change how 'bright' each color is and thus the overall color. This isn't useful in an aquarium though ;)
EDIT: I edited my original post to provide more information on the implementation of a dimmer with a microcontroller.
Last edited by Geomancer; 05-01-2012 at 10:05 AM..
Reason: Adding more information
|
| |