RGB LED Controller - Driving Luxeons

Adam Horden, Sat Aug 05 2006, 10:32AM

Hi All,

It has been awhile since I have posted here. I am currentley designing a RGB LED controller using a PIC microcontroller.

The whole thing is going to be based on a PIC18F1320 a 18 pin PIC microcontroller that comes in SMD form but also has a DIP version that I am using in the prototype. Microchip sent me 3 of these devices. I will be programming the entire thing in PIC C (Microchip C18 compiler). The compiler is free from microchip for Students and all the books to learn it are free PDF downloads or for a small charge they will send you a printed copy. I am just waiting for my books to arrive.

PIC18F1320 Datasheet

This little 18 pin chip has lots of goodies on board. 8K of flash programming memory, 256 bytes of EEPROM, 16 IO, PWM, USART, 2V to 5V voltage range and with nano watt technology.

This will also be my first PIC C project. I am learning it now as I need to use it in the furture in my BENG degree.

I hit a small problem that I cannot seem to find a solution for. I want to drive luxeon LED module.

For any one who has not seen a luexon module before there is a photo of one below:

StarIII

You can get these in red, green and blue. I will use 3 to produce RGB. Red Green and Blue are the 3 primary colour so any colour can be generate by mixing these 3 colours. I should be able to create a nice morphing effect.

The problem is that these modules do not emit the same Lumens. In order to get a constant brightness from each unit I need a constant current source. Each luxeon would have its own calibrated constant current source so I can get the same light output. Control would be easy as I would just need to turn them on and off for starters but also I need PWM controll to due HSB colour space I plan to use to give some intresting morphing effects.

What is the best way to build a constant current source that is capable of a constant 400mA (yes these suckers need that). I can sort the PIC control out later as if the constant current sources are made from discrete opamps there are numerous ways to controll them.

The PIC prototype will just use standard LEDS to produce the actual code then swap to the luxeons but before I start the project I need some ideas on how to produce a decent constant current source.

The whole project is going to be powered of a custom DC DC converter. Based around the boost topology so I can use a single battery low voltage high current to supply the project.

Efficenciy is eveything here as it will be powered from batterys at some point.

I played with transistor constant current sources but rather use opamps if I can. Any one suggest where I should start? Just the name of a topology would help as I do not want any one to go out of there way to design it for me just some pointers where I can start.

http://www.lumileds.com/pdfs/DS46.PDF

The datasheet for the devices I am using is shown above.

Thanks,

Adam

Re: RGB LED Controller - Driving Luxeons
Steve Conner, Sat Aug 05 2006, 11:11AM

Hi Adam

There's loads of different ways to drive lasers and LEDs with a constant current. At work, we use a switched-mode circuit running at 300kHz to drive higher powered devices where efficiency is important. When we're more worried about stability and low noise, we use a transistor or MOSFET in linear mode. The current goes through a precision resistor, and we sense the voltage across the resistor and use feedback with an op-amp. It's much the same as the current source circuit I used in my OLTC trigger pulse generator but upside-down.

For your application, I'd avoid the fancy active current source circuits and just use a resistor in series with the LED. Choose the resistor values for the three LEDs to get the same brightnesses when running off constant 5v. To PWM it, just put a power MOSFET in series with each LED, driven straight off the PWM waveforms from the controller. The LED actually blinks on and off very fast at full brightness, and your eye averages it out. I think that's how Big Clive's RGB driver works.

The resistor wastes power, but any of the linear current source circuits would waste just the same amount.
Re: RGB LED Controller - Driving Luxeons
Sulaiman, Sat Aug 05 2006, 02:18PM

If you have one boost convertor per led
you need no power-wasting resistor or constant-current source
each led POWER will be precisely determined by
(Supply Voltage - Switch Voltage), On time and repetition rate.

For switching times equal for equal brightness
choose inductors to match leds
(i.e. less current = more inductance)

As efficient as possible !
Re: RGB LED Controller - Driving Luxeons
HV Enthusiast, Sat Aug 05 2006, 03:53PM

wrote ...

The problem is that these modules do not emit the same Lumens. In order to get a constant brightness from each unit I need a constant current source.

Not only that, but the sensitivity of the human eye varies from wavelength to wavelength, so x lumens of red will not appear as "bright" as the same number of lumens of green.

