Searching \ for '[PIC]: Info on PWM PSUs and PID with PICs?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=PID
Search entire site for: 'Info on PWM PSUs and PID with PICs?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Info on PWM PSUs and PID with PICs?'
2006\05\19@133654 by Philip Pemberton

face picon face
Hi,
 A few of you will probably remember my homebrew battery charger project.
I've now got enough spare time to make a serious attempt at implementing it.
Problem is, information on SMPSUs seems to be a bit thin on the ground, and
what little I can find is full of formulae and equations that make little or
no sense to me. Can anyone suggest a site that covers the basics of SMPSU
design? I seem to recall someone posting a link to something along these
lines, but I can't find the link in my "Interesting PICLIST postings" archive
:(

 I'm thinking of an inductor-based step-down, probably with PWM control
though I haven't made a firm decision yet. I've found a few Microchip
appnotes on PSM (aka PFM) control, but nothing on PWM. What would be really
useful is some info on the advantages/disadvanteges of PWM vs. PFM, and why I
might use one over the other.

 I'm also after some info on PID control (I was planning to use PID to keep
the output voltage/current stable) - the Wikipedia article was quite
informative, but tuning a PID loop seems to be something of a black art. Does
anyone here have any hints they can share?

 I'm probably going to use straight linear control along the lines of "Vout
just jumped up by 1% of full scale, so kick the duty cycle down by the same
amount" for the first-cut of the code, but I'd like to use PID later on (it's
reputed to be more stable than linear control).

 At this point, any info would be much appreciated.

Thanks.
--
Phil.                         | Kitsune: Acorn RiscPC SA202 64M+6G VF+UniPod
spam_OUTphilpemTakeThisOuTspamdsl.pipex.com         | Cheetah: Athlon64 3200+ A8VDeluxeV2 1G+180G
http://www.philpem.me.uk/     | Tiger: Toshiba SatPro4600 Celeron700 256M+40G

2006\05\19@165543 by olin piclist

face picon face
Philip Pemberton wrote:
> I was planning to use PID
> to keep the output voltage/current stable

I think that is way overkill and much more difficult than necessary.

> I'm probably going to use straight linear control along the lines
> of "Vout just jumped up by 1% of full scale, so kick the duty cycle
> down by the same amount"

This is still too complicated and may have stabilty problems.  What's wrong
with the simple "out is low so I'll to another pulse, then wait a little
while and check again"?


******************************************************************
Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
consultant in 2004 program year.  http://www.embedinc.com/products

2006\05\19@190100 by Xiaofan Chen

face picon face
On 5/20/06, Philip Pemberton <.....philpemKILLspamspam@spam@dsl.pipex.com> wrote:

>   I'm probably going to use straight linear control along the lines of "Vout
> just jumped up by 1% of full scale, so kick the duty cycle down by the same
> amount" for the first-cut of the code, but I'd like to use PID later on (it's
> reputed to be more stable than linear control).
>
>   At this point, any info would be much appreciated.
>

Microchip AN258 describes the PID control on the Vpp generation
of PICkit 1. It is the same for PICkit 2. Both firmware source and
host application source of PICkit 1 and PICkit 2 can be downloaded
from Microchip.

ww1.microchip.com/downloads/en/AppNotes/00258a.pdf
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1960

Regards,
Xiaofan

2006\05\20@070644 by Philip Pemberton

face picon face
In message <004c01c67b86$96f46130$0300a8c0@main>
         olin_piclistspamKILLspamembedinc.com (Olin Lathrop) wrote:

(PID control)
> I think that is way overkill and much more difficult than necessary.

I think you might well be right, Olin...

> > I'm probably going to use straight linear control along the lines
> > of "Vout just jumped up by 1% of full scale, so kick the duty cycle
> > down by the same amount"
>
> This is still too complicated and may have stabilty problems.  What's wrong
> with the simple "out is low so I'll to another pulse, then wait a little
> while and check again"?

Or the method Atmel used in the "AVR450" battery charger appnote:

while (not battery_charged) {
 read_voltage_and_current();
 
 if (Ibatt > Itarget) {
   PWM_Duty --;
 } else if (Ibatt < Itarget) {
   PWM_Duty ++;
 }
}

I'll have a play around with this today - just need to find a power
transistor and steal a Schottky diode from something...

Does the diode in a buck converter have to be a Schottky, or will (for
example) a 1N4001 be OK for testing? I did have about a dozen 1N5817s but
they seem to have disappeared...

In any case, I'm going to learn enough AVR assembler to figure out what the
AVR450 charger is getting up to, then I'm going to see about reimplementing
it on a PIC. Might try and get my "Nanoprobe" debug monitor working again,
too...

--
Phil.                         | Kitsune: Acorn RiscPC SA202 64M+6G VF+UniPod
.....philpemKILLspamspam.....dsl.pipex.com         | Cheetah: Athlon64 3200+ A8VDeluxeV2 1G+180G
http://www.philpem.me.uk/     | Tiger: Toshiba SatPro4600 Celeron700 256M+40G

2006\05\20@172201 by olin piclist

face picon face
Philip Pemberton wrote:
> Does the diode in a buck converter have to be a Schottky, or will (for
> example) a 1N4001 be OK for testing?

Only if you run in discontinuous mode.  The 1N4001 has a rather slow reverse
recovery time.


******************************************************************
Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
consultant in 2004 program year.  http://www.embedinc.com/products

2006\05\20@193841 by Philip Pemberton

face picon face
In message <008b01c67c53$681d0560$0201a8c0@dad>
         EraseMEolin_piclistspam_OUTspamTakeThisOuTembedinc.com (Olin Lathrop) wrote:

> Only if you run in discontinuous mode.  The 1N4001 has a rather slow reverse
> recovery time.

Guess I need to go looking for a faster diode then. AFAICT the problem is
most diode datasheets don't spec the Trr (reverse recovery time) and I can't
see any easy way to calculate it. Even OnSemi and Fairchild only seem to spec
Trr for ultrafast diodes. That and I don't really know what other specs
(besides forward/reverse voltage and current) I need to pay attention to...

At the moment, I'm looking at the 1N5817 series and the MBRD835L. I might
have a half-finished project or two kicking around with a thievable 5817 on
board, but I'd have to order the 835...

Specs are (at the moment):
 Vin: 12V
 Vout: 6V
 Topology: Buck (step-down)
 L: 47uH (actually measured at 43uH)
 F: 32kHz
 Filter cap: 47uF jellybean electrolytic (also tried a 1000uF low-ESR).
   
Even with a 4001 fitted, the SMPSU does seem to be handling itself quite
well. I can see the duty cycle varying as I change the load on the supply,
and it seems the PWM is turning off completely if the output voltage goes too
high. The pass transistor is running pretty cool as well - certainly beats a
7805. Transient response is pretty dire though. I'm surprised it handled
no-load without overshooting (too) badly though. There's still some nasty
overshoot on powerup, but I suspect that's mostly to do with running it with
an unloaded output.

I guess the next test is to get it to do basic current regulation, then try
and charge a nicad...

Thanks.
--
Phil.                         | Kitsune: Acorn RiscPC SA202 64M+6G VF+UniPod
philpemspamspam_OUTdsl.pipex.com         | Cheetah: Athlon64 3200+ A8VDeluxeV2 1G+180G
http://www.philpem.me.uk/     | Tiger: Toshiba SatPro4600 Celeron700 256M+40G

2006\05\21@081105 by olin piclist

face picon face
Philip Pemberton wrote:
> Specs are (at the moment):
>   Vin: 12V
>   Vout: 6V

So why the objection to a Schottky diode?  This sounds like an ideal
application for Schottky.  At these voltages the lower diode drop will make
a noticeable difference in efficiency.  Most of your power loss is probably
in the diode.

>   Topology: Buck (step-down)
>   L: 47uH (actually measured at 43uH)
>   F: 32kHz
>   Filter cap: 47uF jellybean electrolytic (also tried a 1000uF
>     low-ESR).

This cap is probably way inadequate.  Often the limiting factor is not the
bulk capacitance or ESR, but the maximum rippple current the cap can handle.

> Transient response is pretty
> dire though.

As expected if you are still sticking to your PID or linear control scheme.


******************************************************************
Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
consultant in 2004 program year.  http://www.embedinc.com/products

2006\05\21@102718 by Dave Lag

picon face
Olin Lathrop wrote:

>>Transient response is pretty
>>dire though.
>
>
> As expected if you are still sticking to your PID or linear control scheme.

Are you saying PID can never work or you just can't tune it to do this well?

On a more general note:
I have found the Fairchild Power seminar to be the most useful vendor
training I have ever attended.
(the current outline seems to be about the same)

Dave

2006\05\21@104030 by Xiaofan Chen

face picon face
On 5/21/06, Dave Lag <@spam@davescomputerKILLspamspamrogers.com> wrote:
> Olin Lathrop wrote:
>
> >>Transient response is pretty dire though.

The transient response will be affected by the power stage as
well as the control loop. For example, bigger L will tend to
slow down the transient response.

> > As expected if you are still sticking to your PID or linear control scheme.
>
> Are you saying PID can never work or you just can't tune it to do this well?

PID is the most widely used control method for DC/DC converters.
They can certainly be tuned well.

> On a more general note:
> I have found the Fairchild Power seminar to be the most useful vendor
> training I have ever attended.
> (the current outline seems to be about the same)

I remember Techonline has archived of some Fairchild Power Seminars.
The Unitrode (now TI) application notes are also not bad.

