MicroController control for switching regulator

Another possibility I thought of was to replace the pot in the adjustable regulator circuit with a digital pot.

Reply to
RogerN
Loading thread data ...

in

Its actually pretty simple with an ARM. Even at 300kHz you can measure the voltage across a MOSFET for cycle by cycle current limiting. Its one interrupt running the PWM controller. Updating displays etc is done in the main loop. You'll actually have 2 processes with different priorities running in parallel.

--
Failure does not prove something is impossible, failure simply 
indicates you are not using the right tools... 
nico@nctdevpuntnl (punt=.) 
--------------------------------------------------------------
Reply to
Nico Coesel

hing

used in

t of

t and

I did it with a forward converter.

The loop was slowed down by adding more capacity to the output, loop regula tion was done by TL431 and opto to the primary side (error signal). The Err or signal was sampled in a 10kHz interrupt, converter to duty cycle. I only had 4 bits of different duty cycles (16), but the loop the automatically d ithers around the FB voltage.

I even tried for fun to go down to 4 different duty cycles, and due to the capacitance on the output it was still stable with a lot of dithering

Converter switching of 200kHz and 4MHz ARM clock. (only loading the process or about 15%)

Regards

Klaus

Reply to
Klaus Kragelund

in

Thanks for the input. You're using a faster machine. My PIC takes over 19 microseconds per A/D acquisition under optimal conditions...according to the datasheet.

Reply to
mike

And what do you do with those readings ?

How much time does it take to do one calculation in a PID loop ?

How much time to it take to decide to change the PWM ?

How fast does it take to update the charge on a capacitor ?

And about 20 other parameters need to be looked at.

hamilton

Reply to
hamilton

in

and

Yup. The NXP ARMs are ferocious. We geared the CPU clock rate down to

50 MHz in the case I mentioned, so we computed for about 7 usec worst-case, with an ADC interrupt every 10. It's this one:

formatting link

There are 13 ARM processors on this board. 12 of them are galvanically isolated, one per 4-20 mA channel.

If you have to trigger the ADC and wait for data, rearrange the loop to do the math while it's digitizing the next sample. Don't waste time waiting for the ADC.

Reply to
John Larkin

you don't need to update the displays at 20Khz

2Hz would be plenty for update 40hz would be a sufficient refresh rate if you need to do that.

no, everything gets tidy when it's interrupt driven, the critical code is no longer at the mercy of the main loop, you can use float arithmetic and printf, and other slow code in the main loop without breaking anything.

OTOH propeller chips wulti-core and thus ideal for people who don't like interrupts,

yeah, that's the easy way.

--
?? 100% natural 

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
Reply to
Jasen Betts

On a sunny day (Tue, 25 Dec 2012 17:22:47 -0600) it happened "RogerN" wrote in :

I have been using the LM317 as switcher, pretty much does what you mentioned:

formatting link
The on/off current in the now oscillating LM317 switches a power transistor. It is still regulating ...

Reply to
Jan Panteltje

I'm not saying that it can't be done. I'm saying that my PIC with 200ns instruction cycle and one level of interrupt and inaccessible stack and 20us A/D conversion time, might have some trouble shifting serial data out to a display while managing keyboard debounce, measuring two voltages, implementing a software filter or two and deciding whether the output got shorted and what to do about it all within 50 us. Overlapped functions work until you need overlapped interrupts and don't have 'em. So what if you miss a cycle...no big deal...except that your inductor has to handle more current without saturating and your transistors may have to be bigger and...and...and If you're testing how creative you can be at using the wrong tool for the job, this is as good as any.

Throwing a multi-core processor at a general purpose adjustable power supply regulator may not be the optimum solution. Fixed voltage multiple supplies with simple short protection, maybe.

I was too lazy to decipher the code, but I did study the hardware for Jan's solution. I convinced myself that it could be made to degrade gracefully even if you overloaded the processor with other functions. I was gonna build one for fun until I realized that I have programmable power supplies in the attic that I don't need.

Reply to
mike

On a sunny day (Wed, 26 Dec 2012 04:38:03 -0800) it happened mike wrote in :

LOL

formatting link

Mant PICs have hardware comparators that also control the PWM by hardware. Thats is what I use here, among other things such as interrupts. This code also has a real time clock, but I left it out in the LCD display for clarity, and space IIRC.

Reply to
Jan Panteltje

So if a PIC can't handle it the problem must be wrong? If you start asking these kind of questions it really is time to move away from PIC and switch to ARM. Otherwise you'll find yourself creating kludges.

--
Failure does not prove something is impossible, failure simply 
indicates you are not using the right tools... 
nico@nctdevpuntnl (punt=.) 
--------------------------------------------------------------
Reply to
Nico Coesel

I don't know that anyone actually answered the question that you asked. You got a lot of good responses -- personally, if I were doing this I'd see if the microprocessor had a suitable PWM output and think about using that.

But to answer your _actual question_, no you can't just hook the feedback pin to a DAC. It's a _feedback_ pin: it needs to be connected to the output in some way or another. The action of the chip is to hold the feedback pin to 1.23V (or whatever the reference voltage is); thus, your responsibility as a circuit designer is to wire up that feedback pin so that when the output voltage is at the desired value, the feedback pin is at 1.23 volts.

So you probably want a resistor (or lead-lag network) going from output to the feedback pin, and another resistor going to a DAC. As your DAC output voltage goes up, it'll contribute more to that 1.23V, meaning that the output of your regulator will go down. So, essentially you'll have built an inverting amplifier with a switching element to it.

When you're all done, if you just have a single resistor for feedback your circuit may not be stable -- hence, my suggestion to use a lead-lag network. If you do need to start messing with the lead-lag you'll have to do it b'guess and b'gosh, because National Semiconductor (at least the last time I looked) thinks you're a stupid git and doesn't share SPICE models of their switchers, which means you have to use their Web Bench design tool, which doesn't include fancy things like a DAC-pushed feedback pin.

Here's what I mean by a lead-lag network. R1 and R3 form the "main" resistive divider. If you leave out R2 or C1, that's that. If you put in real components for R2 and C1, then R1, R2 and C1 are a lead-lag network. If you do need to do something with those components, then you probably want to start out with a value of C1 such that C1 * R1 is about four to ten times longer than the period of the oscillation that you're trying to kill, and play with values of R2 that range from R2=R1 to R2=R1/10.

output o------------------------------. | ___ | .--------|___|---------o | R1 | | | | || ___ | o-----||-------|___|---' | || R2 feedback o-------o C1 | | | .-. | | | |R3 '-' | | | from DAC o-------' (created by AACircuit v1.28.6 beta 04/19/05

formatting link

--
Tim Wescott 
Control system and signal processing consulting 
www.wescottdesign.com
Reply to
Tim Wescott

However, the DAC can be in the feedback. A multiplying DAC is the most obvious solution but there are easier ways to do this. For crude control a few NPNs or NFETs (assuming a positive regulator) can be used to switch bottom resistors in the feedback divider. It's really a multiplying DAC, anyway.

That works but can be tricky. Gotta make sure you don't go beyond the range of the output to control the feedback point.

Gotta make sure it's stable in any case.

That's an "integrator" style of compensation. There are others. I'd use what the regulator's manufacturer suggests and just change the feedback - no injection from another source.

Reply to
krw

You're saying that I should drop everything, learn a new processor, buy the new tools instead of dropping in a 50-cent regulator chip so I don't create a kludge?

I don't think I said that the problem was wrong...or the solution was wrong, for that matter. I asked and I didn't learn any magic that would cause me to reconsider my position in my current situation.

I spent much of my career fixing stuff designed by engineers with tunnel vision. They keep adding horsepower instead of widening their search for options. Context is very important.

Reply to
mike

That may work, but if you need to do any loop compensation it'll be at least as complicated as the method that I suggested.

True. Everything has its drawbacks.

Well, yes, but National makes sure that you can't do that on paper or in simulation beforehand, by withholding so much information from you that you can only do it by letting yourself be hand-held by their in-house application, and that in-house application's assumptions.

So you're stuck with building a circuit and hoping that you've got the topology close enough that you can achieve stability just with component changes.

Have you tried to use National's WebBench to do any real design tasks?

--
My liberal friends think I'm a conservative kook. 
My conservative friends think I'm a liberal kook. 
Why am I not happy that they have found common ground? 

Tim Wescott, Communications, Control, Circuits & Software 
http://www.wescottdesign.com
Reply to
Tim Wescott

It really isn't. It's the preferred method, actually.

A multiplying DAC doesn't have that problem.

Why wouldn't you? I don't undestand your point, here.

No, I don't use it. I run the equations from the datasheets. I haven't had any real problems, well, for components that work. I have one that looks like it has a nasty phase reversal in the error amplifier that tends to cause smoking holes. This isn't the sort of thing that simulations will warn of, though.

Reply to
krw

display

Looks pretty good, but why do you reset all of the interrupt flags upon exit from the ISR? What if two interrupts occur only a few instruction cycles

apart?

Paul

Reply to
P E Schoen

I'm not really a switching regulator guy, but I bet that has a name and is one of the older techniques with some well known set of limitations.

Rick

Reply to
rickman

Wouldn't a PWM be rather slow to control the feedback to the switcher? A PWM takes time to settle to a new value if it has much resolution.

Rick

Reply to
rickman

Hmmm... I guess it would require another chip or two, but would a switched capacitor be a viable alternative to a bunch of resistors and transistors? I looked at these some ten or more years ago in filter circuits; the capacitor switched between the input and output shuttling current. The faster it was switched the more current it carried and so the lower resistance it appeared to be. This allowed analog filters to be continuously varied. In this case it could allow for *relatively* continuous adjustment of the feedback ratio by adjusting the switching frequency. This likely would be best done in an FPGA that can use a DCO to drive the switch rate. It has similar limitations to digital designs and so needs a switching rate far above the frequency of interest. I guess that would rule it out for this app since the feedback has to be adjusted fairly quickly.

Rick

Reply to
rickman

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.