Simple Buck LED Driver With PWM Input

222,803

272

151

Posted in TechnologyLeds

Introduction: Simple Buck LED Driver With PWM Input

About: I am an electronic artist living in Brooklyn, NY. I work with LEDs and microcontrollers to create beautiful objects.

High-power LEDs over 1W are now quite inexpensive. I'm sure many of you are incorporating LEDs as light sources in your projects.
However I realize that the finding and configuring the power supply is still not as simple as it can be; commercially available LED drivers are convenient, but often overkill or not flexible. Even my own Universal LED Driver can be overkill at times. Some projects call for a bear minimum, simple driver.

Poorman's Buck - Simple, Constant Current LED Driver

So I created the "Poorman's Buck" - simple switch-mode (buck) constant current LED driver that's built without a microcontroller or a specialized IC. All of the parts are easy to obtain, "off-the-shelf", though-hole parts.

Even though this driver is minimalistic, I added a current adjust function that doubles as a dimmer, and an input to control the output with PWM. This makes the "Poorman's Buck" perfect building block for Arduino or other microcontroller based LED projects - you can control many high-power LEDs from a microcontroller simply by sending PWM signal. With Arduino you can simply use "AnalogWrite()" to control the brightness of high-power LEDs.

Step 1: Features

  • Inductor "switch mode" (buck) converter for high energy efficiency.
  • Wide supply voltage range of 5 to 20V. Great with batteries as well as AC adaptors.
  • Cycle-by-cycle, true constant current circuit
  • Configurable output current up to 1A
  • Up to 15W maximum output power. (at supply voltage 20V with five 3W LEDs connected)
  • Current control potentiometer (trims the output current down to about 9%)
  • Current control can be used as a built-in dimmer
  • Output short-circuit protection
  • PWM control input - controllable via external microcontroller including Arduino.
  • Compact design - only 1 x 1.5 x 0.5 inches (excluding the pot shaft)

Step 2: The Circuit

The circuit is built around a very common dual comparator IC: LM393 using buck converter topology.

The output LED current flows through R10 and R11 (current sensing resistors). The resulting voltage is proportional to the current according to the Ohms Law. This voltage is compared to the reference voltage by a comparator. As the Q3 turns on, current flows through L1, LEDs, and the current sensing resistors. Inductor does not allow current to shoot up immediately, so the current increases gradually. As the current gets higher, the voltage at the comparator's negative input pin increases as well. When it gets higher than the reference voltage, the comparator trips, which turns off Q3, which turns off current flowing into the inductor.
Now because inductor is "charged", current doesn't stop flowing immediately. Current then flows through the Schottky diode D3 to power the LEDs. This current gradually decays, and as the current decays so does the voltage across the current sense resistors. Eventually the comparator flips back again, and the cycle starts over. This method of controlling current is often called "cycle by cycle" current limiting. (This "true" current limiting also works as a buit-in short circuit protection. Shorting the output doesn't harm the circuit.)

This whole cycle above happens very quickly - as fast as 500,000 times a second. (This frequency changes depending on the supply voltage and LEDs forward drop voltage and current. Anywhere between 100k - 500kHz.)

The reference voltage is generated by an ordinary diode. Forward voltage drop of a diode is about 0.7V and stays relatively constant. Then potentiometer VR1 trims the voltage - because the output current is compared against this voltage, this in turn controls the output current. The range of the change is about 11:1 or 100% - 9%. This is pretty narrow compared to a real dimmer, however it is quite handy. Sometimes after installing the light you realize that LEDs are much brighter than expected. Then you can simply trim the current down until the brightness is just right.
You can omit the potentiometer and replace with resistors if your project doesn't call for it.

The beauty of a switch-mode controller is that it controls the output current without "burning" the excess energy. Energy from the power supply is used only as much as needed to get the required output current. Some energy is lost in the circuit due to the resistance and other factors, but not that much. A typical buck converter has efficiency of 90% or higher.
The Poorman's Buck doesn't get very hot when operating - only get warm. Unlike linear regulators, no heat sinking needed.

References
Buck Converter: http://en.wikipedia.org/wiki/Buck_converter
Comparator: http://en.wikipedia.org/wiki/Comparator


Configuring Output Current
The Poorman's Buck can be configured to deliver anywhere between 350mA to 1A of output current. Combination of R2's value and wether you connect R11, you can change the output current.

Here are samples of a few configurations:

Output Current R2 Value Use R11?
350mA (1W LED) 10k No
700mA (3W LED) 10k Yes
1A (5W LED) 2.7k Yes

The current control pot VR1 controls the output current from about 9-100% of the set current. So if you configure the unit to deliver 1A, you can trim it down to about 90mA just by turning the pot. This can be used as a dimmer (although the dimming range is somewhat limited).

