Provided I set up the PIC and program it correctly (planning on using this guide to interface it as a USB HID device), would this be a suitable configuration? I'm not entirely certain how I should be deriving values for the passive components outside of the manufacturers given buck configuration application example.

I also can't find any examples using this driver with digital PWM (as opposed to converting the digital to analog), and I can't find enough explanation on how the DCTRL and ACTRL pins work. In this schematic, I assumed it would work as I intend by just applying the PWM signal directly to the DCTRL pin and leaving ACTRL untouched. In any case, if I wanted to use the digital-to-analog conversion, I'd just need to add a capacitor from ACTRL to GND (Richtek suggests a .47uF).

Thanks again :)

edit 4: From my last comment -- ...I think I'm leaning towards using the RT8482 and the NTD4960 to drive the LED, and integrate it on a PCB along with a PIC18F2550 and its associated USB interface. If I were to do this, how should I be calculating resistor/capacitor/inductor values for the driver-side of the circuit (assuming 0-1.5A or 0-2A current range for the LED)? The worst part about this project, at the moment, is that a programmer for the PIC will cost more than parts =_=

edit3: Given the answers I currently have, I should be able to deal with the analog part of the circuit, however, I still am at a loss as to how I should generate the PWM signal. What sorts of MCUs should I be considering, given the restrictions of it needing to do nothing more than generate a PWM signal, and be able to be interfaced via USB (be it native USB, or a conversion to USB from another standard)?

I'm currently looking to design a driver for a single high-power LED that can be brightness controlled and turned on/off via a PC. I am using a Cree XM-L LED (datasheet here, it's the 240lm neutral white model, part number: 000LT40E4). I already have a GUI written in C# to control the other parts of the project (camera and 3-axis motors), and I'd like to integrate light control into my program. Currently we are using a basic analog circuit to drive the LED (nothing more than a current-limiting resistor and a rheostat).

I figure the best approach would be to build a small constant-current, PWM controlled driver circuit. I stumbled upon this circuit on Instructables and think it would suit my needs fine (however, I have no commitment to any design, so any ideas would be appreciated).

Pertaining to the circuit above, I'm not sure what kind of parts I'd want to get (for the transistors, the zener, if necessary), and likewise, I have no idea what kind of microcontroller I'd need. I have next to no experience with microcontrollers, so I'm not sure what I'd need to get started. I shouldn't have a problem programming the controller, I just don't know what type of controller I'd use for this application. Likewise, I'm not sure how I'd interface the controller with a PC after programming it, though I'd assume RS-232 would be feasible, in which case I shouldn't have an issue; I can use a RS-232 --> USB converter and deal with serial communication within the scope of C#.

I've also stumbled upon ICs like this Maxim-IC MAX16834, but feel like these are a) overkill and b) less efficient, given I'd still need a microcontroller to generate the PWM signal and supply power transistors, so I could just use the basic circuit above and use the PWM and NPN transistor instead.

As far as my background goes, I'm entering my third-year in the EE program at UMass Amherst. I'm familiar with basic circuit analysis and programming, but I haven't learned anything about electronics yet, hence why I'm posting this question. I get the gist of most of the circuit designs, I just don't know how to design them from scratch since I don't know how to calculate values when non-elementary items are added to the mix (transistors, mainly). I feel that with a simple list of parts and schematic for this project, I'd be able to figure out the rest (all that's really left is programming the microcontroller).

If I left anything important out, please let me know. Thanks in advance!

edit: I forgot to mention, at the moment, the LED isn't normally driven past 400mA. It is rated at 700mA nominal (but is rated to run all the way up to 3A). I'm not sure what levels of light we will need at the end, but I'd like to have the ability to supply up to 2A.

edit2: To answer RusselMcMahon's question, I would prefer to run the LED off of 5V (I already have a Cincon CFM20 5V, 20W DC supply), but if a potential circuit design would require a different supply, it wouldn't be a problem to buy a new supply.

  • 2
    \$\begingroup\$ Your background should be in your profile. Then we can consult it at any time, without you having to repeat it in each and every question. \$\endgroup\$
    – stevenvh
    Commented Jul 19, 2012 at 13:50
  • \$\begingroup\$ @stevenvh I understand that. I included a more specific background for this question because I think it is important to mention that while I understand the general approaches to solve my problem, I don't know how to deal with the specifics of part selection and other basic design issues (but given a circuit, I should be able to understand how it works, just not quantitatively). \$\endgroup\$
    – Shamtam
    Commented Jul 19, 2012 at 14:10
  • \$\begingroup\$ Very important - what voltage do you want to run this from? eg 12V, 5V, ... . The instructables circuits are poor. They would work after a fashion but the 'designer' does not fully understand his art. The Maxim circuits and IC are good BUT they are for a string of LEDs that have a highjer voltage than the Vin supply voltage. Unless you use Vin <= about 2.5V that does not apply to you. We will be able to offer good advice. Vin matters much as a first step. NB - f mains in (110 or 230 VAC) then an intermediate low V DC will be a good idea. \$\endgroup\$
    – Russell McMahon
    Commented Jul 19, 2012 at 14:18
  • \$\begingroup\$ @RussellMcMahon I can't believe I forgot that. I updated the question. \$\endgroup\$
    – Shamtam
    Commented Jul 19, 2012 at 14:36

2 Answers 2


Given: Cree XM-L LED.
Want: Up to 2A drive, PWM controled by PC via USB.

This can be two parts. ie actual LED drive and PC to LED drive interface. These may or may not be integrated.

A "very easy" approach is to
1. use an off the shelf USB to "output" device. "Output" may be analog level, PWM, 8 bit port etc to control ... 2. An off the shelf LED driver that uses analog or PWM input.

For example, the circuit below using a RT8482 requires an analog input level or PWM with a simple RC filter (to convert the PWM to analog). The analog could be provided by a USB to analog output I/O device (COTS) or by a USB to parallel port device (not a printer port per se) (COTS) with a simple R2R digital to analog converter (about 16 resistors plus maybe a cheap op-amp).

Many examples of R-2R ladders here - links live

Or a microcontroller with USB capability could have a relatively simple program written to provide PWM or analog output. A USB enabled Arduino or a Raspberry Pi would do this. (USB has to be slave not host mode).

LED drive:

(1) "Off the shelf" complete units that do the LED drive part of this job well are available at good prices from eg ebay, or Mouser and similar. Using such is a good default solution unless you have some reason to do otherwise.

(2) DIY LED driver.

Digikey LED drivers are found here. Alas the parametric search is poor in this case (which is unusual).

Searching using LED driver 2A gives better results.
There will be a nummber.
Example only: For $US1.52/1 in stock Digikey you get
1 Ricktek RT8482, buck or boost, LED driver.
Drives external MOSFET so LED current capability essentially unlimited. Looks like a good start. 350 kHz for smallish inductors.

  • High Voltage Capability : VIN Up to 36V, VOUT Up to 48V
    Buck, Boost or Buck Boost Operation
    C u r r e n t M o d e P W M w i t h 3 5 0 k H z S w i t c h i n g Frequency

enter image description here Easy Dimming : Analog, PWM Digital or PWM
Converting to Analog with One External Capacitor
Programmable Soft Start to Avoid Inrush Current
Programmable Over Voltage Protection
VIN Under Voltage Lockout and Thermal Shutdown
16-Lead WQFN and SOP Packages
RoHS Compliant and Halogen Free

A MOSFET suitable for use as M1 would be eg ONSEMI NTD4960 $US0.40/1 in stock Digikey, 30V, 9A, 9 milliohm on resistance nominal, logic gate - data sheet curves show good at 4V gate and say 4A.


Should I be looking at specific types of inductors for this sort of application

Inductors are very special for best results. If this is a one-off then off the shelf inductors from eg Digikey or similar are wise. We can give advice in this when final real spec is known.

I'm assuming all of the caps in this type of application would be ceramic?

Ceramic capacitors will work well for all capacitors shown. At least 10V rating. More or much more voltage OK.

D1 is Schottky and should have current rating equal or greater than LED max current.

Now I just need to figure out how to generate the PWM signal.

PWM is "easy" [tm] and may not be needed. Above LED controller example can use analog or PWM control.

USB to I/O

This USB to paraell FIFO I/O module](http://www.ftdichip.com/Support/Documents/DataSheets/DLP/usb245r-ds-v10.pdf) uses FTDI's FT245R USB-parallell FIFO interface IC - datasheet here .
Vast amounts of related FT245 information here

FT245 available from Digikey ~= $US4.50/1 from here

FT245 based module from Digikey for about $40/1 here

This page discusses a DIY USB printer port which, as you have complete control over the hardware and how it acts, could "easily" meet your need. Based on a PIC18F4550 microcontroller and not much else. All software PCB patterns, circuit etc free.

enter image description here

Typical commercial USB to analog device

  • \$\begingroup\$ Should I be looking at specific types of inductors for this sort of application (I'm assuming all of the caps in this type of application would be ceramic)? Thank you for the post though! Now I just need to figure out how to generate the PWM signal. \$\endgroup\$
    – Shamtam
    Commented Jul 20, 2012 at 0:18
  • \$\begingroup\$ On a slight tangent, if I were to change my requirement to only need up to 1A or so maximum, wouldn't it be easier to use an IC like the ON Semiconductor NCP3065 (digi-key link here: digikey.com/product-detail/en/NCP3065PG/NCP3065PGOS-ND/1693183) to be an all-in-one package to handle driving the LED (and all I need to do outside of this is to supply digital PWM input to the COMP pin)? I'm rethinking if I really need up to 2A, seeing as how I'm generally getting sufficient light output at 350mA. \$\endgroup\$
    – Shamtam
    Commented Jul 20, 2012 at 3:26
  • \$\begingroup\$ @Shamtam - The NCP3065/NCV3065 is a sheep in sheep's clothing rework of the venerable MC34063. It is "OK" but would have poor efficiency if used here as shown by them due to the decades old darlington transistor switch with massive on voltage and so losses. You can use if to drive an external MOSFET but max frequency is still not marvellous. The have reduced Vref from stupid to just "high for 1A+ LEDs". ie it's now 0.235 V which is about 0.235/3.3 = 0.07 so you lose 7% efficiency in the sense resistor. ... more ... \$\endgroup\$
    – Russell McMahon
    Commented Jul 20, 2012 at 7:47
  • \$\begingroup\$ @Shamtam - ... You are better off with the Richtek IC I mentioned. (110 mV sense, higher frequency, more ...). Driving an external FET is not an issue if the IC is made for it as this is. \$\endgroup\$
    – Russell McMahon
    Commented Jul 20, 2012 at 7:47
  • \$\begingroup\$ I figured as much. Given the devices you've given me so far, I'm leaning towards using the RT8482 to drive the LED, and then I could use the PIC18F4550 to send a digital PWM signal directly to the controller. This way, I could make a single board that has a USB in, and an LED out (where I'd use a simple barrel DC Power jack), and the control/driver circuitry is integrated. Given that this is possible, this should be a very small board, and also very cheap, but with plenty of functionality. \$\endgroup\$
    – Shamtam
    Commented Jul 20, 2012 at 14:40

There are some difficult challenges in driving high current LEDS for starters, yet it is a simple concept to turn on a diode. You will learn a lot of analog and thermal inter-dependancies that are also dependant on mechanical skills and the LED has a very low series resistance like a battery so you will learn the effects of this too.

How to drive an LED rated for 5 Amps absolute max and 3 Amps continuous but recommended in test spec at 0.75 A without turning the (light) "emitter" into a soldering iron. ;) ?! ;)

Thermal Resistance of LED The odd thing is LED's radiate no heat since there are no IR wavelengths. It is all conducted to substrate. But then the "Black body effects" of the substrate radiates IR heat as it attempts to conduct it away from the source. This may be hard to understand at first. Black body effects are are detailed here, but essentially the energy absorbed as conducted heat from V*I loss is later radiated by heat sink conductors as "infrared heat". This wavelength shift is always from short to longer wavelengths, blue to yellow red phosphor to infrared heat loss indicates emissions going to lower electron valence levels. Thermal resistance case to ambient is a significant impact on de0rating of the ambient for the device. enter image description here

Effective Series Resistance (ESR of LED and of Driver) 1) you need great thermal conductance and an aluminum substrate to spread the heat fast to a large heatsink that removes the heat efficiently from a 2mm square chip inside a 5mm square SMD package. This chip when driven with 0.7A @ 3.5Vmax =2.45W worst case. Yet the rise in forward voltage "TYP" is only 2.90 to 3.35 from 0.7A to 3.0A. THis ∂V/∂I change is the effective series resistance ESR [Ω] which can vary significantly from batch to batch of wafers , which is why worst case or MAX is much larger than TYP. The ESR from 0.7 to 1.5A is 3.1-2.9=0.2V/0.8A = 0.25Ω ESR. It will decrease as current increases from this point and visa versa. So like a battery or an ideal zener, it has a sharp V-I curve with low ESR. This is critical when choosing switch MOSFETS and other switches to ensure your driver is much lower than this load and also understand the I^2R power dissipation increases rapidly with current. The efficiency also drops with rising current so you want to keep this in mind if you were thinking low duty cycles at 3A peaks. This applies to "efficacy" of Lumens per watt created by in this case converting blue light on LED substrate to some phosphors on the surface to emit white balanced light. THis conversion drops with rising light levels slightly. Also heat loss increases with ESR * I squared. All this heat is conducted fortunately and none is radiated as IR until it hits your heatsink. Then it becomes radiated as well so local ambient heat rise can drop your light output and cause blue shift over time and make your LED chip into a soldering iron(ha) if you have no heatsink.

  1. learn how to make a heatsink <<10deg'C/Watt preferably 4'C/W.

  2. Understand the effects characteristics of series resistance in each component or ESR.

The Simplest solution is like the site you posted earlier with a MOSFET switch to ground with a current sensing resistor which also adds to circuit ESR. The reasons of choosing Rs similar to ESR of LED string are for optimal efficiency and and ability to drive LED hard without thermal runaway caused by stability of V vs T effect (Shockley effect). Otherwise current limiter circuits are used which often have a higher voltage drop, hence more inefficient. Switching current sources help stabilize with the chance of higher efficiency.

  1. Learn to add realize non-ideal schematics in your mind. From w. It goes a few levels deeper but good enuf for now.

The simplest PWM circuit uses a low ESR MOSFET driver with ESR << LED or << .25Ω.

  • \$\begingroup\$ A lot more than I was looking for, but good information! I already have the LED on a heatsink, and it's mounted with thermal tape (for prototyping). In a final revision, I'd probably end up using thermal epoxy to mount the LED to the heatsink (I'm soldering wires to the top-side of the PCB of the LED and using an electrically-insulating thermal mating between the entire bottom of the LED package to the heatsink). At the moment, the LED can be driven around 350mA with no heat issues (it becomes warm after extended use, but not too hot to touch). At this point, I just need help with the MCU. \$\endgroup\$
    – Shamtam
    Commented Jul 20, 2012 at 0:12
  • \$\begingroup\$ Likewise, in a final product, the LED would only be on for fractions of a second like a camera flash, enough for the camera to snap a picture, and then shut off. In this case, I would imagine even a moderately undersized heatsink would suffice for short, high-current bursts (say at most 2A at 500ms). However, the heatsink won't pose a problem for me. I mainly just need to figure out how to generate a PWM signal from a computer. \$\endgroup\$
    – Shamtam
    Commented Jul 20, 2012 at 0:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.