linear1 forums
[part of the linear1 network]
+ [linear1 case mods]
+ [LED Center]
+ [privacy policy]
Welcome, Guest. Please login or register.
March 20, 2010, 06:35:42 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Login Register

linear1 forums  |  LED discussion  |  Microcontroller madness  |  Topic: PIC based buck regulator with 3 (or 5) external components « previous next »
Pages: [1] Print
Author Topic: PIC based buck regulator with 3 (or 5) external components  (Read 4770 times)
SurJector
Smart like tractor
***
Offline Offline

Posts: 107


« on: December 14, 2005, 01:42:43 PM »

That's a project for justDIY. I don't have any PIC available so that I can't test !

The principle is easy: a capacitor is used to take the mean value of an oscillating output, regulated by an A/D port.

When I write transitor, I think MOSFET, but since I'm not sure how to handle them, I speak about transistors. If you do it with a real transistor, you should put some resistor between PIC and base.

Connect the base of a PNP transistor to pin0 of the pic, the emitter to +, the collector to two parallel strings. In the first a very big fat capacitor. In the second the load and a resistor R. The resistor and the capacitor are connected to ground. The common point of the load and the resistor to pin1 of the PIC.

Operations in the PIC:
1) Set pin0 to output and drive it updown.
2) When pin1 exceeds R.Imax, drive pin0 downup.
3) Either after a fixed delay or after pin1 goes below R.Imax.(1-10%) goto 1)

Problems:
- I don't know what the A/D module can measure. I've not managed to understand it from Microchip datasheets. As far as I understand, if you want a precise measure you need an external reference. For instance: 1 diode + 1 resistor. What do you measure with respect to that diffeerence: a fraction, a multiple, a fixed point floating number ?
- I don't know how fast/slow the process can be. You probably do not want to go below 30kHz (as Rob suggested: you could hear it), but you do not want to go too high either (well, that should not be a problem !) because the capacitor starts to be very resistive.
- For truck applications: the PIC must handle 15V I don't see how you can use a regulator to handle the problem (the transistor needs to access the full 14V if you want to use all the available energy, and I don't see how you can command it and measure current, unless you use an NPN with high breakage tension between emitter and base). or you can use a linear regulator (just for the PIC). You then get a precise reference for voltage, but there is a little problem for the base of the transistor; I think it should work if you pull it up with a resistor and tristate pin0 instead of driving it up in step 2).

If your current is small enough, you can remove the transistor. In that case, you'd want to tristate pin0 instead of bringing it downup in step 2).

