Author Topic: MCU based constant current LED boost converter  (Read 8417 times)

0 Members and 1 Guest are viewing this topic.

Offline void_errorTopic starter

  • Frequent Contributor
  • **
  • Posts: 673
  • Country: ro
  • I can transistor...
MCU based constant current LED boost converter
« on: November 20, 2014, 10:06:58 am »
I recently bought one of these (because it was cheap - about $16) and I intend to turn it into a workbench lamp with adjustable brightness.



The first idea I had was to use a cheap 8-pin PIC like the 12F1571 which has hardware PWM and an ADC/comparator and two buttons to increase/decrease brightness.

It currently runs on a 230V input with its own converter and I measured about 31V across the LED. The goal here is to make it as simple and flexible as possible without using specialized LED driver chips. Input voltage will be 12V which implies a boost topology with an N-channel MOSFET probably driven directly by the MCU, an inductor, a diode and a filter cap, with a current sense resistor from negative LED pin to ground. A 78L05 will provide the MCU supply voltage.

More ideas are welcome.

Trust me, I'm NOT an engineer.
 

Offline HackedFridgeMagnet

  • Super Contributor
  • ***
  • Posts: 2028
  • Country: au
Re: MCU based constant current LED boost converter
« Reply #1 on: November 20, 2014, 10:42:15 am »
you probably want a FET gate driver or something that can deliver more drive current like a push pull bjt output. slup169.pdf by Laszlo Baloghis worth a read.
I did a buck converter with an ATTiny 461 that gave 3 channels. Using a micro based feedback loop you have to slow down the rate of change (plant).
But if you slow it down enough it is stable and the user wont have any problems.

I would check the data sheet of the LED you are using rather than just measure the current and voltage.
 

Offline void_errorTopic starter

  • Frequent Contributor
  • **
  • Posts: 673
  • Country: ro
  • I can transistor...
Re: MCU based constant current LED boost converter
« Reply #2 on: November 20, 2014, 12:37:43 pm »
you probably want a FET gate driver or something that can deliver more drive current like a push pull bjt output.
Was thinking of that in case MOSFET turn-on / turn-off times are too long. Push-pull BJT with base speed-up caps works well at 5V.

I would check the data sheet of the LED you are using rather than just measure the current and voltage.
Unfortunately it's impossible to get the datasheet, no code or anything on the LED, it's probably one of those 10W LEDs you find on Banggood, with 9 LEDs in series. I guess I'm going to have to rely on measurements, as well as hooking up a scope to see the ripple of the integrated driver (which is sealed btw).

It says 10W 1/2 input power on the back of the case which means there's no more than 9W reaching the LED. I'm not planning to run the LED at more than 8W anyway, it's too damn bright... actually... I might stick a magnifying glass underneath it and go frying ants, too bad it's almost winter and ants are not that common.

For about 9W output power to the LED there's going to be roughly 1A drawn from a 12V supply. If the MCU-based version fails to work I'll just use a TL494 or MC34063 with the LED current set by the 5-bit DAC in the MCU.
Trust me, I'm NOT an engineer.
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: MCU based constant current LED boost converter
« Reply #3 on: November 20, 2014, 01:14:34 pm »
Just go and buy a $3 boost converter on ebay.  My whole camp runs on those powering residential lighting products.   If you don't run them at maximum there is no need to do current sensing.  If you run them at maximum the LED is just going to die from heat.  I wouldn't operate one of those (and I have a number of them) at more than 5W.
 

Offline void_errorTopic starter

  • Frequent Contributor
  • **
  • Posts: 673
  • Country: ro
  • I can transistor...
Re: MCU based constant current LED boost converter
« Reply #4 on: November 20, 2014, 01:53:46 pm »
Just go and buy a $3 boost converter on ebay.
And wait 6 weeks for it to arrive? No thanks. Plus, what do I learn if I just buy one and where's the fun in building a custom one?

In the meanwhile, after a fairly short battle with the glue holding the LED driver I've managed to get some info from the label: it's a 250mA +/-5% 18-33V constant current source, with 30-31V across the LED which means less that 8W. Unfortunately the whole thing seems to be epoxy sealed so I won't be able to get inside it.
Trust me, I'm NOT an engineer.
 

Offline ManCave

  • Regular Contributor
  • *
  • Posts: 90
Re: MCU based constant current LED boost converter
« Reply #5 on: November 20, 2014, 02:08:12 pm »
Why use micro when you can just use a PWM control chip which is made for purpose and costs about $0.5 like TL494 or SG3524?
 

Offline void_errorTopic starter

  • Frequent Contributor
  • **
  • Posts: 673
  • Country: ro
  • I can transistor...
Re: MCU based constant current LED boost converter
« Reply #6 on: November 20, 2014, 02:22:55 pm »
Why use micro when you can just use a PWM control chip which is made for purpose and costs about $0.5 like TL494 or SG3524?
Learning while building something useful? I've fiddled a lot with TL494s before and still have some lying around, but it's not really a challenge as I already have a spreadsheet which I made a while back to calculate all the values for a boost converter and I won't learn anything new, that's why I want to use a micro.
Trust me, I'm NOT an engineer.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: MCU based constant current LED boost converter
« Reply #7 on: November 20, 2014, 03:01:27 pm »
It can be done but I am not sure why you need a mcu there.

The simplest would be to put the whole circle + led inside of a bridge rectifier - they you can use DC controls on an AC circuit.
================================
https://dannyelectronics.wordpress.com/
 

Offline void_errorTopic starter

  • Frequent Contributor
  • **
  • Posts: 673
  • Country: ro
  • I can transistor...
