Unique Bedroom Lamp: The LED Driver Schematic Circuit Diagram
Power LEDs are becoming more and more commonplace as bedroom light sources for a number of reasons. The greatest advantage of LED light sources, in my opinion, is that they last for a very long time. They are also extremely low in heat emission; thus, we can run an LED light source for minutes to hours and it will still be cool to the touch, compared to a short run with an incandescent bulb causing mild to medium discomfort if touched. Below is the circuit of an inexpensive white LED driver for your next unique bedroom lamp.
At the heart of the circuit is a constant current driver chip PT4115 (IC1) from PowTech (www.crpowtech.com). The PT4115, available in an SOT89-5 package, is, in fact, a continuous conduction mode inductive step-down converter designed for driving single- or multiple-series-connected LEDs efficiently from a voltage source higher than the total LED chain voltage. The device operates from an input supply between 6 and 30 V and provides an externally adjustable output current of up to 1.2 A. The chip also has a dedicated “dim” input, which accepts either a dc voltage or a wide range of pulsed dimming.
Here, the LED driver is designed to fit anywhere, and its output current is configured to about 300 mA. Less than the maximum current for 1-W white LEDs is deliberately selected to ensure the long life of LEDs. The circuitry is suitable for driving 1-W white LEDs up to four in series (tailored for 12- to 15-V power rails). The PCB should be designed so that the back of it is just a heatsink ground plane. During installation (after the construction), remember to glue the populated PCB with some silicone or heatsink compound to some aluminum bar or metal. However, it can work fine when driving 300 mA without a heatsink. Shown below is a good example of the recommended PCB layout (thanks to www.tindie.com).
It’s easy to set up the circuit. Just connect the power supply (12- to 15-V) output to the VCC terminal and GND terminals of the circuit (J1). You will easily find a small switch-mode power supply that can handle this. Then connect the anode of the LED (3x 1W in series) to terminal L+ and its cathode to terminal L– of the circuit (J2). That’s it — look at it glow!
- The required LED drive current can be tweaked by changing the value of resistor R1 (in the prototype, two 0.15-R resistors are connected in series to get 0.3-R value). Formula: ILED = 100/R1
- As stated earlier, the PT4115 allows dimming with a PWM signal at the DIM (pin 3) input. A logic level below 0.3 V at DIM forces PT4115 to turn off the LED, and the logic level at DIM must be at least 2.5 V to turn on the full LED current. The frequency of PWM dimming ranges from 100 Hz to more than 20 kHz.
- The DIM pin can be driven by an external dc voltage (VDIM) to adjust the output current to a value below the nominal average value defined by R1. The dc voltage is valid from 0.5 to 2.5 V (when the dc voltage is higher than 2.5 V, the output current keeps constant). The LED current also can be adjusted by a resistor connected to the DIM pin. The average output current is given by: IOUT = 0.1 x VDIM/2.5 x R1
- In India, all components for this project are available here: http://www.sunrom.com/p/pt4115-led-driver-with-dimming
Arduino PWM — Another Primer!
Fortunately, there’s an “Arduino way” to control the brightness of LEDs driven by the PT4115 chip through the pulse-width modulation (PWM) technique. Does it sound complicated? It isn’t. Here is a primer on PWM to help. Once you learn how to make one, you can easily try this not only on Arduino, but any other microcontroller that has PWM output as well.
For the Arduino, we write a value from 0 to 255 on a PWM pin, and the Arduino library will drive the assigned pin to output a PWM signal whose on-time is in proportion to the value written. Arduino uses 8 bits to represent analog data and can represent this data in decimal notation using any number between zero and 2^81 that is from 0 to 255, where 0 is 0 V and 255 is 5 V. Any other number between 0 and 255 will represent its respective voltage between 0 and 5 V. To write analog data to a pin in the Arduino, we use the command analogWrite (pin, value); wherein “pin” is the pin that we want to use for analog data (we can only use the pins marked pwm, and the value is any number between 0 and 255).
When I write analogWrite(3, 255/2); the result is a square wave on pin 3 whose width was divided by 2. The full width will produce 5 V, so this wave will produce 2.5 V (see the oscillogram).
Most microprocessors permit us to change the modulation frequency for PWM pins. The Arduino has its own set default values. For pins 3, 9, 10, and 11, it is approximately 488 Hz. For pins 5 and 6, it is about 977 Hz. These values are for an Arduino running at the default 16 MHz. We can change these frequencies easily by writing new values to the appropriate timer register. For more details on setting timer frequencies, refer to this guide: http://www.arduino.cc/playground/Main/TimerPWMCheatsheet
Now load this simple code, connect a 10K potentiometer to the Arduino with the middle (wiper) terminal to pin 9, the first terminal to 5 V, and the last terminal to GND. Next, connect an oscilloscope to pin 3 of the Arduino and observe the PWM signal change when turning the 10K pot in clockwise and counterclockwise directions.
//PWM Example Code
int pwmPin = 3; // PWM output pin
int inPin = 9; // Potentiometer input pin
int val = 0; // variable to store the read value
float volt = 0; // variable to hold the voltage read
pinMode(pwmPin, OUTPUT); // set pwm pin as output
val = analogRead(inPin); // read the potetntiometer input pin
volt =(5.0 * val) / 1023;
val = 255 * (volt / 5);
Now that we understand how PWM works and can even change its frequency, it is time to start some experiments on how to implement a microcontroller for PWM dimming of LEDs with or without dedicated drivers. Such experiments are incredibly useful. If you have any questions about this article, please drop me a note in the comments. If you have any improvements, corrections, or additions, please let me know about them as well.
Finally, a word of caution: The PT4115 chip is prone to overvoltage/transient damage on the DIM (pin 3). So it’s better to protect the DIM pin with a voltage clamp, as shown here: