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
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.
ADDED:
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.
Typical commercial USB to analog device
If your input voltage is going to vary that much, you're going to have to start with a power conversion stage to generate a local stable power source. You have three choices - step down to less than 7 V (let's say 5 V), step up to more than 24 V (let's say 26 V) or a buck-boost type converter which aims for somewhere in the middle (let's say 12 V).
Given the extra complexity of the buck-boost, I would rule it out personally. You then have two different operational currents which you can calculate - 22 W / 5 V = 4.4A or 22 W / 26 V = 850 mA. Neither of these are horribly large given decent amounts of copper trace on a 2oz / sq. ft. board. However, your ohmic power losses in traces / PWM device channel will be just over 27 x higher with the low voltage version - but they may still be insignificant as a percentage of the total output power.
As you can see here, boost converters tend to be slightly less efficient than buck converters, so you're trading losses in the converter stage against losses in the traces / PWM control. Personally I would opt for the high voltage option because it places lower demands on my PWM control device, but overall efficiency is hard to call between the two, and will likely be down to the quality of design execution over the choice of path. If you have the chance, mock up both approaches on a board using a dummy load in place of the LEDs and work out which matches your needs best.
Best Answer
You are going to want to make a current driven set-up.
As high power LEDs get hot and/or age they will change their characteristics. You are going to want to account for that and the easiest way is driving a 4.2A (or, advisably 4A with brand Unknown eBay type) and let the voltage be what it is.
The cheap Chinese drivers usually drive a current about 10% below the normal advised LED current for that type and dimension. The best driver I have seen (German built) was 97% efficient given a narrow input voltage band and exactly the specified LED. My own measurements of cheaper models come between 70% worst case and 91% best case. This differs from type to type and greatly with input voltage.
Many cheap modules also have an input pin somewhere on the main chip that allows 0-2V or PWM (3.3V or 5V) dimming, if you know what to look for. In case you want to add that later.
I have not had the need to import and/or use 100W 24V COB drivers yet, so no specifics on that exact type.
If you use an Atmel to drive it with PWM, again make sure you use a current measurement for your feedback parameter.
As for driving them with AC, there are undoubtedly modules that do exactly that, but I don't know any specifics.
If you build something yourself for 4 lamps, that are well protected from touching and moisture (this includes the LED's metal base plates and such) you could potentially regulate the current with an Arduino through 4 lamps in series with a voltage taken directly from a rectified AC.
This, however is risky and requires a lot of careful experimentation and testing with a low voltage, low current power source to avoid damage (48V, 3A and one LED PWM'ed, for example, no risk of death and if you accidentally short the PWM transistor the supply will limit to 3A, leaving your lamp in tact).
And officially you need to perform power factor correction, but if it's for hobby / one-off there's worse devices in the world that used to be mass produced, so don't worry too much.
If you are working with just the LEDs, keep a VERY close eye on temperatures as well, they need a lot of help getting rid of heat and just the LED's back surface will absolutely not be enough for more than a watt or 2.