Re: MCU based constant current LED boost converter
« Reply #8 on: November 20, 2014, 06:27:12 pm »
Better idea: TL494 boost converter + 40193 + R-2R DAC. No software, dirt cheap, two buttons for brightness control, can have a preset startup brightness. 16 brightness levels are enough.
Trust me, I'm NOT an engineer.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: MCU based constant current LED boost converter
« Reply #9 on: November 20, 2014, 06:38:53 pm »
Think 555.
================================
https://dannyelectronics.wordpress.com/
 

Offline ManCave

  • Regular Contributor
  • *
  • Posts: 90
Re: MCU based constant current LED boost converter
« Reply #10 on: November 21, 2014, 12:40:03 pm »
Why use micro when you can just use a PWM control chip which is made for purpose and costs about $0.5 like TL494 or SG3524?
Learning while building something useful? I've fiddled a lot with TL494s before and still have some lying around, but it's not really a challenge as I already have a spreadsheet which I made a while back to calculate all the values for a boost converter and I won't learn anything new, that's why I want to use a micro.

Makes sense now ;)
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: MCU based constant current LED boost converter
« Reply #11 on: November 21, 2014, 02:05:46 pm »
All you need to have is a reference against which you can compare the current through the led: if the current through the led is too high (vs. the reference), turn off the switch; Otherwise the switch is on.

================================
https://dannyelectronics.wordpress.com/
 

Offline void_errorTopic starter

  • Frequent Contributor
  • **
  • Posts: 673
  • Country: ro
  • I can transistor...
Re: MCU based constant current LED boost converter
« Reply #12 on: November 21, 2014, 02:34:53 pm »
if the current through the led is too high (vs. the reference), turn off the switch; Otherwise the switch is on.
I suppose you mean if the current is too high decrease the PWM duty cycle, otherwise increase it. I'd have to sync the interrupts to the PWM timer then so I don't change the duty cycle a million times a second (when PWM frequency is set in the 50-200kHz range) which would result in a huge mess and some weird stuff.

Anyway, this doesn't have to be extremely accurate, +/-10% is acceptable.
Trust me, I'm NOT an engineer.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: MCU based constant current LED boost converter
« Reply #13 on: November 21, 2014, 03:51:13 pm »
I was thinking more about a self-oscillating power comparator, than a mcu.

If you were to do it with an mcu, you could implement it via comparators built into most mcus.

If you were to do it with adc + pwm generators, I would have a free-running adc adjusting pwm cycles.

The issue with that set-up is

1) latency: turning off the switch on or off a little bit too late could have yielded too high of a current through the load;
2) stability / range of viable loads: if you are simply designing for one load, not a big problem. But getting a mix-signal loop to stable for a wide range of loads isn't for the faint of heart.

As such, if you look at the typical mcus designed for power supplies, you will notice that they tend to be in the very high-end of mcus - 32-bit chips, fast adc + pwm generators, etc. Check out Freescale's offerings if you are interested.
================================
https://dannyelectronics.wordpress.com/
 

Offline void_errorTopic starter

  • Frequent Contributor
  • **
  • Posts: 673
  • Country: ro
  • I can transistor...
Re: MCU based constant current LED boost converter
« Reply #14 on: November 21, 2014, 04:17:15 pm »
I figured it could be done with a cheap 8-bit MCU since the only variations in power are due to the LED voltage drop changing with temperature, but that's happens way too slow for the MCU to not manage to compensate. In other words, the load will draw an almost constant power, only changing slightly with temperature.

In other words, there's only one known load - the LED, not even a challenge for the cheapest MCU. I'll probably test it this weekend with a 16F628A I have lying around, the 16F690 being a bit of a pain in the arse as far as hardware PWM configuration is concerned.
Trust me, I'm NOT an engineer.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: MCU based constant current LED boost converter
« Reply #15 on: November 21, 2014, 05:38:42 pm »
I am sure it can be done with a mcu (adc + pwm). I was just pointing out that it can be done more efficient with comparators (+switches), built-in or otherwise.
================================
https://dannyelectronics.wordpress.com/
 

Offline senso

  • Frequent Contributor
  • **
  • Posts: 951
  • Country: pt
    • My AVR tutorials
Re: MCU based constant current LED boost converter
« Reply #16 on: November 21, 2014, 05:49:41 pm »
There are a couple app-notes using either PIC or AVR's for a buck/boost led driver using the built in comparator of the micros and then a PWM "dac" to set the set-point/close the feedback loop.
 

Offline void_errorTopic starter

  • Frequent Contributor
  • **
  • Posts: 673
  • Country: ro
  • I can transistor...
Re: MCU based constant current LED boost converter
« Reply #17 on: November 21, 2014, 05:53:34 pm »
The idea with the TL494 & 40192/40193 I had is quite practical and easy to implement as I already have the parts but it occupies more space than an 8-pin MCU (PWM + integrated comparator, just change reference to change current which can all be done in software) and I don't really learn anything new which is exactly what the plan is. It also has to fit in a small enclosure and the PCB has to be as simple as possible.

There are a couple app-notes using either PIC or AVR's for a buck/boost led driver using the built in comparator of the micros and then a PWM "dac" to set the set-point/close the feedback loop.
Read a few, that's why I'm attempting this with a micro rather than the analog way.
Trust me, I'm NOT an engineer.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: MCU based constant current LED boost converter
« Reply #18 on: November 21, 2014, 09:34:50 pm »
Roman Black (one heck of a hardware / software guy) did experiment with a pic-control'd smps. Check out his website. I think he did it via a power comparator but turning it over to adc + pwm isn't that big of a deal.

When I get sometime, I will actually try that myself.
================================
https://dannyelectronics.wordpress.com/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf