Pages: [1] 2   Go Down
Author Topic: Current sensing for buck boost converter  (Read 3047 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
oops
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys,

I'm actually working on a buck-boost led driver to power high brightness LED.
As theses LED must be driven by constant current I wish to monitor the current flowing through the LEDs, and limit it when it reach the operating current i wish for the LEDs

a) can someone comment my schematic, and point me out what's wrong ? I just have some basis in electronics so this schematics is not the best one

b) for the  current sensing application what kind of algorithm should I use to have the most stable current to the leds.
   ie :
  arduino sense voltage out the OpAmp
   while current > xAmp      // derived from OpAmp out
       lower dutyCycle of MOSFET
   end
   set dutyCycle to theoretical value

c) The frequency use for  driving the mofset is ~100khz which king of filter should I use on the OpAmp input ? A simple capacitor ?

Thanks for you time
BR

Note : Rsense =  0,02
          All OpAmp resistors do not have the good value so gain
         
         


* Sélection_001.jpeg (53.33 KB, 947x534 - viewed 121 times.)
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your design could not have worked.

The typical design is to put a serial resistor in with the leds. This resistor generates a voltage drop proportional to the current going through the leds. That signal is then compared with a preset threshold to determine if you shut down the switch or not.

This mode of regulation produces a (near) constant current that is irrelevant of the leds' forward voltage drop. And by changing the resistor, you can program the current going through the leds.

Your design does none of that.
Logged

Idaho, US
Offline Offline
God Member
*****
Karma: 19
Posts: 859
Special User
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't really have anything to add, except that I think a software-controlled boost-buck driver is a super-cool application for a microcontroller (no need for messing with PWM for dimming, simply vary the switch mode duty cycle, in software, to alter output current). So I'd love to see the final design!
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Not sure what exactly you are trying to build, and I am sure avrs are completely capable here. But Freescale completely dominates that market (mcu-controlled smps), probably for a good reason. If you are serious about this, you may check those guys out.
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 46
Posts: 2865
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What you have looks perfectly reasonable. the sensing is... ok but the LM358 isn't a rail to rail device so you loose some range... Possibly. I'd build the current sensor and model it carefully at the rated load and then some, I'd also try it with long wires too first with a dc supply for performance and sensitivity and then go to the switcher and see that it was as stable with the switcher in place.
the issue here is to get the current sensor working first and feeding the correct information back to the Proc.. so the proc can control it
I would also give some thought to the Hall effect current sensors made by Allegro (ACH712) as they will produce a voltage that can be above Vcc/2 or below it at up to 185mV/amp, are inexpensive and don't require a sense resistor. All in all they are at first glance an ideal solution and work off of 5 volts too.  I took the liberty of attaching a data sheet.

Bob

* ACS712-Datasheet.pdf (652.17 KB - downloaded 29 times.)
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The attached schematic shows a simpler way for you to monitor the current and smooth the reading. Choose the ratio R2/R1 to get the range you need, and the capacitor in parallel with R2 to get the smoothing time constant you want.

However, the average power supply current is not the same as the average LED current. Maybe you should be monitoring the peak current passed by the mosfet instead?


* Scan 104.JPG (66.18 KB, 1653x1165 - viewed 77 times.)
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 8
oops
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't really have anything to add, except that I think a software-controlled boost-buck driver is a super-cool application for a microcontroller (no need for messing with PWM for dimming, simply vary the switch mode duty cycle, in software, to alter output current). So I'd love to see the final design!
For information, the final design is to drive one or more High Brightness Led in the most efficient way to use it in caving lighting (helmet mount) or dive lighting.

[...] the LM358 isn't a rail to rail device so you loose some range...
I would also give some thought to the Hall effect current sensors made by Allegro (ACH712) as they will produce a voltage that can be above Vcc/2 or below it at up to 185mV/amp, are inexpensive and don't require a sense resistor.
Thanks for the advice about Hall sensor I check the datasheet and seems it can sense up to 5A in normal operating mode it feet perfectly the usage. I'll check later on that.

The attached schematic shows a simpler way for you to monitor the current and smooth the reading. Choose the ratio R2/R1 to get the range you need, and the capacitor in parallel with R2 to get the smoothing time constant you want.
However, the average power supply current is not the same as the average LED current. Maybe you should be monitoring the peak current passed by the mosfet instead?
Thank you for the schematic, I don't know why I do not use it before ! It's just a non-inverter smiley.
About the average LED current/ power supply current. I thought the power consume by the CPU and other components was negligible vs LED power (~0,7A to 3A).
For the capacitor value do you have any tips to size the capacitance ?

Thanks all for your help and time.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

About the average LED current/ power supply current. I thought the power consume by the CPU and other components was negligible vs LED power (~0,7A to 3A).

Even if you ignore the current taken by the mcu and other components, and you make the simplifying assumpton of 100% efficiency, the average battery current is not the same as the average LED current unless the LED voltage and battery voltage. More specifically:

Average_led_current * led_forward_voltage = battery_voltage * battery_current * efficiency

So if the battery voltage is double the LED forward voltage, then the average LED forward current is double the battery current in the ideal case of 100% efficiency.

If the inductance is large enough, then the current through it will be more or less constant, therefore under these conditions the current through the mosfet when it is turned on equals the current through the LED when the mosfet is off. That is why I think it would be better to monitor the peak current passed by the mosfet.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 8
oops
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi guys,
i resurect this old thread because i was not able to acheive my goal : sense current in a led thread.
Your advices where very usesfull but I still have some problems sensing the current on the mosfet leg. In fact I have unstable values return buy the arduino when i sense the voltage from the output of the OPA. After searching, i think this can be linked to the switching frequency. Is that right ?

If yes do I have to set a low-pass or high-pass filter between the OPA and rsense ?

I would also give some thought to the Hall effect current sensors made by Allegro (ACH712) as they will produce a voltage that can be above Vcc/2 or below it at up to 185mV/amp, are inexpensive and don't require a sense resistor. All in all they are at first glance an ideal solution and work off of 5 volts too.  I took the liberty of attaching a data sheet.
Bob
Did anyone know a Hall effect current sensor product (like the one Docedison told) but in DIP package ? I was unable to find this kind of device produced by those manufacturers: linear, allegro or maxim

Thanks  for your time !

BR


* Arduino01.png (9.74 KB, 700x365 - viewed 35 times.)
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I would use basically the original arrangement, but put the sense resistor in series with the mosfet source connection instead so that you measure the mosfet source current. Reduce the resolution of the ADC to 8 bits so that you can do faster conversions. Monitor the source current while the mosfet is turned on, then when it reaches the value you want, turn the mosfet off for a predetermined time, say 100us. The snag with this is that the switching frequency will be be the audible range.

Alternatively, use a diode and capacitor to turn your current sense op amp circuit into a peak or average current detector, then you can modify the PWM amount according to the current, and use a supersonic switching frequency.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 8
oops
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Alternatively, use a diode and capacitor to turn your current sense op amp circuit into a peak or average current detector, then you can modify the PWM amount according to the current, and use a supersonic switching frequency.
Hi dc42!
Thanks again for your reply.
I did not understand what do you mean by using a diode and a capacitor to switch on the op amp. Can your draw a quick scheme or just explain a little bit more ?

Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

See attached peak detector schematic. R1 is the current sense resistor. (R2 + R3)/R2 defines the op amp gain, and C1 * (R2 + R3) defines the time constant, which should be large compared to 1/f where f is the PWM frequency.


* Scan 132.JPG (54.82 KB, 1653x1165 - viewed 53 times.)
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 46
Posts: 2865
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is the Arduino the SMPS controller? if so you will have to measure the peak current when the switch is on and compensate for the inductor current by averaging several 'cycles' and controlling the pulse width from that feedback.
The alternative that I like better is to use a CC supply for each Led (they are available for less than $5.00 on Ebay) and monitor the current drawn by the CC supply for current and time used to make a 'gas gauge'.. instead. You could give your sketch the AH capacity of the battery used and when 40% is gone indicate that this is the 'half way' point so that either reserves can be added or turn around and go back.
While it is entirely possible to use the Arduino for both... it is of questionable utility as it has been pointed out that Freescale has been at this for some time.
Sometimes the Kiss method is best.

Bob
{Edit RKJ}
« Last Edit: January 17, 2013, 11:42:41 am by Docedison » Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Offline Offline
Newbie
*
Karma: 0
Posts: 8
oops
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

See attached peak detector schematic. R1 is the current sense resistor. (R2 + R3)/R2 defines the op amp gain, and C1 * (R2 + R3) defines the time constant, which should be large compared to 1/f where f is the PWM frequency.

Ok !
So if I want to get the voltage value of Rsense I have to integrate the diode drop voltage  ?

Basically :
Vc1 = Vr1 * gain - Vdrop
Otherwise my Ir1 evaluation will be lowered by a 0,7v factor !

Is that  right ?
Logged

Offline Offline
Edison Member
*
Karma: 32
Posts: 1382
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Of course, there are also current sensing MOSFETS:
http://www.nxp.com/documents/application_note/AN10322.pdf
Logged

Pages: [1] 2   Go Up
Jump to: