Maker Pro
Maker Pro

Using a uC for DC-DC conversion?

J

Joerg

Jan 1, 1970
0
Hi All,

Micro controllers can be used to drive a switcher from their PWM output.
Most of us know how to do that. But my question: Is there some nifty
literature on the web or elsewhere about all the trade-offs this entails?

What I mean are trade-offs with respect to PWM granularity, for example.
Suppose the counter runs off 5MHz. In order to arrive at reasonable cost
for the magnetics the PWM output needs to be, say, 300KHz or higher.
That leaves only 4 bits of granularity. So it would idle like a Harley
with worn spark plugs, something that may be ok. Then there is the
feedback. Most uCs with an on-board ADC are out of price range so slope
may have to do. On top of that there may be a limit of one slope
conversion unless eternal muxing is done.

Current mode is another topic. Tough to do on a uC but then again if one
can measure both current and voltage the uC "knows" where about the PWM
should be. But it's all not very precise. Then there is the issue of
making the code that runs the PWM safe and fast enough. After all, one
minor hangup in this area could result in a plume of smoke. Next, there
is the trend to ever lower VCC levels which renders the task of turning
on a FET hard enough non-trivial.

Regards, Joerg
 
K

Ken Smith

Jan 1, 1970
0
Joerg said:
What I mean are trade-offs with respect to PWM granularity, for example.
Suppose the counter runs off 5MHz. In order to arrive at reasonable cost
for the magnetics the PWM output needs to be, say, 300KHz or higher.
That leaves only 4 bits of granularity. So it would idle like a Harley
with worn spark plugs, something that may be ok.

Some of Linear's chips use "burst mode". I've seen switchers that used
"hit and miss" regulation where the transistor either turned on for a
fixed time or didn't. This is basically a granularity of 1 bit.

In both cases, the output capacitor must be larger to reduce the ripple.

Then there is the
feedback. Most uCs with an on-board ADC are out of price range so slope
may have to do. On top of that there may be a limit of one slope
conversion unless eternal muxing is done.

Don't some low cost micros have comparitors? You don't really need
anything like a good adc. You only really care right near the regulation
point. Chances are a "too high" / "too low" signal would be enough to
make a regulator that worked.

[...]
making the code that runs the PWM safe and fast enough. After all, one
minor hangup in this area could result in a plume of smoke.

Design carefully. If you leave the ground pin of a switcher chip
disconnected you get the same result.
Next, there
is the trend to ever lower VCC levels which renders the task of turning
on a FET hard enough non-trivial.

Use a PIC they still run at 5V. If you have to make a level shifter, you
may as well use a switcher chip in place of it.
 
T

Terry Given

Jan 1, 1970
0
Joerg said:
Hi All,

Micro controllers can be used to drive a switcher from their PWM output.
Most of us know how to do that. But my question: Is there some nifty
literature on the web or elsewhere about all the trade-offs this entails?

What I mean are trade-offs with respect to PWM granularity, for example.
Suppose the counter runs off 5MHz. In order to arrive at reasonable cost
for the magnetics the PWM output needs to be, say, 300KHz or higher.
That leaves only 4 bits of granularity. So it would idle like a Harley
with worn spark plugs, something that may be ok. Then there is the
feedback. Most uCs with an on-board ADC are out of price range so slope
may have to do. On top of that there may be a limit of one slope
conversion unless eternal muxing is done.

Current mode is another topic. Tough to do on a uC but then again if one
can measure both current and voltage the uC "knows" where about the PWM
should be. But it's all not very precise. Then there is the issue of
making the code that runs the PWM safe and fast enough. After all, one
minor hangup in this area could result in a plume of smoke. Next, there
is the trend to ever lower VCC levels which renders the task of turning
on a FET hard enough non-trivial.

Regards, Joerg

Hi Joerg,

you can dither to increase the resolution, but it doesnt gain you much.
AFAIK the answer is more clock speed (there are cunning tricks to
increase resolution, but all require a DIY pwm generator and a faster
clock).

micro sample rate is usually the killer. I am designing a drive at the
moment using a TI dsp that clocks at 150MHz, has 16 1us ADCs etc. Full
digital control, BUT hardware peak current limit/trip, cross-conduction
control and DC bus voltage limiting. software never works properly, and
programmers do stuff like step-to-breakpoint which is a great way of
applying DC to a machine :)

think synchronous sampling for current measurement - if you use
symmetric PWM (triangle not sawtooth reference wave, ie count up then
count down) then you always know where the middle of the pulse is, and
here is a good place to sample current as it is furthest away from
switching edges. also serves to remove switching-frequency ripple from
current measurement.


I once had to use a nasty little atmel micro (no multiply instruction
?!) for a 400W smps - it was a customers design I had to make go. They
had a 3-phase smps (no particular reason, and not cost-effective) so 6x
output ripple ie can tolerate low output inductance. They switched
T0-220 IGBTs at about 2kHz, with a loop time of 100ms and a 10uH output
inductor; cpu crystal was 4MHz. Needless to say, first I had to up the
switching frequency. They refused to change micros, so I made a 3-phase
pwm generator (7-bit parallel duty cycle input) with a ROM and a pair of
counters (< $1), interlock included. Changed to FETs, upped Fswitch to
100kHz and increased xtal to 12MHz. I also used the current limit
circuitry inherent in the (IIRC) IR2110 gate driver IC, and measured the
DC bus voltage for feed-forward. Oh, there was no isolation either - the
output "0V" was -200V wrt protective earth. Probably not a good
marketing strategy as most customers will die the first time they touch
it.....

Static psu performance with the new hardware was very good. But they
still closed the digital loop at 100ms, so dynamic behaviour was
atrocious. Using the shitty micro I came up with a "novel" PI controller
with feed-forward that didnt use a multiply instruction (not easy!), and
with the control loop running at 5kHz the dynamic performance was OK.
The final design was about 2x larger and more expensive than a
conventional 400W smps, but they were happy and paid my bill (note: I
didnt make it any larger, my stuff fitted into the existing design).

Never again will I do such a silly thing. Using the shitty micro I mean,
not making a stupid design work. reminds me of another job, where the
first team used a $50 8051-derivative micro from Cygnal (68-pin,
lightspeed operation etc). We used a $4 8051 derivative, and did the
same job.

cheers
Terry
 
D

Dave VanHorn

Jan 1, 1970
0
Micro controllers can be used to drive a switcher from their PWM output.
Most of us know how to do that. But my question: Is there some nifty
literature on the web or elsewhere about all the trade-offs this entails?

Not that I've seen.
What I mean are trade-offs with respect to PWM granularity, for example.
Suppose the counter runs off 5MHz. In order to arrive at reasonable cost
for the magnetics the PWM output needs to be, say, 300KHz or higher. That
leaves only 4 bits of granularity. So it would idle like a Harley with
worn spark plugs, something that may be ok.

I used the Atmel Tiny-26 running on internal 8 MHz R/C osc, with internal
PLL giving me 64 MHz to the timer, which resulted in 500kHz and 7 bits
resolution, as the controller for a buck mode constant current source for a
NIMH charger. The T26 also managed all the charging with a fairly
complicated algorithm, and communicates to the host through a clocked serial
interface telling it what's going on with the battery.
Then there is the feedback. Most uCs with an on-board ADC are out of price
range so slope may have to do. On top of that there may be a limit of one
slope conversion unless eternal muxing is done.

The T26 has eight channels, 10 bit resolution.
I corrected the current every mS based on the ADC reading of a shunt
resistor.
The T26 also has a programmable gain amp for doing this.
One bad thing, it's internal "precision" 2.5V ref ends up at about 2.7V
I measured input voltage, battery voltage, battery current (high side)
battery temperature, and ambient temperature.
Current mode is another topic. Tough to do on a uC but then again if one
can measure both current and voltage the uC "knows" where about the PWM
should be. But it's all not very precise.

Yeah.. Well, it's not going to give you the tight control that you'll get
out of a dedicated switcher chip, but if you don't NEED that, then it's
fine.
Then there is the issue of making the code that runs the PWM safe and fast
enough. After all, one minor hangup in this area could result in a plume
of smoke.

That's where I've had the least problems. (none!) The batteries themselves
gave me the most grief. NEVER buy cheap Chinese NIMH cells! I spec'd Sanyo
or Panasonic, and that's what they ended up buying, but only after some
interesting developments.
Next, there is the trend to ever lower VCC levels which renders the task
of turning on a FET hard enough non-trivial.

There, I had to use a driver chip, the old NPN to ground with a pullup just
couldn't take the fast switching, but I needed to keep the L small, or I
would have gone to 100kHz and had more resolution, and probably not needed
the driver.
 
J

John Larkin

Jan 1, 1970
0
Hi All,

Micro controllers can be used to drive a switcher from their PWM output.
Most of us know how to do that. But my question: Is there some nifty
literature on the web or elsewhere about all the trade-offs this entails?

What I mean are trade-offs with respect to PWM granularity, for example.
Suppose the counter runs off 5MHz. In order to arrive at reasonable cost
for the magnetics the PWM output needs to be, say, 300KHz or higher.
That leaves only 4 bits of granularity. So it would idle like a Harley
with worn spark plugs, something that may be ok. Then there is the
feedback. Most uCs with an on-board ADC are out of price range so slope
may have to do. On top of that there may be a limit of one slope
conversion unless eternal muxing is done.

Current mode is another topic. Tough to do on a uC but then again if one
can measure both current and voltage the uC "knows" where about the PWM
should be. But it's all not very precise. Then there is the issue of
making the code that runs the PWM safe and fast enough. After all, one
minor hangup in this area could result in a plume of smoke. Next, there
is the trend to ever lower VCC levels which renders the task of turning
on a FET hard enough non-trivial.

Regards, Joerg


I did, possibly, the world's worst switcher a while back. It has a
3-phase, roughly 240 vdc rectified source driving a capacitor bank
through some opto-coupled power fets and a huge military-type
bolt-down 250 watt power resistor; we don't need no stinkin'
inductors! The uC (a 68332) digitizes the cap voltage about 1000 times
a second and turns the fets on or off to regulate the voltage. I do
this twice, for positive and negative cap banks. This actually boosts
the cap voltages higher than the main 100-amp rectifiers can supply,
so I can precharge and safety-check the system before I turn on the
main supply.

It regulates pretty well and it's very reliable!

John
 
J

Joerg

Jan 1, 1970
0
Hi John
Gasp!. What's this?, a programmed micro to drive a switcher?.
What's happened to that cost benefit guru. Maybe he's suffered a tad of
(temporary) NG induced mania :)
No, no, I didn't go crazy. At least not yet. I also didn't have any
beer, yet. The only reason to consider a micro is because there are some
apps where you need a micro anyways because of lots of user input,
sensing, signaling etc.

So, back to the cost benefit stuff, it would be nice to scrap whatever
extra parts aren't absolutely needed. If the uC can take on the added
task of DC-DC conversion this would shave off some pennies ;-)

Often you don't need to generate a super quiet voltage, it can meander
around a few percent, have a little sawtooth on it, no problem. However,
the whole scheme only works if there are absolutely no extra features
required on the part of the uC. No ADC, no extra RAM, no leather seats.
Otherwise, yes, it's back to the old scheme of logic and discretes.
Surely ... . Hysteretic, 1/2 '393 or 1/4 of 74HC132, one bit. 0.05 currency
units.
I usually go with the 40106 for a standalone solution. It doesn't really
want to do more than 200KHz but often that's just enough. This way I get
a six-pack for the money and it works without pre-regulation from 12V
and 9V batteries. Under 6V it becomes kind of sluggish, then it's off to
the HC series.

Regards, Joerg
 
D

Dave VanHorn

Jan 1, 1970
0
I once had to use a nasty little atmel micro (no multiply instruction ?!)
for a 400W smps - it was a customers design I had to make go.

Hmm.. Must have been one of the earlier chips.
As I said, the Tiny-26 can go 500kHz at 8 bit, just using the on-chip osc.
 
T

Terry Given

Jan 1, 1970
0
Dave said:
Hmm.. Must have been one of the earlier chips.
As I said, the Tiny-26 can go 500kHz at 8 bit, just using the on-chip osc.

I was brought in to "debug" their prototype, and had no say in micro
choice, topology etc. To make matters worse, they needed 3-phase
complementary interlocked pwm (ie 6 outputs) but phase-shifted rather
than duty cycle controlled - basically they had a nice 10kW "analogue"
smps built this way, and they tried to scale it down to 400W and control
it with a micro. They were adamant that it was a good idea (cf a
conventional smps), thereby forcing the wacko PWM requirement.
Simultaneously they refused to let me pick a different micro, even
though I showed them much better parts that were cheaper (although
interlocked 3-phase phase-shifted pwm isnt necessarily easy to achieve
even with dedicated motor control micros). it was an 8MHz 4433 - old,
slow and generally with few redeeming features - the lack of a multiply
instruction was an issue in a control loop.... its ADC sucked too.

500kHz 8-bit is great! I will check them out....

cheers
Terry
 
T

Terry Given

Jan 1, 1970
0
Ken said:
One bit would be enough if the output filter cap is large enough.

did I mention they had no output cap? the open-circuit voltage didnt
look so nice :)

Cheers
Terry
 
D

Dave VanHorn

Jan 1, 1970
0
One bit would be enough if the output filter cap is large enough.

In the end, it IS a one-bit output afterall, we're just talking about how
finely we can control the on and off times.
 
J

john jardine

Jan 1, 1970
0
Joerg said:
Hi All,

Micro controllers can be used to drive a switcher from their PWM output.
Most of us know how to do that. But my question: Is there some nifty
literature on the web or elsewhere about all the trade-offs this entails?

What I mean are trade-offs with respect to PWM granularity, for example.
Suppose the counter runs off 5MHz. In order to arrive at reasonable cost
for the magnetics the PWM output needs to be, say, 300KHz or higher.
That leaves only 4 bits of granularity. So it would idle like a Harley
with worn spark plugs, something that may be ok. Then there is the
feedback. Most uCs with an on-board ADC are out of price range so slope
may have to do. On top of that there may be a limit of one slope
conversion unless eternal muxing is done.

Current mode is another topic. Tough to do on a uC but then again if one
can measure both current and voltage the uC "knows" where about the PWM
should be. But it's all not very precise. Then there is the issue of
making the code that runs the PWM safe and fast enough. After all, one
minor hangup in this area could result in a plume of smoke. Next, there
is the trend to ever lower VCC levels which renders the task of turning
on a FET hard enough non-trivial.

Regards, Joerg

Gasp!. What's this?, a programmed micro to drive a switcher?.
What's happened to that cost benefit guru. Maybe he's suffered a tad of
(temporary) NG induced mania :)

Surely ... . Hysteretic, 1/2 '393 or 1/4 of 74HC132, one bit. 0.05 currency
units.
regards
john
 
C

ChrisGibboGibson

Jan 1, 1970
0
Joerg said:
Micro controllers can be used to drive a switcher from their PWM output.
Most of us know how to do that. But my question: Is there some nifty
literature on the web or elsewhere about all the trade-offs this entails?

What I mean are trade-offs with respect to PWM granularity, for example.
Suppose the counter runs off 5MHz. In order to arrive at reasonable cost
for the magnetics the PWM output needs to be, say, 300KHz or higher.
That leaves only 4 bits of granularity. So it would idle like a Harley
with worn spark plugs, something that may be ok. Then there is the
feedback. Most uCs with an on-board ADC are out of price range so slope
may have to do. On top of that there may be a limit of one slope
conversion unless eternal muxing is done.

Current mode is another topic. Tough to do on a uC but then again if one
can measure both current and voltage the uC "knows" where about the PWM
should be. But it's all not very precise. Then there is the issue of
making the code that runs the PWM safe and fast enough. After all, one
minor hangup in this area could result in a plume of smoke. Next, there
is the trend to ever lower VCC levels which renders the task of turning
on a FET hard enough non-trivial.

This may seem unrelated but it isn't. Several manufacturers have built pure
sinewave DC/AC inverters using *just* PICs, mosfet drivers, mosfets and
transformers. Nothing else. No PWM controllers. As these things have to
tolerate truck, boat and caravan owners connecting them to just about anything
possible the protection on these *has* to be good.

They have shown themselves to be *very* reliable.

So it clearly *is* feasable though I've never looked into it in any detail.

Gibbo
 
J

John Hudak

Jan 1, 1970
0
comments below..

Terry said:
Hi Joerg,

you can dither to increase the resolution, but it doesnt gain you much.
AFAIK the answer is more clock speed (there are cunning tricks to
increase resolution, but all require a DIY pwm generator and a faster
clock).

micro sample rate is usually the killer. I am designing a drive at the
moment using a TI dsp that clocks at 150MHz, has 16 1us ADCs etc. Full
digital control, BUT hardware peak current limit/trip, cross-conduction
control and DC bus voltage limiting. software never works properly, and
programmers do stuff like step-to-breakpoint which is a great way of
applying DC to a machine :)

think synchronous sampling for current measurement - if you use
symmetric PWM (triangle not sawtooth reference wave, ie count up then
count down) then you always know where the middle of the pulse is, and
here is a good place to sample current as it is furthest away from
switching edges. also serves to remove switching-frequency ripple from
current measurement.


I once had to use a nasty little atmel micro (no multiply instruction
?!) for a 400W smps - it was a customers design I had to make go. They
Really? from what I recall, they all did, cept the very early one(s)...
had a 3-phase smps (no particular reason, and not cost-effective) so 6x
output ripple ie can tolerate low output inductance. They switched
T0-220 IGBTs at about 2kHz, with a loop time of 100ms and a 10uH output
inductor; cpu crystal was 4MHz. Needless to say, first I had to up the
switching frequency. They refused to change micros, so I made a 3-phase
pwm generator (7-bit parallel duty cycle input) with a ROM and a pair of
counters (< $1), interlock included. Changed to FETs, upped Fswitch to cleaver, but 7 bits?
100kHz and increased xtal to 12MHz. I also used the current limit
circuitry inherent in the (IIRC) IR2110 gate driver IC, and measured the
DC bus voltage for feed-forward. Oh, there was no isolation either - the
output "0V" was -200V wrt protective earth. Probably not a good
marketing strategy as most customers will die the first time they touch
it.....
No, definitely not a good idea-who said marketing has the background to
make such a decision?, Forgive me but why would your engineering ethics
allow this to happen?
(Yes, I've refused to do designs where there is a risk of a health
hazard...I'd consider electrocution a health hazard)
 
J

John Larkin

Jan 1, 1970
0
Hi All,

Micro controllers can be used to drive a switcher from their PWM output.
Most of us know how to do that. But my question: Is there some nifty
literature on the web or elsewhere about all the trade-offs this entails?

What I mean are trade-offs with respect to PWM granularity, for example.
Suppose the counter runs off 5MHz. In order to arrive at reasonable cost
for the magnetics the PWM output needs to be, say, 300KHz or higher.
That leaves only 4 bits of granularity. So it would idle like a Harley
with worn spark plugs, something that may be ok. Then there is the
feedback. Most uCs with an on-board ADC are out of price range so slope
may have to do. On top of that there may be a limit of one slope
conversion unless eternal muxing is done.

Current mode is another topic. Tough to do on a uC but then again if one
can measure both current and voltage the uC "knows" where about the PWM
should be. But it's all not very precise. Then there is the issue of
making the code that runs the PWM safe and fast enough. After all, one
minor hangup in this area could result in a plume of smoke. Next, there
is the trend to ever lower VCC levels which renders the task of turning
on a FET hard enough non-trivial.

Regards, Joerg


I just received this month's Power Electronics Technology mag. There
are two switchers that have pic's in the loop, although both use
analog pwm generators. The one on page 28 describes "a 24-v to 5-v
dc-dc buck regulator" that is clearly a push-pull forward regulator,
and a bizarre mess at that.

John
 
K

Ken Smith

Jan 1, 1970
0
did I mention they had no output cap? the open-circuit voltage didnt
look so nice :)

I guess it depends on whether you like ratty looking waveforms. I think
some of them are kind of cute.