As far as variable current source, simply use PWM on each LED and vary the pulsewidth to vary apparent brightness.
You can make this a true current source by simply monitoring voltage across resistor (put resistor from cathode of LED to ground), and use this voltage as feedback to control the PWM. Of course, its not a true boost converter which is common with LED current source supplies, but you will be limited to the voltage you have.

Here is a constant current supply i made a long long time ago in a galaxy far far way. . .

http://www.danielmccauley.com/spacecatwebsite/led_regs.htm

These sold like hotcakes, i think the full schematic is in the datasheet.
Re: RGB LED Controller - Driving Luxeons
Adam Horden, Sat Aug 05 2006, 07:18PM

EastVoltResearc wrote ...

wrote ...

The problem is that these modules do not emit the same Lumens. In order to get a constant brightness from each unit I need a constant current source.

Not only that, but the sensitivity of the human eye varies from wavelength to wavelength, so x lumens of red will not appear as "bright" as the same number of lumens of green.

As far as variable current source, simply use PWM on each LED and vary the pulsewidth to vary apparent brightness.
You can make this a true current source by simply monitoring voltage across resistor (put resistor from cathode of LED to ground), and use this voltage as feedback to control the PWM. Of course, its not a true boost converter which is common with LED current source supplies, but you will be limited to the voltage you have.

Here is a constant current supply i made a long long time ago in a galaxy far far way. . .

http://www.danielmccauley.com/spacecatwebsite/led_regs.htm

These sold like hotcakes, i think the full schematic is in the datasheet.

The schematic is not in the datasheet but your post Dan gave me an idea.

I do not need a boost converter (step up) but even better a buck converter (step down).

If you take a standard buck converter and use the LED in sersies with a low ohmic resistor as a current shunt and you use the interal comparator on the opamp you can have a very nice high power LED driver.

Now we want the inductor operating in continous current mode so the current does not drop to zero where in discontinus mode the current does drop to zero.

There will be some AC component in the voltage output in the form of voltage ripple superimposed on the DC component and this can be elimated with a capacitor. But I am thinking that this will not matter with an LED as a load and the capacitor can be eliminated.

The mosfet and diode in the buck converter will have to correctley chosen and same with the inductor. So I am going to have to do some math. But the PIC can control everything and have full error control using the internal comparator and A2D so I can have over voltage over current and under current fault protection all thrown in. Just need to learn how to programme it all!

But I was thinking if each of these LED modules I use has its own converter on a small SMD PCB with a small 8 pin pic (16f675 is a good part for this) mounted on the back of the module then all I have to do is programme a serial routine so I can control these LED modules from a master PIC controller that can do effects. This way eveything is made super small and is efficent.

I could make as many of these little modules as I require and they can be used standalone if require. There is plenty of IO on a 675 so I can add a button to control brightness if in standlone mode and serial mode to do RGB used with other LED modules.

This is start to become an intresting project and has had me reading into physics and colour spaces and other stuff I have never done before. I need to order some parts in so I can build a prototype and start programming.

I will write up everything as an open source package.

Adam
Re: RGB LED Controller - Driving Luxeons
..., Sat Aug 05 2006, 07:25PM

If you really want a simple current source, all you need is a npn power transistor (that will be on a small heat sink to be able to disapate a few watts) with a variable 100r resistor in series with the gate going to the outputs of the pic. You dial the resistor in to give the disired current, and viola it works. And best of all it is a true current source, so as long as the output from the pic is regulated you can vary the input voltage and the led's output would stay constant. Almost any transitor should work, just make sure it has a decently high gain (Hfe>100)

If you choose that topology, I would recomend getting a little low dropout 3.3v regulator (there are tons of them out there, get one that has <1v of dropout at 100ma and you should have no problems) to power the pic, then wire the transistor open collector (ie emiter grounded, collector->led->v+) and you can vary the input voltage of the circuit from 4.5->max input of voltage regulator.

I am guessing that this isn't going to be battery powered, so you aren't worried about efficieny, and since you have luxeons you are going to need to disapate a ton of heat anyway... Might be the best solution.
Re: RGB LED Controller - Driving Luxeons
Steve Conner, Sat Aug 05 2006, 10:30PM

