Dimmable LED Light Schematic Circuit Diagram
As we all know, LEDs are dimmed by altering the current flowing through them, not the voltage. We achieve this effect in this circuit by using an AVR microcontroller (2313 from Atmel) operating in the comparator
mode (Figure 1).
The nominal value is preset on comparator input AC1 and compared with the voltage (proportional to the LED current) at AC2. On power-up the microcontroller sets the gate of the MOSFET (connected to output B.4) to 0 so that it conducts; a linearly rising current then flows through the choke and LED. The voltage drop across the 0.1-Ω shunt resistor is proportional to this current. Once the nominal voltage is reached, the microcontroller switches off the MOSFET and waits a few milliseconds. During this time a linearly decaying current flows through the choke, LED, shunt and recovery diode. Then everything restarts and it happens all over again. The result is a direct current voltage with a triangular waveform overlaid. The Bascom program for the microcontroller (see Listing) is short and simple to understand. Source code and hex file for the program can be downloaded free of charge at www.elektor.com. In this circuit we use a 6-V lead-acid gel cell battery for the power supply; although these are heavy, they are dependable and simple to charge. The 56-Ω resistor and diode act to limit and stabilize the microcontroller supply voltage, which is used also as a reference voltage for the voltage divider set with P1. The LED chosen is a Luxeon LXHL-LW3C (nominal values: 3 watts, ULED = 3.7 V, ILED = 0.7 A). A 100-nF capacitor connected in parallel with the LED and shunt is wired directly to the PCB; this is to eliminate possible interference effects from cable capacity. The 100-μF electrolytic capacitor is vital to smooth the 6 V operating voltage, which would otherwise ‘droop’ or ‘sag’. The choke should not saturate at maximum current but match the load of the current being carried. To avoid generating square-wave effects that could produce false current values, the shunt resistor used should be a carbon film type, not wire wound.
The lamp, used for speleology (cave exploration), has operated very reliably over a lengthy period and is more economical in battery use than a halogen lamp. One problem arose in use when the LED got (far) too hot. It appeared that the current cut-off value was not being observed, due possibly to microcontroller failure or a dirty (or faulty) trimpot. If the latter’s wiper loses contact with the carbon track the comparator input becomes open-circuit and can become any old value (as then does the LED current). Installing a watchdog timer could help (to restart the microcontroller promptly), also a pulldown resistor from the comparator input to ground.