Additional note: you probably want to put a low ESR capacitor (or several) in parallel with your whole circuit (for truck applications you can put it behind the reflector, event though it's probably a little far).
« Last Edit: December 14, 2005, 02:33:18 PM by SurJector » Logged
Rob
LED guy
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1970


The constant-current gardener


WWW
« Reply #1 on: December 14, 2005, 02:20:49 PM »

This is also interesting to me because I was just now reading the Energy Star requirements for power supplies.

It seems to me that where this (expensive, comparatively) approach would shine is in a device that has active and standby states. The PIC could optimize the efficiency for the operating range, based on monitoring the load current.

Just for fun here's the Energy Star docs I was reading:
http://www.energystar.gov/ia/partners/prod_development/downloads/power_supplies/powersupplyreport.pdf
http://www.energystar.gov/ia/partners/prod_development/downloads/power_supplies/Final_EPS_Specs_Notes.pdf

The motivation for the thing:
Quote
In total, more than 6% of national electricity consumption passes through power supplies – some
217 billion kwh of electricity per year worth about $17 billion.
To estimate the national potential for energy savings from more efficient power supplies, we can
consider three simultaneous goals:
• Replace all linear power supplies currently in use (average efficiency of about 40 to 50%)
with advanced switching designs (average efficiency of about 80 to 90%)
• Replace all 70% efficient switching power supplies with advanced switching units with
an efficiency of 80% or more
• Reduce standby power consumption of most power supplies to 1 watt or less.
By our estimates,18 the annual energy savings from the first two measures alone would be more
than 1% of total U.S. electricity use: about 32 billion kwh and reductions in national energy bills
of at least $2.5 billion per year. The majority of these savings would come from targeting the
least efficient models (see Appendix B). The environmental dimensions of these savings are also
enormous – about 24 million tons of carbon dioxide emissions per year, with proportionate
reductions in the emissions of other key pollutants including NOx, SO2, particulates and mercury.
This represents about 0.4% of all U.S. carbon dioxide emissions, or about 6% of the reductions the U.S. would need to achieve to comply with the Kyoto Protocol. Indeed, this amount of
energy savings is equivalent to the annual output of about seven large nuclear or coal-fired power
plants, or the annual electricity use of more than 3.5 million homes.
Logged

justDIY
Microcontroller Madman
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1652


UFOric


WWW
« Reply #2 on: December 14, 2005, 02:54:21 PM »

sounds fun - and well over my head!

how can you do any bucking or boosting, without an inductor?

i mean, a transistor and capacitor are 2 pieces of the 3 piece puzzle i've been reading so much about lately.

oh, one more thing to add, in response to Rob's post

some of the regulators / controllers I was reading about from TI contained sensors to monitor the power demands of the load, and used alternate methods to provide things like a very low standby current, some were using simple linear regulators to provide 100mA of standby current while the main switch-mode supply was shutdown... I wonder if this is what the current ATX power supplies are using?
Logged

Want to contact me directly? gmail gordonthree
My Project Blog - http://projects.dimension-x.net

Favorite numbers:
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
SurJector
Smart like tractor
***
Offline Offline

Posts: 107


« Reply #3 on: December 14, 2005, 03:25:35 PM »

In the HV9910 setup for buck (not buck-boost) there is no capacitor, just inductor (and diode to source current from 0V). In my setup you charge the energy in the capacitor when the transistor is conducting and discharge it when the transistor is blocked. I think this is not "over your head".
Logged
justDIY
Microcontroller Madman
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1652


UFOric


WWW
« Reply #4 on: December 14, 2005, 06:39:50 PM »

ok - I got it while I was driving home ... very interesting indeed!

as a buck solution:

the pic's a2d reads the voltage on the capacitor, switching the transistor on as needed to 'refill' the capacitor - maintaining the 'target' voltage +/- a hystersis level... a resistor limits the charging rate of the capacitor, so it doesn't fill the instant the transistor goes conducting... the size of the capacitor would determine the maximum current the converter could supply?

I believe the pic's internal A2D is limited to +/- Vdd which is max of 6 volts - so the buck converter should handle anything that needs 5v or less?

I think I understand the frequency now ... too low a freq and your regulation becomes difficult because the pulse times are too 'big' ... too high a freq and you loose efficency by heating the capacitor (and inductor).   In this regard, I wonder about the PICs abilities ... the PWM generator is 10 bit, so you have 1024 'steps' between off and on.... that is up to 39kHz ... beyond 39kHz and the resolution sharply drops.  8 bits at 156khz (256 steps) , 7 bits at 312 khz (128 steps)
Logged

Want to contact me directly? gmail gordonthree
My Project Blog - http://projects.dimension-x.net

Favorite numbers:
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
justDIY
Microcontroller Madman
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1652


UFOric


WWW
« Reply #5 on: December 14, 2005, 09:23:31 PM »

EDN has some interesting stuff on the topic - including examples using PIC microcontrollers

http://www.edn.com/article/CA633463.html

http://www.edn.com/article/CA624951?ref=nbcs

http://www.edn.com/article/CA601847?ref=nbcs
Logged

Want to contact me directly? gmail gordonthree
My Project Blog - http://projects.dimension-x.net

Favorite numbers:
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
Rob
LED guy
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1970


The constant-current gardener


WWW
« Reply #6 on: December 14, 2005, 10:19:22 PM »

That first one is a good read.
Logged

SurJector
Smart like tractor
***
Offline Offline

Posts: 107


« Reply #7 on: December 15, 2005, 03:53:02 AM »

ok - I got it while I was driving home ... very interesting indeed!
I'm happy you did.
the pic's a2d reads the voltage on the capacitor
Depends on your objective: if you want to make a tension or current source. In my case I wanted to make a current source, so that I measure the current through the load, using a (small as possible) resistor in series with the load.
switching the transistor on as needed to 'refill' the capacitor - maintaining the 'target' voltage +/- a hystersis level...
a resistor limits the charging rate of the capacitor, so it doesn't fill the instant the transistor goes conducting...
Really I was hoping that the rest of the circuit would provide a sufficient resistance and/or inductance to limit the current for me ! If need be (i.e. if the capacitor charges too fast and the PIC is too slow, you can add a resistor somewhere in series with the capacitor, but that would waste energy).
the size of the capacitor would determine the maximum current the converter could supply?
Yes, the capacitor and the switching frequency.
I believe the pic's internal A2D is limited to +/- Vdd which is max of 6 volts - so the buck converter should handle anything that needs 5v or less?
No, you can always use a dividing network (ladder ?) to have your voltage stepped down. The problems are: how precise is the A/D ? Can you have an absolute voltage, or is it relative to Vdd ? How small can the measured voltage be (the voltage is measured in series with the load in "current" mode) ?
I think I understand the frequency now ... too low a freq and your regulation becomes difficult because the pulse times are too 'big' ... too high a freq and you loose efficency by heating the capacitor (and inductor).   In this regard, I wonder about the PICs abilities ... the PWM generator is 10 bit, so you have 1024 'steps' between off and on.... that is up to 39kHz ... beyond 39kHz and the resolution sharply drops.  8 bits at 156khz (256 steps) , 7 bits at 312 khz (128 steps)
I don't use the PWM, it could be another solution indeed. The frequency of the switching is fixed by the speed of the PIC.
Logged
Rob
LED guy
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1970


The constant-current gardener


WWW
« Reply #8 on: December 15, 2005, 10:22:37 AM »

The frequency of the switching is fixed by the speed of the PIC.

Is that strictly true? It seems to me one of the strengths of this approach is that since the switching is software driven, you can employ frequency modulation to your advantage also.
Logged

justDIY
Microcontroller Madman
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1652


UFOric


WWW
« Reply #9 on: December 15, 2005, 02:19:45 PM »

i think he means the maximum switching freq is fixed ... the pic can only toggle a port on and off so fast.

I had thought the design would want to use the internal pulse generator hardware (pwm) opposed to doing the switching in software.  the pulse generator has no overhead, it is completely independent of the central processor - whereas doing the switching with software bogs down the cpu and requires very careful programming to make sure not to 'overload' the cpu which would throw your timing off, or miss a pulse.

software switching could be faster, since the cpu runs at upwards of 48mHz on the new pics, but is that high of a frequency really required?

i thought I understood yesterday, but I didnt, it was just sleep depravation.
Logged

Want to contact me directly? gmail gordonthree
My Project Blog - http://projects.dimension-x.net

Favorite numbers:
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
SurJector
Smart like tractor
***
Offline Offline

Posts: 107


« Reply #10 on: December 15, 2005, 04:00:18 PM »

I'm not confident enough to let the PWM handle the switching. That'd be better in terms of resources obviously. One could test every hundredth of second wether the current is in the desired range.

I've fired xfig and done two diagrams, the first (with the capacitor) is the one I intended. The second (with the inductance and the Schottky diode) is more conventional. As I understand from the HV9910 datasheet, the second one is instable if you need to divide the voltage by less than 2. It is probably more stable if you insert a capacitor in parallel with Load+R.


* PIC-cond.jpg (6.47 KB, 137x208 - viewed 432 times.)

* PIC-self.jpg (8.03 KB, 149x248 - viewed 425 times.)
Logged
SurJector
Smart like tractor
***
Offline Offline

Posts: 107


« Reply #11 on: December 19, 2005, 05:03:37 PM »

Here is the NE555 version. As said before the NE555 is particularly hungry. It works though. I've tried with Vcc=8.2V (roughly, a not very young 9V battery), and the NE555 consumes 14mA when I ask for 1.5mA of current ! The capacitor is really small (~120nF), so the frequency is really high (I can't measure it though).


* ne-buck.jpg (7.6 KB, 163x190 - viewed 418 times.)
« Last Edit: December 19, 2005, 06:13:45 PM by SurJector » Logged
justDIY
Microcontroller Madman
Administrator
Smart like tractor
*****
Offline Offline

Posts: 1652


UFOric


WWW
« Reply #12 on: December 19, 2005, 05:48:31 PM »

i think your attachment failed?
Logged

Want to contact me directly? gmail gordonthree
My Project Blog - http://projects.dimension-x.net

Favorite numbers:
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
SurJector
Smart like tractor
***
Offline Offline

Posts: 107


« Reply #13 on: December 19, 2005, 06:14:24 PM »

Huhum. Preview, preview, preview
Logged
Pages: [1] Print 
linear1 forums  |  LED discussion  |  Microcontroller madness  |  Topic: PIC based buck regulator with 3 (or 5) external components « previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.306 seconds with 22 queries.