PWM Input
The basic operation of this circuit can be done with just one comparator. However the most popular comparator IC (LM393) has two comparators in it. So rather than letting one of the comparators sitting doing nothing, I added a few extra parts to make it PWM controllable. the second comparator in the circuit works as an AND gate so that the PWM input has to be open (or logic high) for the output LEDs to turn on. Usually this pin can be left open (no connection) and the Poorman's Buck will operate without PWM. But when you need that extra control, you can connect Arduino or other microcontroller and control the high-power LEDs connected to Poorman's Buck. With Arduino, control is just as easy as using "AnalogWrite()" command. Up to 6 Poorman's Buck can be controlled by one Arduino.

This PWM control works within the current level set by the current control pot. So if you lower the current, the same 10% PWM level can be darker, for example.

The source of the PWM control is not limited to microcontrollers. Anything that produce voltage between 0 - around 5V can be used to turn the output on and off. Be creative - use photo resistors, timers, logic ICs... The upper limit of PWM frequency is about 2kHz, but I think 1kHz would be the optimum.

This PWM input can also be used simply as a remote on/off switch. However the LEDs will be on when the switch is open, and off when closed - opposite of usual power switch.

Step 3: Parts, PCB and Assembly

Assembly is very straight forward. All parts are standard, off-the shelf type.

Parts List
  • 1 or 2x 1 ohm 1W - R10, R11 (use only one to get 350mA, or 500mA (with R2=2.7k) output current)
  • 1x 10 ohm - R8
  • 2x 1k ohm - R3, R9
  • 3x 4.7k ohm - R1, R4, R7
  • 3x 10k ohm - R2, R5, R6 (change R2 to 2.7k ohm to get 1A output current)
  • 1x 10k ohm potentiometer - VR1
  • 1x 22pF/35V - ceramic capacitor C5 (optional)
  • 2x 0.1uF/35V ceramic capacitor - C2, C3 (optional)
  • 1x 2.2uF/10V electrolytic capacitor - C1
  • 1x 100uF / 35V electrolytic capacitor - C4
  • 1x 47-100uH / 1.2A - L1
  • 1x GPN (5551, 2222, 3904, etc.) - Q1
  • 1x GPP (5401, 2907, 3906, etc.) - Q2
  • 1x P-ch MOSFET (NTD2955 or IRFU9024) - Q3
  • 2x 1N4148 diode - D1, D2
  • 1x SB140 or 1N5819 Schottky diode- D3
  • 1x LM393 dual comparator - IC1
* All resistors are 1/8W or 1/4W carbon film unless otherwise noted.

Substitutions
Inductor L1 can be anywhere between 47 to 100 uH, rated at least at 1.2A. C1 can also be anywhere from 1 to 10 uF. C4 can be as small as 22 uF, making sure that it's rated at least at 35V DC.
Similarly, Q1 and Q2 can be almost any general purpose type transistors. Q3 can be substituted by other P-ch MOSFETs capable of minimum 2A of drain current, drain-source voltage at least 30V, and gate threshold lower than 4V (logic gate).

Assembly
Solder the parts starting with the lowest profile ones, in this case, IC1. All resistors and diodes are installed vertically. Be careful with the orientation of polarized parts, such as diodes, transistors, and MOSFET.

I designed the PCB in single layer, so home etching can be done easily. Gerber files and PDF are provided.

I'm offering the fab-manufactured PCBs as well as the full kits on my website.

Step 4: Connecting LEDs

The supply voltage has to be at least 2V or so higher than LED's total forward voltage, which is around 3.5V per white LED.

Depending on the power supply voltage, Poorman's Buck can drive up to 6 LEDs connected in series. With constant current LED driver, it's best to connect LEDs in series, so that all LEDs get the same exact current. The chart below shows the number of serial connected LEDs and the required power supply voltage.

Number of LEDs

Minimum Supply Voltage

1

5V

2

9V

3

12V

4

15V

5

20V


You can series-parallel connect LEDs to drive more LEDs as needed. If you only have 12V power supply but want to connect 6 LEDs, make two strings of 3 LEDs in series and connect them in parallel, for example (see the schematic).

Step 5: Put It to Use!

I'm sure there are many uses for a little driver like this - under the shelf lights, tabletop lamp conversion, LED lanterns, etc.

Power supply can be one of those wall-warts laying around. Voltage between 5 to 20V can be used. Batteries can be used as well.

Step 6: Amendment!

(As of Aug. 9, 2012)

The power supply voltage range was originally quoted as 5 to 24V. However as the MOSFET can only tolerate +-20V between the source and gate, the power supply should not exceed 20V.

I will post the circuit modification to allow supply voltage above 20V soon.

Thank you hanlin_y for bringing this to my attention.

Share

Recommendations

  • Microcontroller Contest

    Microcontroller Contest
  • Woodworking Contest

    Woodworking Contest
  • Casting Contest

    Casting Contest
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

151 Comments

HI ledartist,
I realize this is an old post, just wanted to say thanks for offering up such a simple, useful circuit and well written, complete post. Very useful.

