Searching \ for '[EE]: Fun with PIC-based SMPSU design (was [PIC]:' 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/devices.htm?key=pic
Search entire site for: 'Fun with PIC-based SMPSU design (was [PIC]:'.

Exact match. Not showing close matches.
PICList Thread
'[EE]: Fun with PIC-based SMPSU design (was [PIC]: '
2006\06\10@035829 by Philip Pemberton

face picon face
David VanHorn wrote:
> Also when the proc is in reset, or being programmed!

Yes indeedy... (see below)

>>   4) Cheap breadboards are very good at developing loose connections.
> Definitely. I'd proto the power part on some PCB material, and fly-wire it.

Well, now I know it basically works, I'm going to do that anyway. I bought
enough parts to make five chargers - the idea was that I'd have enough for a
couple of prototypes, then some spare parts in case of the eventual failure of
some components.

> PSM?  As in pulse skipping?

Yep. As detailed in Microchip appnote AN216.

> Beware of the bifurcation.

The what?

> And I need to try and figure out what part of the SMPS driver is eating
>> nearly
>> 200mA, even when the PWM output is off (=0V)...
>
> Hmm.. That's not right.

It seems it's because the base pulldown resistors in the FET driver were wired
to Vcc instead of Gnd (another stupid mistake). Grounding them seems to have
killed that bug - seems the PSU was showing a 200mA drain because the gate
driver BJTs were both turning on at the same time during reset...

Now I just need to find a way to smooth out the current sense signal a bit.
It's spiking when the FET turns on, and dropping rapidly when the
aforementioned FET turns off... Grr...

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

2006\06\10@103732 by kravnus wolf

picon face
Phil,

  What kind of battery are you intending to charge?

John

--- Philip Pemberton <.....philpemKILLspamspam@spam@dsl.pipex.com> wrote:

{Quote hidden}

> --

2006\06\10@111906 by Philip Pemberton

face picon face
kravnus wolf wrote:
>    What kind of battery are you intending to charge?

NiMH. I want something I can configure to charge my Kodak 1600mAh NiMHs
(rebadged Sanyo 1600s) and my Energizer 2500s. Not at the same time, obviously :)

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

2006\06\10@183140 by David VanHorn

picon face
> .
>
> > Beware of the bifurcation.
>
> The what?


http://www.smpstech.com/chaos000.htm


PSM isn't a bad way to go for battery charging, even down at 60 Hz.  They
don't really care much.

2006\06\10@190845 by Philip Pemberton

face picon face
In message <EraseME25b178740606101531h2d51be1bp5dcde4ef7dad3ad5spam_OUTspamTakeThisOuTmail.gmail.com>>          "David VanHorn" <dvanhornspamspam_OUTmicrobrix.com> wrote:

> http://www.smpstech.com/chaos000.htm

Very interesting. Thanks for that.

> PSM isn't a bad way to go for battery charging, even down at 60 Hz.  They
> don't really care much.

The problem I'm having at the moment is that the current regulation is poor
at best. I'm picking up ripple and spikes on the current sense line that
are very persistent - I stuck a lowpass filter on it (a 100nF over the opamp
feedback resistor, then a 1uF), and there was no detectable effect. That
wouldn't be a problem if the PIC was reading an average voltage, but it
samples the instantaneous voltage in the middle of a 5uS (or so) window.

That's fair enough, but if the ADC samples on a peak then the current output
plummets. If it samples on a valley, it rockets up to nearly 2A. I could
tweak the LPF, but if I make it respond too slowly then it buggers up the
transient response.

What I'm getting *now* is a situation where the ADC's internal R/C clock
generator slips a bit and the ADC ends up sampling on a valley. The PIC kicks
the current up and >boom<. It doesn't even realise the average current is
a few amps - it still thinks it's locked at 500mA. Then the RC drifts again
and the PIC settles back down to about 400mA... :-/

Eventually I want to make this thing do "burp" (reflex) mode charging. That's
going to be great fun with an SMPSU - by the time it ramps up, the charge
pulse will be over. At the moment I'm sticking to constant-current though
(it's easier to get that working for testing, then add reflex mode later).

In any case it's midnight now and I'm off to bed... All this SMPSU design,
tweaking and black magic is making my head hurt...

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

2006\06\10@194731 by David VanHorn

picon face
>
> The problem I'm having at the moment is that the current regulation is
> poor
> at best. I'm picking up ripple and spikes on the current sense line that
> are very persistent - I stuck a lowpass filter on it (a 100nF over the
> opamp
> feedback resistor, then a 1uF), and there was no detectable effect. That
> wouldn't be a problem if the PIC was reading an average voltage, but it
> samples the instantaneous voltage in the middle of a 5uS (or so) window.


VBG.. Been there, done that..
In the AVR, I was able to sync my current sample to the PWM output, and by
trimming nops, put the ADC sample point in a "quiet" zone.

What I'm getting *now* is a situation where the ADC's internal R/C clock
> generator slips a bit and the ADC ends up sampling on a valley. The PIC
> kicks
> the current up and >boom<. It doesn't even realise the average current is
> a few amps - it still thinks it's locked at 500mA. Then the RC drifts
> again
> and the PIC settles back down to about 400mA... :-/



How often do you sample for regulation? I used a 10mS interval.



Eventually I want to make this thing do "burp" (reflex) mode charging.
> That's
> going to be great fun with an SMPSU - by the time it ramps up, the charge
> pulse will be over. At the moment I'm sticking to constant-current though
> (it's easier to get that working for testing, then add reflex mode later).


That adds some complexity, but not too bad.
Before stopping the current, save your PWM value.
Then halt, and at the end of the halt, make the measurements.
Then reload the PWM value you had from before, and start regulating again.

2006\06\10@200859 by Philip Pemberton

face picon face
In message <KILLspam25b178740606101647x330beabasb40d57c250e88e54KILLspamspammail.gmail.com>>          "David VanHorn" <RemoveMEdvanhornTakeThisOuTspammicrobrix.com> wrote:

> VBG.. Been there, done that..
> In the AVR, I was able to sync my current sample to the PWM output, and by
> trimming nops, put the ADC sample point in a "quiet" zone.

That's my plan too, but I don't like wasting cycles in ISRs :)

> How often do you sample for regulation? I used a 10mS interval.

10uS. Once every PWM cycle. PWM rate is 100kHz.
I think that might be "just a bit" too fast though. ISTR the AVR450 charger
updates at 1kHz or so (but that brings us back to the point of "AVR450 is a
monstrosity created by someone who probably didn't know what they were
doing").

I'm using 100kHz PWM to keep the inductor size down.

> That adds some complexity, but not too bad.
> Before stopping the current, save your PWM value.
> Then halt, and at the end of the halt, make the measurements.
> Then reload the PWM value you had from before, and start regulating again.

In my case, all I'd have to do is:

STOP_PWM:
 CLRF  CCPR1L      ; turn pwm off
 MOVLW 0x<blah>    ;
 ANDWF CCP1CON     ;
 BCF   INTCON,PEIE ; pwm update ISR off
 RETURN
 
and:

START_PWM:
 MOVF  PWMVAL, W   ; get last pwm value
 UPDATE_PWM        ; turn the pwm back on
 BSF   INTCON,PEIE ; pwm update ISR on
 RETURN
 
That's pseudo-asm but you get the idea. UPDATE_PWM is a macro that puts the
two LSbits of PWMVAL in the CCP1CON register (IIRC), then puts the upper six
bits into CCPR1L. With that, I get almost 8-bit PWM resolution.

--
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\06\10@203255 by Xiaofan Chen

face picon face
On 6/11/06, David VanHorn <TakeThisOuTdvanhornEraseMEspamspam_OUTmicrobrix.com> wrote:
> > .
> > > Beware of the bifurcation.
> http://www.smpstech.com/chaos000.htm
>

I have read that book and I have seen this when doing simulation
of the V-square control method (from On-Semi). Still the book is
in general more theoretical than practical and thus only for the
interests of some control guys.

Regards,
Xiaofan

2006\06\11@104226 by olin piclist

face picon face
Philip Pemberton wrote:
> I could tweak the LPF, but if I make it respond too slowly then
> it buggers up the transient response.

And you need fast transient response because ... ?

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

2006\06\11@105655 by olin piclist

face picon face
Philip Pemberton wrote:
>> VBG.. Been there, done that..
>> In the AVR, I was able to sync my current sample to the PWM output,
>> and by trimming nops, put the ADC sample point in a "quiet" zone.
>
> That's my plan too, but I don't like wasting cycles in ISRs :)

There should be no need to trim with NOPs.  Why can't the A/D be triggered
from the same timer that controls the PWM, or at least a timer synchronized
to the PWM or start of pulse?

And do you really need to measure the current at all?  You've basically got
a buck converter if I understand this right.  By measuring the input voltage
and output voltage, you can compute the necessary pulse length to produce
the desired average output current.  I've used this technique, and Dave
Tweed and I have a patent pending on its application to various aspects of
power factor corrected power supplies.  Your battery charger would likely
not be infringing ;-)


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

2006\06\11@120825 by Martin K

flavicon
face
App #?
--
MK

Olin Lathrop wrote:

{Quote hidden}

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