Unique Bedroom Lamp: The LED Driver

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 ( 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


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:

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).

3-pwm dso

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:

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

void setup()
   pinMode(pwmPin, OUTPUT); // set pwm pin as output

void loop()
   val = analogRead(inPin); // read the potetntiometer input pin
   volt =(5.0 * val) / 1023;
   val = 255 * (volt / 5);
   analogWrite(pwmPin, val);

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:

4-Voltage Clamp RZ


Join the conversation!

Error! Please fill all fields.
  • berriend57yahoo-com

    RFI can come from several routes, and the mitigation strategy is different according to the particular interference. The magnetic field leakage from the inductor is probably minimal, but can be mitigated by shielding the supply (at least the inductor section) with a magnetically permeable material (steel works OK, aluminum doesn’t). It’s more likely that it’s EMI fed back through the power lines to your radio equipment. Cheap Power supplies (if it’s cheap, it’s probably a switcher…) sometimes neglect EMI filtering on their input lines, so the switching noise propagates to everything else supplied by the same circuit. You can try wrapping the power lines around a ferrite bead, or installing a traditional line filter (either at your power supply or your radio equipment, or both). You shouldn’t be getting that much emission from the LED itself, because the inline choke should smooth out the PWM feed current.


      Thanks for your reply but I tried all that but some beasts made me to go back to the old copper and iron transformers if I want to listen to Short Wave on Tecsun PL 380 radio’s and dump the nice cool running switchers! Medium Wave is a pest to listen to near these critters especially if the signal is below S3 on the signal meter.


    This is very fancy BUT HOW CAN I REMOVE RFI FROM SWITCHERS? I listen a lot to Medium and Short Wave broadcasting and the buzzing of switchers made me to go back to the old faithful transformer rectifier and linear regulator. To pout all lights in Faraday cages is out of the question impractical

Looking for the latest from TI?