Hey nice work... my psu is 24V. I have as much as 60 3W leds to my project, not all lit at the same time on 7 different circuits. Did you post the circuit modification to allow supply voltage above 20V yet?

1 reply

hanlin_y below posted an answer already, but here's a quick & dirty fix; you can place a 12 to 15V zener diode between the gate and source of the MOSFET - anode to source, cathode to gate. Then _important_ increase R8 value to 470 ohm or so. Please note this will add switching loss, so the MOSFET will generate more heat. But for the output current up to 1A should be fine. (not tested - proceed with caution)

Thanks a lot for this circuit :O I was almost going insane figuring it out myself.

It'll be a pain or RGBW though D:

but a few questions:

Do the capacitors have to be exactly the same? also can I use LM358?

Sorry I'm a total newb

1 reply

Please see the chapter "Substitutions". LM358 is an op-amp, and sorry you can't substitute comparator with an op-amp in this circuit.

It´s a reference to the circuit's power supply, 5 - 24v.

Can you upload the full gerber files (including Solder mask and Silk screen)?

This is great! I have been searching the internet for hours trying to find out how to build one of these. Didn't even think to check instructables. Quick question, would I be able to use this circuit to power two 10W 1A 9-12V high power LED's? Thank you for your time.

1 reply

That should be no problem. Use the power supply voltage at least 2V higher than the LED string forward voltage.

Nice work!

It took me some time to figure out where in the design 350mA magic number came from. I feel like this should be mentioned in the technical description. Here's where I think it's from. But I'm not certain.

The voltage drop of D1 is roughly 0.7V (you can research why, but that's just typical for that kind of diode), which means that the voltage across R2 + VR1 + R3 to reach ground is also 0.7V. D1 conducts to ground when more than 0.7V are applied by the source, but that current goes through a 4.7k resistance though, so roughly 4mA even for a 20V source).

If the VR1 potentiometer's wiper is on the least resistant setting, 0 Ohm, then you have 10k ohm of resistance before the comparator, and 11kOhm after it, which means that the comparator is sensing roughly 52% (11k / 21k) of the 0.7V, so 367mV. When it is turned the other way, it will be sensing 1k/21k * 0.7V = 33mV. (The description says the ratio is 1:11 but maybe I'm wiring it differently).

Let's assume that the comparator senses 367mV on the "-" side. Now, on the other end of the circuit, after going through the LEDs, the great majority of the current has to go through R10 (R11 is not there in the 350mA configuration). U=RI, and R is 1 Ohm. Which means that for the comparator to trip, the current has to pass over 367mA. There goes the connection between the voltage and current.

Hi man

Sorry I know this is a old post but I need to pulse a 1watt IR led at its peak forward current (1000mA) with a arduino for 5us high and 100us low.

Will this circuit work for that?

Thanks.

If you want to exceed 20V, there's another circuit that might work. You could use it to drive a string of high current LEDs such as 1.5A or 3A from Li-ion batteries. It lets you use a lower powered zener diode.

If the signal MOSFET turns on, the BPJ transistors' bases should receive 10V and cause TP2 to be 10V. The power MOSFET's Vgs should be -14 which is less than its rating of -20V.

If the signal MOSFET turns off, the BPJ transistors' bases should receive 24V and cause TP2 to 24V. The power MOSFET's Vgs should be 0V.

more than 20V buck.png
1 reply

Another option is to replace the zener diode with a resistor to form a voltage divider. You should still be able to keep Vgs in its safe range.

Very nice instructable, thanks for sharing! Sadly Flatcam doesn't like your gerber, I might just route a board to fit what packages I have on hand anyway.

I was wondering why the half rail reference was choosen for the PWM comparator? The output from the last comparator will flip between 0 or vcc, so you could have just a pull down resistor? Oh that would mean 2 inputs at about gnd, so noise could switch the circuit on easily.

Why is D2 needed, It prevents the comparator from sourcing the high state but lets it pull it low? You don't do the same for the comparator output powering the BJTs.

1 reply

If I remember correctly, the half rail reference and D2 are needed for the external PWM support. As PWM signal doesn't always go down to 0V (typically 0.4V from MCU), D2 was added to up the output voltage of the first comparator to about 0.6V.

R6 can be omitted if you don't use PWM input.

hey guys

is there anyone who can help me with this circuit?i need this plz help me.

in fact i am new with electronics

Untit11led.png

Hi guys.I am not very good in electronics and i realy want yo build this project but i cant.every time i tried to make it work it didnt.i assamble it in multi sim but it didnt work.would anyone help me plz.i realy need this thing.thx for your

ledartist - thank you for a great Instructable! I'm actually working on this build now, but I've run into a minor snafu - I don't have the requisite 2.2uf for C2. Now, I could use 2 * 1.0uf and 2 * 0.1 uf and end up with an equivalent 2.2, or I could just use the next highest value - 4.7uf.

Is this okay to do? Should I hold off until I have a 2.2uf cap? Will it be a problem if I only have 16v rated 100uf caps and not the 35v rated?

Thanks again!