In theory, you can make a Cuk converter with no output cap and no ripple.
 
J

Joerg

Jan 1, 1970
0
Hi Ken,
Some of Linear's chips use "burst mode". I've seen switchers that used
"hit and miss" regulation where the transistor either turned on for a
fixed time or didn't. This is basically a granularity of 1 bit.

In both cases, the output capacitor must be larger to reduce the ripple.
Yes, that's what I meant with idling like a rough engine. In engines
they just use a larger flywheel which is their "capacitor". In race cars
they reduce that again which is why their engines quit if you don't play
with the accelerator all the time.

The best kind of "regulator" was the one on old European WW I planes:
The cylinders were rotating around a fixed shaft so the only way to
throttle power was to connect or disconnect ignition to some cylinders.
It was best not to land these in dry grass.
Don't some low cost micros have comparitors? You don't really need
anything like a good adc. You only really care right near the regulation
point. Chances are a "too high" / "too low" signal would be enough to
make a regulator that worked.
They often only have one comparator and not much in terms of a mux in
front. So if you need adjustable voltage and current you run into a
bind. Throw in a third parameter as is often the case in applications
with a micro and you are in a real pickle.
Design carefully. If you leave the ground pin of a switcher chip
disconnected you get the same result.
LOL! That is a good one.
Use a PIC they still run at 5V. If you have to make a level shifter, you
may as well use a switcher chip in place of it.
Most apps also require micro power, IOW next to nothing in current when
in standby. No power switch. Some of the 80C51 families can do that but
the MSP currently leads the pack here. They do make a few 5V versions
but these are not mainstream and there is always the worry about whether
a chip will be available for 10 years or more.

Regards, Joerg
 
J

Joerg

Jan 1, 1970
0
Hi Dave,
I used the Atmel Tiny-26 running on internal 8 MHz R/C osc, with internal
PLL giving me 64 MHz to the timer, which resulted in 500kHz and 7 bits
resolution, as the controller for a buck mode constant current source for a
NIMH charger. The T26 also managed all the charging with a fairly
complicated algorithm, and communicates to the host through a clocked serial
interface telling it what's going on with the battery.
That's the king size edition. I never had anything that could run above
12MHz. Everything else was out of the $$$ range.
The T26 has eight channels, 10 bit resolution.

I corrected the current every mS based on the ADC reading of a shunt
resistor.
This would be the leather seats that I usually can't use. Any uC with a
decent ADC on board I saw was over $2 in qties.
The T26 also has a programmable gain amp for doing this.
One bad thing, it's internal "precision" 2.5V ref ends up at about 2.7V
I measured input voltage, battery voltage, battery current (high side)
battery temperature, and ambient temperature.
Mostly I rely on the TLV431, LMV431 and the like for around 20 cents a pop.
That's where I've had the least problems. (none!) ...
Probably you were the HW designer and also did the firmware. Then it's
under your control. It can become challenging when you are asked to join
the uC party as an additional tenant.
... The batteries themselves gave me the most grief. NEVER buy cheap Chinese NIMH cells! I spec'd Sanyo
or Panasonic, and that's what they ended up buying, but only after some interesting developments.
It's not just batteries, electrolytic capacitors can also put on quite a
pyrotechnic show. Wonder where fireworks were invented ;-)
There, I had to use a driver chip, the old NPN to ground with a pullup just
couldn't take the fast switching, but I needed to keep the L small, or I
would have gone to 100kHz and had more resolution, and probably not needed
the driver.
You can prevent saturation on the ol' bipolar transistors with a
Schottky or other pulldown when the collector goes below base. But the
beta still puts a damper on things if you want to do the whole switching
with that one transistor.

Regards, Joerg
 
J

Joerg

Jan 1, 1970
0
Hi John,
I did, possibly, the world's worst switcher a while back. It has a
3-phase, roughly 240 vdc rectified source driving a capacitor bank
through some opto-coupled power fets and a huge military-type
bolt-down 250 watt power resistor; we don't need no stinkin'
inductors! ...
Ouch. That must have been before the oil price hit $50 a barrel :)

Regards, Joerg
 
Top