Regards,
Xiaofan

2006\05\21@162121 by Jan-Erik Soderholm

face picon face
Philip Pemberton wrote :

> In message <008b01c67c53$681d0560$0201a8c0@dad>
>           KILLspamolin_piclistKILLspamspamembedinc.com (Olin Lathrop) wrote:
>
> > The 1N4001 has a rather slow reverse recovery time.
>
> Guess I need to go looking for a faster diode then.
> AFAICT the problem is most diode datasheets don't spec
> the Trr (reverse recovery time)...

Since "slow" diods are mainly ment for rectifying 50/60 Hz,
it's somply not an interesting parameter.

Fast "Switching diods" more or less always have Trr specified.

> Even OnSemi and Fairchild only seem to spec
> Trr for ultrafast diodes.

And that's what you need anyway, isn't it ?

OTOH, I saw that your design was running at only 32 Khz,
which isn't *that* fast for a switcher...

I have a number of diffrent schottky switching diods
ment for switching PSUs, if your interested. From 8 A
up tp 127 A. TO220 (the 127A is in TO247, I think...).

I can send you a couple of 100V/8A schottkys if I get your
address...

Regards,
Jan-Erik.



2006\05\21@165559 by Philip Pemberton

face picon face
In message <2947491.1148242878283.JavaMail.tomcat@pne-ps4-sn1>
         Jan-Erik Soderholm <RemoveMEjan-erik.soderholmTakeThisOuTspamtelia.com> wrote:

> Since "slow" diods are mainly ment for rectifying 50/60 Hz,
> it's somply not an interesting parameter.
>
> Fast "Switching diods" more or less always have Trr specified.

The 1N5817 datasheet doesn't spec it. Vishay categorise it under "Schottky
diodes, <10ns switching" but don't say how much "<10ns" is :)

> And that's what you need anyway, isn't it ?
>
> OTOH, I saw that your design was running at only 32 Khz,
> which isn't *that* fast for a switcher...

I'm thinking of upping that to 100 or 200kHz, but that's going to involve me
finding a 20MHz osc for the PIC. I'm also planning to replace the homebrew
inductor with a proper factory-made thing at some point (maybe when I get
some Schottky diodes).

> I have a number of diffrent schottky switching diods
> ment for switching PSUs, if your interested. From 8 A
> up tp 127 A. TO220 (the 127A is in TO247, I think...).
>
> I can send you a couple of 100V/8A schottkys if I get your
> address...

See message sent offlist.

Thanks.
--
Phil.                         | Kitsune: Acorn RiscPC SA202 64M+6G VF+UniPod
spamBeGonephilpemspamBeGonespamdsl.pipex.com         | Cheetah: Athlon64 3200+ A8VDeluxeV2 1G+180G
http://www.philpem.me.uk/     | Tiger: Toshiba SatPro4600 Celeron700 256M+40G

2006\05\21@171305 by Jan-Erik Soderholm

face picon face
I forgot...

I have some schottkys up on eBay currently. See :

http://search.ebay.
com/_W0QQfsooZ1QQfsopZ1QQsassZstQ2daQ2ddQ2d03QQsbrsrtZl

Regards,
Jan-Erik.



2006\05\22@042650 by Alan B. Pearce

face picon face
>So why the objection to a Schottky diode?  This sounds
>like an ideal application for Schottky.

I don't think he objects to using one, just he hasn't got one handy, and it
is the weekend.

The other possibility would be to use a synchronous diode in the form of
another FET, which shouldn't be too hard to organise when using a 10F as the
drive source.

2006\05\22@090410 by olin piclist

face picon face
Dave Lag wrote:
> Are you saying PID can never work or you just can't tune it to do this
> well?

PID can be useful for many control problems, and power supply regulation can
be thought of as a control problem.  However, switching power supply
regulation also has other attributes such that often a simple pulse on
demand system produces good results.  Transient response is very good with
this scheme since it doesn't have to "ramp up".  It is not predictive, so a
clever and well tuned algorithm could theoretically do better in some cases.
In other words, pulse on demand doesn't include the logic "if the voltage is
already near the threshold and heading down, do a pulse a little sooner so
the bottom of the dip doesn't get so low".

The flip side is that prediction is by definition an assumption, and
assumptions can be incorrect.  If something stops drawing current suddenly,
then the predictive scheme could cause higher overshoot than a dumb pulse on
demand system.

Overall, due to the highly unpredictable and high frequency nature of load
current draw, and dumb but reliable system is often a better choice for
switching power supply control.  You make sure that the worst case
excursions above and below the set point as acceptable, and work with that.


******************************************************************
Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
consultant in 2004 program year.  http://www.embedinc.com/products

More... (looser matching)
- Last day of these posts
- In 2006 , 2007 only
- Today
- New search...