Adam wrote ...
If you take a standard buck converter and use the LED in sersies with a low ohmic resistor as a current shunt and you use the interal comparator on the opamp you can have a very nice high power LED driver.

That is roughly how our switched mode laser drivers work. We have a more elaborate filter instead of just a single inductor. They do run in continuous current mode.

I was puzzling a related problem when trying to design some luxeon headlights for my mountain bike. I wanted to run two luxeons in series off a nominally 6V battery that could range from less than 5V to more than 7V. But each luxeon has a voltage drop of about 3V, so I would need a boost converter when the battery was flat and a buck converter when it was fresh. frown I don't want to change the battery voltage because I already have a halogen headlamp that needs 6v.

I guess I could use some kind of buck-boost circuit, but today I thought of a simpler solution: get another LED so I can have three in series wink

I believe EVR has designed these things in the past, so maybe he'll have some thoughts on the matter.
Re: RGB LED Controller - Driving Luxeons
Adam Horden, Sat Aug 05 2006, 11:34PM

Steve Conner wrote ...

Adam wrote ...
If you take a standard buck converter and use the LED in sersies with a low ohmic resistor as a current shunt and you use the interal comparator on the opamp you can have a very nice high power LED driver.

That is roughly how our switched mode laser drivers work. We have a more elaborate filter instead of just a single inductor. They do run in continuous current mode.

I was puzzling a related problem when trying to design some luxeon headlights for my mountain bike. I wanted to run two luxeons in series off a nominally 6V battery that could range from less than 5V to more than 7V. But each luxeon has a voltage drop of about 3V, so I would need a boost converter when the battery was flat and a buck converter when it was fresh. frown I don't want to change the battery voltage because I already have a halogen headlamp that needs 6v.

I guess I could use some kind of buck-boost circuit, but today I thought of a simpler solution: get another LED so I can have three in series wink

I believe EVR has designed these things in the past, so maybe he'll have some thoughts on the matter.

Well as the PIC as an A2D and I fought about this problem I am going to take a sense of the battery voltage and alter the PWM so you do not notice a brigtness adjust when the battery starts to loose some voltage. If the battery goes to a voltage that is to low it stops the output totally. The idea is so that you do not see any diffrence depending on supply voltage.

The software has become really complicated and I need to simulate it all just the buck converter so I can see what is happening and get some parts in. I have a flowchart on paper but I will have to type eveything up and create a webpage about it as I think this is an intresting project.

I read that microchip were developing a prototype board for luxeons but have not see anything. I have a current limited bench power supply at home so I will order some luxeons from RS and play next week.

Cooling these suckers is going to be a problem and I think a peliter eliment might help here but using PWM I can make it more efficent. Gah my do my projects start simple end up a complicated mess of hardware and software.

Adam
Re: RGB LED Controller - Driving Luxeons
..., Sun Aug 06 2006, 03:58AM

Not to get too far off topic, but pielters and batteries are not a good combination... I would highly recommend that you just have a decent heat sink and fan, as what you loose in led efficiency will be greatly less than what a peltier would do for you IMHO

And to help point things backvat Adam, you need to account for the fact that eyes are very sensitive to differences in wavelengths. I don't have the chart handy, but you need like 3x as much red as 1.5x as much blue than you do green, something to take into consideration...
Re: RGB LED Controller - Driving Luxeons
Jrz126, Mon Aug 14 2006, 12:52PM

microchip has a few appnotes on this:
Link2
Link2

The source code is also available.
Re: RGB LED Controller - Driving Luxeons
Conundrum, Mon Aug 14 2006, 06:56PM

I was wondering about using the constant current feature on the MC34063 as a Luxeon controller- this might just work.

-A
Re: RGB LED Controller - Driving Luxeons
Steve Conner, Tue Aug 15 2006, 09:55AM

If I ever get round to making my bike headlight (maybe this winter....) I was planning to use a MC34063 like conundrum suggested. There's also the LTC3783 from Linear Technology, a switched mode LED driver chip that boasts "True colour PWM Dimming".

Someone at work spotted some $1 "rainbow LEDs" in an electronics catalogue that integrate three LED chips and a PWM colour changing circuit into a standard 5mm LED package. We bought a couple to brighten up the lab smile