EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: amspire on March 20, 2012, 06:33:17 am

Title: General Purpose Power Supply Design
Post by: amspire on March 20, 2012, 06:33:17 am
This is a designed inspired by Dave's REV C PSU design, but it is opamp/transistor based rather then IC regulator based.

I did the design really as an exercise to see what could be done with some brilliant idea that Dave has used in his RevC power supply design. There are both benefits and negatives in using a LT3080 based supply, so this is just a different approach. I am pretty happy with the results.

First, just to put the design into context. I have designed a number of opamp-based supplies before, and usually you decide on the input voltages, the output voltage range, currents, etc and you then design a supply to suit those specs.

You then have to spend a lot of effort into stabilizing the control circuit - that is the hardest part of the design. Using the LT3080 bypasses any stability issues, but if you do an opamp designed, you are guaranteed to need compensation to get it unconditionally stable with all loads.

Now typically this design will only suit the set of specs the supply is designed for, and the moment you change the voltage ranges or input voltage, you have to change the values of components and then start from scratch with the stability compenstaion.

The ideas from Dave's supply that change all this are:

1. a low dropout design
2. single input supply
3. supply works to full specs with a wide range of input voltages
4. the regulation of the supply sets the output voltage to be the same as the opamp sense input (ie no voltage divider or voltage references involved in the supply regulation).

The result of #3 and #4 is the result is super flexible as you can feed the supply with whatever source supply voltage you like, and it will output whatever voltage you give it on the voltage control input. So a fully stabilized supply can be designed, and you can then make it output any voltages you like between about 0 and 30V without any change to the supply design at all. I do not have to redesign the control loop just because the voltage divider ratio has been changed.

I have never seen anyone produce a generic power supply board, so I decided to give it a try. I am hoping that it may be useful alternative to the many bad LM317 based supply design attempts.

The idea that really got me interested though was Dave's  Rev C addition of a pre-regulator so that the linear regulator never had to dissipate much heat. This is only possible if the supply can work fully with a very wide range if input source voltages and if it has a low dropout. Heatsinks and buckets of wasted energy have always gone hand in hand with linear supplies. Dave has done away with that.

I think people may not get how brilliant and revolutionary Dave's concept is. We are totally used to hand held meters, but we are still stuck to the idea that a power supply has to be anchored to a wall socket on the bench, and the idea that you do development on the bench, rather then the place the design is actually going to be used - whether that is on the roof, half way down a canyon, in the car, on a boat or wherever.

If a supply efficiently uses the energy in a lithium battery, the supply can easily last for days powering a typical modern low power circuit. Given that, why would you want a power cord at all? So a huge congratulations to Dave.

So on to my design.  Here were my design specs:

3V to 30V input source voltage range
1.5V dropout voltage
True regulation down to zero volts
1A output current with 0 to 1A current limit
High level of protection from loads.
Transient performance similar to the LT3080
No-load to full load output voltage regulation  better then 0.001% (Wiring and track resistance is the biggest problem)
Loads like a battery can be connected to the supply while the supply is off without causing any problems to the supply or the battery.
Design based on "garden' components - potential to make it very cheap.
Possibility of a wide range 1A supply using only board mounted devices and no heatsink

I will get onto the design in the next post. This design exercise is not to make something similar to Dave's supply. I have left out any attempt at this stage in a uCurrent type device, and I am only looking a very low cost high performance regulator that could be controlled by just plain potentiometers.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 20, 2012, 06:34:18 am
Here is my initial design. If anyone is interested in using it, please feel free. I designed the compensation to be stable under all loads including huge pure capacitive loads, and I hope I got the numbers right. 

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=22397)

I have breadboarded it and it does work. The only change I had to to was to add capacitor C3 - without it, Q3 and Q1 had managed to form a very nice 108MHz sinewave oscillator - I was actually quite impressed by that. That actual power transistor I used was a MJE3055 - the TO220 version of the rather sluggish 2N3055 and I didn't think it was even possible to get it to generate a 108MHz sinewave.

The supply as drawn is for an output voltage range of 0 to 22volts with a 0 to 2.2 volts input. The current control regulates to 0 to 1A with a 0 to 1V input. The supply source should be at least 1.6 volts above the output voltage and 2.1 volts would give a small margin. My breadboard version actually regulated down to a 1V dropout voltage, but this is exceed the specs promised by the LM324.

MOSFET M1 on the output acts as a overvoltage clamp that will start to turn on between 25V and 30V, and it is also the reverse voltage clamp diode. Diode D10 prevents the regulator input pin of the LM324 going to -0.6 volts which is about the point you can get the IC to latch up. I didn't bother protecting the inputs of U3 from negative voltages. Tests seemed to indicate that with the 100K series resistance, you couldn't casue latch-up at -12V. and M1 will keep the negative voltages to -1 volts or less.

D5 stops a voltage on the output from damaging the regulator transistor. The last part of the protection is the LM324 itself - its inputs can be safely taken up to 32 Volts, and the MOSFET circuit will see that the inputs never get to 32 volts.

This supply does not need a bypass diode back to the input supply, so you could safely turn the supply off with a 12 or 24 volt battery on the supply output terminals.

I can talk more about component choices later, but as I said before, I see this as a design exercise, and there are things I would like to add. In particular, I would like to get rid of the 1K discharge resistor and replace it with an active circuit instead. Still thinking about the best way to implement that. Some kind of load discharge is needed, otherwise the regulator just cannot even regulate properly.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: alm on March 20, 2012, 06:57:00 am
Cool project! I think using a more complex circuit (both in design and in components) with cheaper and more readily available components might be the right one for a design people all over the world might build, as opposed to a kit.

Any idea how well it will reject the (relatively) high frequency switching noise from the pre-regulator? Would you expect similar performance to the traditional lab supplies with huge heatsinks or do you trade off noise for efficiency? Most three terminal regulators have a fairly limited ripple rejection once the frequency gets much higher than 120 Hz.

I'm aware of one well-designed universal variable power supply, a design by German electronics maganize ELV (http://www.elv.de/output/controller.aspx?cid=74&detail=10&detail2=1931&flv=&bereich=&marke=). There's a link to a PDF of the article on the product page, unfortunately the text is in German. This design is quite flexible in input voltage and current range, and I haven't heard any complaints about stability. It is a more traditional design intended to use with transformers, however.

I would welcome a well documented design of a power supply to be available in English, most that I've found suck in some way (eg. the poorly implemented LM317 designs that you mention).

I might make the over voltage protection adjustable, so you can set it to 6V if that's the absolute max for your components, but I realize that this may be outside the scope, and that feature creep may screw up the intended purpose (simple, cheap).

Interesting that you were able to get the MJE3055 to oscillate at 108 MHz, just make C3 switchable and you have a portable power supply and radio transmitter in one ;).

Intuitively I would be worried about the effect of D5 on the stability at low currents, since you're introducing a component with a dynamic resistance inside the feedback loop, but I don't have time to go over the circuit in detail, and I trust you've done your homework correctly.

I agree about replacing R3 with an active down programming circuit. How about driving M1 in linear mode, to represent a moderate resistance to keep dissipation in check, if D5 is not forward-biased?
Title: Re: General Purpose Power Supply Design
Post by: IanB on March 20, 2012, 07:16:24 am
That circuit goes way over my head, but it sure looks pretty  :)

On the pre-regulator aspect, what are the possibilities of making a switching pre-regulator that works at a low frequency like 100 Hz to avoid switching noise getting into the output? I'm thinking along the lines of a big filter cap as found in a normal linear supply, but switching current into it to top it up to just the right voltage. What size inductor in the switching circuit would adequately handle the low frequency, high current pulses?

I have seen an example in some application notes where an active SCR switching rectifier/pre-regulator was used, but I couldn't clearly follow how the circuit worked. It seemed to switch just enough of each AC half cycle to top up the reservoir capacitor to the desired voltage. What puzzled me is that this is clearly a very non-linear system and I was interested in how it was made to work in a stable and effective manner.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 20, 2012, 07:43:21 am
Any idea how well it will reject the (relatively) high frequency switching noise from the pre-regulator? Would you expect similar performance to the traditional lab supplies with huge heatsinks or do you trade off noise for efficiency? Most three terminal regulators have a fairly limited ripple rejection once the frequency gets much higher than 120 Hz.
I will see if I can test that with my breadboard. Setting up a power MOSFET as a source follower and feeding a signal generator in the gate should be able to modulate the supply input. I will let you know how it goes. Trouble is there are a number of issues with the breadboard version - I really need a PCB version to see accurately how it behaves dynamically.

It is an issue with the LT3080. It has 50dB rejection at 100KHz but it falls off like a stone after that. Most of the modern switching regulators work at 200KHz or higher. The one Dave used in has recent LTSpice simulation of a tracking regulator runs at over 1MHz.
Quote
I'm aware of one well-designed universal variable power supply, a design by German electronics maganize ELV (http://www.elv.de/output/controller.aspx?cid=74&detail=10&detail2=1931&flv=&bereich=&marke=). There's a link to a PDF of the article on the product page, unfortunately the text is in German. This design is quite flexible in input voltage and current range, and I haven't heard any complaints about stability. It is a more traditional design intended to use with transformers, however.
A different approach totally, but it is interesting to see what they have done. They have followed the standard HP method of the floating +/- supply for the opamps with the zero volts connected to the supply positive output. That is the way to get the best performance, but it needs a mains transformer, and it is really hard to find a suitable multi-winding transformer these days.
[quote

I might make the over voltage protection adjustable, so you can set it to 6V if that's the absolute max for your components, but I realize that this may be outside the scope, and that feature creep may screw up the intended purpose (simple, cheap).
[/quote] It certainly could be done, but the protection I implemented was for the power supply protection. For circuit protection, it is probably hard to beat an adjustable crowbar protection using a nice big indestructible SCR.
Quote

Interesting that you were able to get the MJE3055 to oscillate at 108 MHz, just make C3 switchable and you have a portable power supply and radio transmitter in one ;).
I could add one of those voice simulation chips and I could transmit the supply status to any FM radio in the neighborhood.
Quote
Intuitively I would be worried about the effect of D5 on the stability at low currents, since you're introducing a component with a dynamic resistance inside the feedback loop, but I don't have time to go over the circuit in detail, and I trust you've done your homework correctly.
I believe it is OK, but I will admit I left it off the breadboard version.  I can dig up a suitable diode and test it.
Quote
I agree about replacing R3 with an active down programming circuit. How about driving M1 in linear mode, to represent a moderate resistance to keep dissipation in check, if D5 is not forward-biased?
Not a bad idea. I will think on it.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: alm on March 20, 2012, 08:04:58 am
It is an issue with the LT3080. It has 50dB rejection at 100KHz but it falls off like a stone after that. Most of the modern switching regulators work at 200KHz or higher. The one Dave used in has recent LTSpice simulation of a tracking regulator runs at over 1MHz.
There are some three-terminal regulators specifically designed to be used with a switching pre-regulator, but this is an issue with the switcher + linear combination in general. Those 200 kHz/1 MHz frequencies are just the fundamentals, the edges produce much faster transients, since the MOSFET gates are usually driven quite hard to improve efficiency. It may be acceptable to aim for a higher noise level than the traditional linear supplies (eg. Agilent E36xx) if the advantages are efficiency, no heatsink and battery-powered operation. Many circuits don't need the <= 1 mV level of noise.
Title: Re: General Purpose Power Supply Design
Post by: markus_b on March 20, 2012, 08:39:49 am
1. a low dropout design
2. single input supply
3. supply works to full specs with a wide range of input voltages
4. the regulation of the supply sets the output voltage to be the same as the opamp sense input (ie no voltage divider or voltage references involved in the supply regulation).

The result of #3 and #4 is the result is super flexible as you can feed the supply with whatever source supply voltage you like, and it will output whatever voltage you give it on the voltage control input. So a fully stabilized supply can be designed, and you can then make it output any voltages you like between about 0 and 30V without any change to the supply design at all. I do not have to redesign the control loop just because the voltage divider ratio has been changed.
I very much like those aspects of Daves design. It is really very simple and can be used with a potentiometer, PWM or DAC as control input. Brilliant !

So on to my design.  Here were my design specs:

3V to 30V input source voltage range
1.5V dropout voltage
True regulation down to zero volts
1A output current with 0 to 1A current limit
High level of protection from loads.
Transient performance similar to the LT3080
No-load to full load output voltage regulation  better then 0.001% (Wiring and track resistance is the biggest problem)
Loads like a battery can be connected to the supply while the supply is off without causing any problems to the supply or the battery.
Design based on "garden' components - potential to make it very cheap.
Possibility of a wide range 1A supply using only board mounted devices and no heatsink

I have been toying with a variant of Daves power supply with very similar specs, still based on a LT3080 (I do not have the analog experience to replace it). I think we can live with 10-30V input. But I've based my design on a xMegaA3U because it has a 12bit ADC & DAC, so we need no other digital components. It also has USB with a boot loader, so people can upgrade the Firmware in the field easily (no programmer needed).
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 20, 2012, 09:46:09 am
That circuit goes way over my head, but it sure looks pretty  :)

On the pre-regulator aspect, what are the possibilities of making a switching pre-regulator that works at a low frequency like 100 Hz to avoid switching noise getting into the output? I'm thinking along the lines of a big filter cap as found in a normal linear supply, but switching current into it to top it up to just the right voltage. What size inductor in the switching circuit would adequately handle the low frequency, high current pulses?

I have seen an example in some application notes where an active SCR switching rectifier/pre-regulator was used, but I couldn't clearly follow how the circuit worked. It seemed to switch just enough of each AC half cycle to top up the reservoir capacitor to the desired voltage. What puzzled me is that this is clearly a very non-linear system and I was interested in how it was made to work in a stable and effective manner.
Definitely can make a switching pre-regulator at 100Hz like the SCR one in the Linear Technology app note, but the high frequency switchers are just so small and efficient, and the ripple can be pretty good - you tend to get a fair amplitude of ripple at 100Hz unless you go to huge capacitors. 

For me, the key to low power is to reduce the ripple amplitude from the switching regulator to minimize the switcher to linear regulator differential, and for that the high frequency switcher is going to be the way to go. 100Hz switching designs were ideas from the 1970's electronics mags. Time to move on.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: markus_b on March 20, 2012, 12:39:38 pm
Yes, I agree, a high frequency switcher to pre-regulate is the way to go. We probably should leave 2V for the linear regulator, this limits its power dissipation to 2W/Amp, something we can live with.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 20, 2012, 03:21:53 pm
Yes, I agree, a high frequency switcher to pre-regulate is the way to go. We probably should leave 2V for the linear regulator, this limits its power dissipation to 2W/Amp, something we can live with.
I will take a look at the switching regulator soon. Right now, I am seeing if I can get a second version of my design working. It is almost stable, but there is a little ringing on transient load changes. Got to eliminate that - ringing means something is not right yet.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: markus_b on March 20, 2012, 03:43:29 pm
I imagine that the entire thing is powered with a power supply like this one:
Universal laptop power supply (24V) (http://dx.com/100w-laptop-power-adapter-3-piece-kit-15v-24v-output-8854)

I like the 1V range of the inputs, my pet micro (xMega32A4U) for this has a 1V internal reference.
Title: Re: General Purpose Power Supply Design
Post by: IanB on March 20, 2012, 04:21:25 pm
Definitely can make a switching pre-regulator at 100Hz like the SCR one in the Linear Technology app note, but the high frequency switchers are just so small and efficient, and the ripple can be pretty good - you tend to get a fair amplitude of ripple at 100Hz unless you go to huge capacitors.

For me, the key to low power is to reduce the ripple amplitude from the switching regulator to minimize the switcher to linear regulator differential, and for that the high frequency switcher is going to be the way to go. 100Hz switching designs were ideas from the 1970's electronics mags. Time to move on.

OK, I understand time marches forward. But my thinking was that larger amplitude, lower frequency ripple might be easier for the linear regulator to filter out than small amplitude, high frequency ripple. You mentioned for example that the LT3080 ripple rejection falls off dramatically above 100 kHz. If a very clean supply is desired, is there a balance to be found somewhere above 100 Hz and below 100 kHz?
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 20, 2012, 09:16:51 pm
At 100hz, you need a 10000 uf cap to reduce the ripple to 1v peak to peak.

If the regulator is at maximum and you short the load, the regulator had to dissipate all the stored energy in that big capacitor. Remember the whole idea of using a preregister is to reduce the power dissipation in the regulator.

You want to stay away from the rest of the audible frequencies unless you like listening to your regulator. 20khz to 100 khz is workable. For 1v ripple at 100 khz, all you need is a 10uf cap. Much better!

The alternative is a high frequency switcher followed by a LC filter network to eliminate the high frequency. Definitely possible but it might take a few PCB revisions to get it working right.

Richard
Title: Re: General Purpose Power Supply Design
Post by: markus_b on March 20, 2012, 09:38:40 pm
In Daves latest video he looks at a switching regulator in series with a LT3080. The switching regulator in question runs at 750kHz and this is in the official LT3080 data sheet. The TL3080 seems to have no problem with the ripple of the switching regulator there.

I seem to read data sheets too rapidly, at leat I overlooked that part before, looks very interesting !
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on March 21, 2012, 12:18:03 am
If I´m understanding correctly, you are feeding the pass transistor (Q1) with a current of 10 mA generated by a constant current source (Q3, D1, D2, R1, R2 and C3) and you regulate the output voltage by bleeding this current with Q2/R2, right?

A couple questions.

1. Shouldn't the dropout voltage be about 2.5V, as you need 1.4V for the current source feeding the base, another 0.7V for the Vbe of Q1 and 0.4V for D5?

2. With a hfe of 20-70, there is no way of getting 1A with an MJE3055 without increasing the current from Q3 (decreasing R1 to 12 ohms), right?
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 21, 2012, 02:44:32 am
In Daves latest video he looks at a switching regulator in series with a LT3080. The switching regulator in question runs at 750kHz and this is in the official LT3080 data sheet. The TL3080 seems to have no problem with the ripple of the switching regulator there.

I seem to read data sheets too rapidly, at leat I overlooked that part before, looks very interesting !
At 750kHz, the LT3080 has only about 13dB of line ripple rejection, and most of that would be the 2.2uF output capacitor that they specify. That means that if you have 500mV ripple going into the LT3080, you will have about 100mV coming out.

So the reality is if you want to use a 750kHz pre-regulator, you have to remove the switching noise before it gets to the LT3080. A good filter could probably get rid of more like 60dB of switching noise.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 21, 2012, 03:01:14 am
If I´m understanding correctly, you are feeding the pass transistor (Q1) with a current of 10 mA generated by a constant current source (Q3, D1, D2, R1, R2 and C3) and you regulate the output voltage by bleeding this current with Q2/R2, right?

A couple questions.

1. Shouldn't the dropout voltage be about 2.5V, as you need 1.4V for the current source feeding the base, another 0.7V for the Vbe of Q1 and 0.4V for D5?

The dropout of the current source is something like 0.7V as the transistor can turn on to saturation. For the shottky, I just used one in the LTSpice library, but you can get schottky's with 0.3V drop.

Quote

2. With a hfe of 20-70, there is no way of getting 1A with an MJE3055 without increasing the current from Q3 (decreasing R1 to 12 ohms), right?
I tested the gain of the one I had and it was 120, and I did use a lower R1. But there are transistors available with gains of 200 to 350 at 1A, and that is the ones I would go for in a final design. High gain transistors eliminate most of the heat in the driving transistors.

Anyway, I may be close to getting a PMOS based design working with a dropout of 1V. I have a stable design, but I have to check the margins of the stability. A lot less parts then the transistor based design. This would be great if I can pull it off as there are fabulous PCB mounted MOSFETs available. Much easier to find then the super gain PCB mount medium power transistors.

It would be much easier to scale the design up to higher currents with MOSFET power devices, but at the moment, I am a fair way from a circuit that would allow me to swap to different MOSFETs and remain stable.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: IanB on March 21, 2012, 05:42:01 am
How do devices like the LT3080 "miraculously" remain stable with different loads? I had the presumably naive impression it was all down to placing a suitable amount of capacitance at the output? (Qualitatively, the capacitor dominates the properties of the output system and isolates the load from the controller. The feedback loop only "sees" the capacitor, so as long as the loop is stable with the chosen capacitor it will be stable with all reasonable loads.)

In my world I have never had to do the kind of frequency domain stability analysis that EE's often have to do. It is interesting to see the problem from that perspective.
Title: Re: General Purpose Power Supply Design
Post by: BravoV on March 21, 2012, 06:14:23 am
Design based on "garden' components - potential to make it very cheap.

I will get onto the design in the next post. This design exercise is not to make something similar to Dave's supply. I have left out any attempt at this stage in a uCurrent type device, and I am only looking a very low cost high performance regulator that could be controlled by just plain potentiometers.

Richard, thanks for starting this initiative especially on not choosing exotic part, really appreciate it.

Love the idea on using "garden" components, please keep it this way should this design evolved into more complex circuit. Eagerly waiting to see the pre-regulator section, hopefully you will use those "garden" switcher as well.  :)

Btw, how does this design scale at higher current rating ?
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 21, 2012, 06:45:18 am
The intuitive thing is that extra capacitance, but capacitance is the most difficult load of all for stability.

I will try and keep it simple. Power supplies use feedback to regulate the output which means you have a high gain amplifier with negative feedback. The negative feedback will change the output voltage until the difference between it and the reference voltage is zero.

Now add frequency to the equation. Due to internal capacitance, amplifiers loose gain as the frequency increases. What goes along with that is phase shift. If at any frequency a control loop has a gain more then 1 and the total phase shifts reaches 180 degrees, the control loop will oscillate.

Opamp designers have known about this forever. What they do is to make the input and output stages of opamps really fast, and then slow the middle gain stage down with a single RC time constant. This has a phase shift of 90 degrees from about 10Hz up to 1MHz (or whatever the opamp goes to). With one single RC dominating, the phase shift through the opamp's whole frequency range is around 90 degrees so it is stable.

Just to make this clear, if you had a 1KHz signal going into a unity gain opamp, the output would look pretty much in phase with the input. But if you looked at the microvolt AC signal between the inverting and non-inverting inputs, that signal would be leading by 90 degrees. Simply to have a zero phase lag 1KHz coming from the output, the actual input signal between the input pins has to be leading by 90 degrees.

Now we come to power supplies. you still have the opamp with its 90 degrees phase shift, but you have extra stuff too -  power transistors, driver transistors, protection circuitry, etc, and no matter how hard you try, these all add extra phase shift. Ok so say you keep all these other things to an extra 45 degrees - the supply is stable?

Unfortunately for the designer, stupid people actually want to put loads on these power supplies. What happens when you put a massive capacitor on the output of a supply? You have another 90 degrees phase shift and it oscillates. The bigger the capacitor, the more likely the supply will oscillate. 

So the power supply designer and the IC designer has to do the impossible - if you disconnect any filter capacitor from the output, the control loop has to have less then 90 degrees phase shift all the way from Dc to the 100kHz+ bandwidth of the loop. You can follow the opamp trick of making everything blindingly fast except for one RC constant and then you do some tricks to slow the roll of to less then the 6dB per octave of the RC time constant, and the result is you get a little less then 90 degrees. This is the technique probably used in the LT3080.

For the discreet componect supply designer, you usually want to use an opamp that has the 90 degrees RC time constant built in, so you have to do tricks with external RC networks to cause a bit of phase lead to cancel out the excessive phase lag. It is not easy which is why Dave went for the LT3080 solution. If he did design a discrete supply, he would probably be on video blog number 23 by now - still fiddling with the compensation.

The conclusion is that for most power supplies, if it is stable with a 100,000uf capacitor under all output voltage and current conditions, it is probably going to be stable for most other loads. Lots of power supplies out there are probably not stable with a huge capacitor, as the voltage is hardly changing on the capacitor - it is the control circuit in the supply going nuts. Most people wouldn't notice. This may seem OK, but it is not, as it will affect regulation, the current limit control, and a few other things.

Richard.

Title: Re: General Purpose Power Supply Design
Post by: amspire on March 21, 2012, 06:58:44 am
Design based on "garden' components - potential to make it very cheap.

I will get onto the design in the next post. This design exercise is not to make something similar to Dave's supply. I have left out any attempt at this stage in a uCurrent type device, and I am only looking a very low cost high performance regulator that could be controlled by just plain potentiometers.

Richard, thanks for starting this initiative especially on not choosing exotic part, really appreciate it.

Love the idea on using "garden" components, please keep it this way should this design evolved into more complex circuit. Eagerly waiting to see the pre-regulator section, hopefully you will use those "garden" switcher as well.  :)

Btw, how does this design scale at higher current rating ?

I am close to a simpler MOSFET design that does scale really well. The problem I have now is picking some MOSFETs to focus on. There once was a time when there were only about 20 common MOSFETs and life was extremely simple. Now the numbers are ridiculous.

The transistor design I posted probably works best at 1A. You could push it to 2A by using the really high gain Zetex transistors. That is about it without without a redesign.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: EEVblog on March 21, 2012, 07:31:56 am
For the discreet componect supply designer, you usually want to use an opamp that has the 90 degrees RC time constant built in, so you have to do tricks with external RC networks to cause a bit of phase lead to cancel out the excessive phase lag. It is not easy which is why Dave went for the LT3080 solution. If he did design a discrete supply, he would probably be on video blog number 23 by now - still fiddling with the compensation.

Bingo, I'm not as silly as I look  :P

BTW, I'm not sure why everyone thinks my supply is locked into using the "exotic" LT3080. You can substitute for an LM317, but then it only goes down to 1.2V which is not a big deal in most cases. Just have to offset the drive voltage by 1.2V. And that aspect can be fixed if you really want.

Dave.
Title: Re: General Purpose Power Supply Design
Post by: T4P on March 21, 2012, 08:08:45 am
Dave ,
what's your thoughts on the numerous articles out there claiming the LM317 to have a similar performing opamp as a LM741 "They claim it's bad , but then i looked , it's a audiophoolery site" ?
Another case of them wanting overkill for the opamp ? I don't know .  ;)
Title: Re: General Purpose Power Supply Design
Post by: EEVblog on March 21, 2012, 09:54:38 am
I am close to a simpler MOSFET design that does scale really well. The problem I have now is picking some MOSFETs to focus on. There once was a time when there were only about 20 common MOSFETs and life was extremely simple. Now the numbers are ridiculous.

Yup.
Is the world better or worse off as a result? Sometimes I'm not sure...

Dave.
Title: Re: General Purpose Power Supply Design
Post by: EEVblog on March 21, 2012, 10:31:32 am
I think people may not get how brilliant and revolutionary Dave's concept is. We are totally used to hand held meters, but we are still stuck to the idea that a power supply has to be anchored to a wall socket on the bench, and the idea that you do development on the bench, rather then the place the design is actually going to be used - whether that is on the roof, half way down a canyon, in the car, on a boat or wherever.

If a supply efficiently uses the energy in a lithium battery, the supply can easily last for days powering a typical modern low power circuit. Given that, why would you want a power cord at all?

Just on the battery part.
I started out with the idea for 3 x 18650's because that's what I fitted in the small case, and I wanted maximum capacity.
Then I dropped to 2 x 18650's because it was cheaper/easier on the charging side.
Now I think I'll be dropping it to 1 x 18650 (or optional larger cell) and going with a proper robust charging solution that gets maximum life out of the cell and better handles the ability to charge and power the supply at the same time. It also adds the USB charging feature back.
The idea is that it's a mains supply most of the time, but when you need it portable, just disconnect and it's ready to go for a few hours or days depending upon the load.

Maybe that belonged in the other thread, but oh well...

Dave.
Title: Re: General Purpose Power Supply Design
Post by: markus_b on March 21, 2012, 11:03:28 am
BTW, I'm not sure why everyone thinks my supply is locked into using the "exotic" LT3080. You can substitute for an LM317...
Actually I don't consider the LT3080 as exotic, you can get it at all the big distributors. It may be less common as a LM317, but it contributes greatly to the simple and elegant design. It may be somewhat more expensive that a discrete circuit, but has the great advantage to work reliably, be robust (thermal protection) and to be easy to use.

Title: Re: General Purpose Power Supply Design
Post by: amspire on March 21, 2012, 11:54:47 am
I think people may not get how brilliant and revolutionary Dave's concept is. We are totally used to hand held meters, but we are still stuck to the idea that a power supply has to be anchored to a wall socket on the bench, and the idea that you do development on the bench, rather then the place the design is actually going to be used - whether that is on the roof, half way down a canyon, in the car, on a boat or wherever.

If a supply efficiently uses the energy in a lithium battery, the supply can easily last for days powering a typical modern low power circuit. Given that, why would you want a power cord at all?

Just on the battery part.
I started out with the idea for 3 x 18650's because that's what I fitted in the small case, and I wanted maximum capacity.
Then I dropped to 2 x 18650's because it was cheaper/easier on the charging side.
Now I think I'll be dropping it to 1 x 18650 (or optional larger cell) and going with a proper robust charging solution that gets maximum life out of the cell and better handles the ability to charge and power the supply at the same time. It also adds the USB charging feature back.
The idea is that it's a mains supply most of the time, but when you need it portable, just disconnect and it's ready to go for a few hours or days depending upon the load.

Maybe that belonged in the other thread, but oh well...

Dave.

I think one cell is plenty myself. If you think about it, debugging an arduino with some attached accessories is probably going to draw 100mA max at 5V. Even if you were debugging for the whole day, you are not going to flatten the battery.

Even at 20V and 1A, you will probably get over 15 minutes and that is enough for a quick test. If you want longer, you are going to plug in the charger anyway.

To me, power supplies are something you build, and then you keep using it for the next 30 years. It will go through lots of batteries in that time, so replacing one cell is much better then replacing two or three.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 21, 2012, 12:03:47 pm
I am close to a simpler MOSFET design that does scale really well. The problem I have now is picking some MOSFETs to focus on. There once was a time when there were only about 20 common MOSFETs and life was extremely simple. Now the numbers are ridiculous.

Yup.
Is the world better or worse off as a result? Sometimes I'm not sure...

Dave.
I need to look for the low turn-on voltage MOSFETs, but it doesn't seem to be one of the search parameters on Digikey. I might have to plow through millions of data sheets. Some MOSFETs, I can run with a power supply as low as 3.5 volts to get 1A out. Others need a 5V supply just so the MOSFET gets enough gate drive to turn on.

If anyone knows some good low turn-on voltage P channel MOSFETS with a voltage rating of 20V or more, please make some suggestions.

The design I am working on scales, so anything from 2A to 20A or more is great.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: ejeffrey on March 21, 2012, 12:15:03 pm

I started out with the idea for 3 x 18650's because that's what I fitted in the small case, and I wanted maximum capacity.
Then I dropped to 2 x 18650's because it was cheaper/easier on the charging side.
Now I think I'll be dropping it to 1 x 18650 (or optional larger cell)

I like single cell a lot.  You can easily parallel 2 or 3 cells to get more capacity if needed without changing the circuit at all, or replace it with a prismatic LiPo.
Title: Re: General Purpose Power Supply Design
Post by: EEVblog on March 21, 2012, 12:31:32 pm
I think one cell is plenty myself. If you think about it, debugging an arduino with some attached accessories is probably going to draw 100mA max at 5V. Even if you were debugging for the whole day, you are not going to flatten the battery.

Even at 20V and 1A, you will probably get over 15 minutes and that is enough for a quick test. If you want longer, you are going to plug in the charger anyway.

That's what I thought. Battery capacity is always going to be a tradeoff regardless of what size.
One cell will provide some decent usable time for most loads, and those who want bigger capacity can hack in a bigger cell without any mods. Not that choices in bigger cells are that great, but they exist.

Dave.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 21, 2012, 02:35:21 pm
Here is where I am up to with a mark II design using a P channel MOSFET.

This is just the regulator minus current limit and voltage booster. It is almost great. It will let you plug in different MOSFETs and different PNP driver transistors without affecting stability.

If you have a MOSFET that can turn on at 2V gate voltage, you can run it with a supply as low as 3V. For 5V and over, the dropout voltage is less then 1 volt.

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=22469)

It is close but not perfect. The combinations of the two RC time constants is somehow allowing a damped resonance around about 200KHz. I haven't started to analyse why yet, but it needs to be eliminated. Otherwise you might attach it to a 200KHz switching regulator load, and the power supply may decide to join in the party with a bit of 200Khz sinewave output.

Otherwise, I couldn't be happier with the loop phase performance. The fact you can easily change the MOSFETs means it is really easy to change this from a 1A supply to a 100mA supply or a  5A supply (or more). With a change to the overvoltage circuit, it could output up to 30V. The only thing you need to change is the current sense resistor. It can be used with PCB mounted FETS and a switching preregulator, or with mosfets on a heatsink as a conventional linear power supply.

Notice I am sticking with the LM324. Basically, it is just a good chip, and I would have to look long and hard to find something that was better in general. It allows the voltage on the inputs to go to +32 volts (even with the supply off), and that allows design choices that many of the new rail-to-rail opamps do not allow. The input can operate at the zero volts supply rail, and with the aid of either a pull up resistor or a pull down resistor, you can get the opamp output to operate to either one of the rails.

Richard.

Title: Re: General Purpose Power Supply Design
Post by: A Hellene on March 21, 2012, 06:17:55 pm
Kudos, Richard! A linear regulated PSU design, based on plain parts is a brilliant idea!

Thanks to Dave's LT3080 PSU, I begun experimenting to roll out an LT3080 based upgrade (https://www.eevblog.com/forum/blog-specific/eevblog-259-psu-rev-c-schematic-part-12/msg97898/#msg97898) for my ancient '723 based PSU, only to find out that almost not one distributor has the LT3080 in TO-220 package available in stock! Which made me once more realise not to rely my designs on so exotic components. I guess that now I have run out of excuses not to be looking into solutions with more conventional parts. But, again, hunting down sub-millivolt/milliamper accuracy forces one to use these less than 1 LSB INL 16-bit digital parts. Oh, well...

On the concept of using MOSFETs at the power stages, I think there is a major drawback: No matter how much I love these parts, the problem lies at the fat gate the beefier parts have, which holds a substantial amount of charge and needs a full blown half bridge driver for the fast charge/discharge of the gate capacitance and to race against the Miller effect --especially when the voltage rises. Using the more flexible N-channel parts makes the design even more complex. Though I've found parts electrically suitable for my needs, the TrenchFets (http://www.vishay.com/mosfets/) for example, the bad news is that they come in not so heat-sink-friendly packages. Once more, I realise that one can never have it all...


-George
Title: Re: General Purpose Power Supply Design
Post by: BravoV on March 21, 2012, 06:46:53 pm
Richard, took a liberty to redraw the mosfet version since you didn't provide the .ASC, and I made it more representative to myself, hope you don't mind.  The ltspice circuit zipped file attached below.

I'm using the internal ltspice built-in linear op-amp LT1014 instead of LM324, although I have this model myself, decided to ease other member who doesn't have the LM324 model, and can just load this circuit and run it with the standard untouched LTSpice installation.

Btw, LT1014 is the "cross reference" part of LM324. :D

Also I did some tinkering on voltage source at 12 volt with 100mv ripple at 200Khz and with a dynamic load with square wave 50Khz at 100mA.

The circuit, pardon for the color scheme, its just I love dark background.  :P

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=22486;image)


The result on load current, source voltage and the regulated output at the bottom

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=22488;image)


Zoomed

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=22490;image)
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 21, 2012, 11:37:12 pm
BravoV, great simulations. Sorry I didn't post the LTSpice files but it was late. Next time I pust a spice file, I better rememebr to add the LM324 files as well, but it looks like the LT1014 does behave pretty similarly.

You got me all excited as it has fabulous offset voltage. Then I saw it doesn't allow the +30 volts on  the inputs, regardless of the opamp supply voltage. The LM324 has these crazy PNP input transistors with a reverse breakdown over 30V. I wish I could buy discrete transistors like that.

The simulation all makes sense. You put in 0.1 ohms for the filter capacitor ESR. If you use low ESR ceramics, you can get down to 0.1 ohms ESr, and the output becomes hugely better. The 200KHz feedthrough and the output transients are much smaller. But there is a cost. If you have 30volts  across 0.01 ohm ESR caps and you short them, you can get a massive discharge current. The only saving you from 3000 amps peak would be various inductance in the circuit, and the lead resistance.

In your simulations, there is a startup issue, so I will have to see what is happening.

All in all though, your results make sense and I think they are reasonable results. I hope to improve the performance at 200KHz, but it does not look too bad. A LC filter between a 200kHz switcher and the supply would wipe out any signifigant 200kHz on the output. The performance is only slightly worse then the LT3080.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 22, 2012, 12:14:57 am
On the concept of using MOSFETs at the power stages, I think there is a major drawback: No matter how much I love these parts, the problem lies at the fat gate the beefier parts have, which holds a substantial amount of charge and needs a full blown half bridge driver for the fast charge/discharge of the gate capacitance and to race against the Miller effect --especially when the voltage rises. Using the more flexible N-channel parts makes the design even more complex. Though I've found parts electrically suitable for my needs, the TrenchFets (http://www.vishay.com/mosfets/) for example, the bad news is that they come in not so heat-sink-friendly packages. Once more, I realise that one can never have it all...

George, I am aware about the Miller effect. In the context of this supply, the only time it causes a big problem is if the supply is on, say, 30V out and you then short the output. The Miller effect would cause the gate voltage to increase by 1 to 2 volts. The results then depend on whether you chose a 200 milliohm mosfet or some 1 milliohms monster. The 200 milliohm mosfet might go from 1A to 8A for a few microseconds. The monster mosfet could go to hundreds of amps. either one though could drag the source supply down, and since this is for a single supply design, it affects all the opamps, micro's, etc. I have some idea that I will investigate when I get onto the current limit for this design.

The simplest solution may be to stick with high resistance-low capacitance MOSFETS, and then adding an extra 1nF capacitor across the gate. If you have a MOSFET with a 10pF reverse capacitance, and you short out the 30V output, the gate voltage would only rise by 0.3 volts for a few microseconds with a 1nF gate capacitor, and the peak current will not be too bad. I can also reduce the 1000 ohm gate resistor to 100 ohms at the expense of an extra 27mA of wasted current, and it would reduce the Miller Effect surges on shorts to a few hundred nanoseconds. Perhaps then a tiny bit of inductance to wipe out the surge, and it is then totally fine.

I will probably try the PNP pass transistor option as well. If you drive the base with a constant current, then a PNP will maintain that constant current when you short the output. There will be some Miller Effect to, but the high gain medium power transistors tend to have the gain plummet by the time you get to 2A, so the Miller effect just will not be a big problem.

I still thing the MOSFET solution is probably the best if I can sort out the rough edges, as the design can be extended in terms of current and power  far more easily then with the transistor options. There are not a huge number of high gain transistors, and they are limited to up to about 2A. Low gain power transistors mean either using a darlington arrangement or a driver transistor that has to be on a heatsink to cope with the power at maximum voltage out. Darlingtons tend to be bad for saturation voltage, base voltage, speed. Not great for low dropout designs where you are running the transistor near saturation.

AcHmed99, those MOSFETs are exactly the kind you are best staying away from.  Low resistance is just no advantage for a linear supply as you need resistance to regulate, and the low resistance comes with absolutely massive gate and output capacitances. The buffer IC is not much use either. It is not a great buffer for analog anyway, but anything you add between the opamp and the MOSFETs will mess up the compensation.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 22, 2012, 03:52:26 am

AcHmed99, those MOSFETs are exactly the kind you are best staying away from.  Low resistance is just no advantage for a linear supply as you need resistance to regulate, and the low resistance comes with absolutely massive gate and output capacitances. The buffer IC is not much use either. It is not a great buffer for analog anyway, but anything you add between the opamp and the MOSFETs will mess up the compensation.

Richard.

I’m afraid I have to disagree with you there Richard. A buffer will add propagation delay hence phase shift but that is why you use compensation to compensate for phase shift through out the loop.

From my experience any extra delay you add double the complexity of stabilizing the loop.  What I am after is a loop that is stable enough that you can swap key transistors. FET's etc without need to re compensate. It works out the less you can have in the loop, the better. I guess it really comes down to putting it in a design  and testing it. Until it is done, it is just opinions.

Quote
Rdson is irrelevant in A FET regulator with the exception it determines drop-out. A fet can sets its rdson via gate voltage to anything virtually. What is desirable in a fet as a pass device is a gradually sloping transcoundactance curve vs a fast steep rise. This means that the fet gate will not be so touchy and less prone to oscillation.

It is not the Rdson that matters - it is the capacitance and the transconductance curves that go with it. My circuit as is can probably handle 1nF gate capacitance but that is probably as high as you want to go. You can get a lot of amps out of a device with a 1nF gate capacitance. Going to a device with 3nf or more gate capacitance is a problem for the circuit, and it doesn't do much for you unless you are trying to build a 50A linear regulator. The other thing, as I said was the added Miller Effect gate voltage when the regulator output is shorted from 30V to 0V instantly. If you are at 1A and you add 2V to the gate of a 0.2 ohms MOSFET, you might go up to 5A. If you add 2V on a 60A MOSFET, you might go very much higher.

It may be that I am thinking of .5A to 5A power supplies, and you are thinking much bigger.

But I do agree with your comments about the transconductance curves. The steep curves are adding gain and nonlinearity where I just do not want it.

One of the biggest problems is to minimize the low voltage dropout of the regulator, I need a low gate voltage MOSFET with guaranteed worse case specs. The manufactures love to be very vague with gate specs. They do tell you usually that you can get full rated current at 10V, but the rest is often typical specs. Ideally, I want a MOSFET where they spec a minimum current at 2V gate voltage and 1V source to drain voltage.

Quote
Mind you I could be wrong it’s been a while since I designed a linear reg from scratch but that’s my recollection from when I did. I will find out in another couple of weeks because I plan on using two of the N-FETS I linked to as pass devices in a 0-30V 220W regulator. I’m soldering together the second revision of the bias supply and PFC right now. Its being fed from a variable output half-bridge. So fifteen amps max current; low drop-out is required to keep the heat sinks reasonable.

I wouldn’t waste too much time simulating a FET regulator most models are switching models and do not model operation in the linear region with reliable accuracy.

Yes. Nothing beats real testing of a design. As I mentioned above, in my first design of this thread, I got a MJE3055 (TO220 2N3055) transistor to oscillate at 108MHz on the bench even though the transistor has a spec'ed FT of 70MHz. Spice was never going to tell me that.

Sounds like an interesting power supply you are building. How big are the input filter caps? If you are going for low dropout voltage, I suspect they are something impressive.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 22, 2012, 04:26:02 am
Here is a datasheet on an FET controller for LDO's. Some details are in it regarding gate capacitance and output capacitance.

http://www.ti.com/general/docs/lit/getliterature.tsp?genericPartNumber=lp2975&reg=en&fileType=pdf (http://www.ti.com/general/docs/lit/getliterature.tsp?genericPartNumber=lp2975&reg=en&fileType=pdf)
Just went back and had a look at the link you posted. Very interesting. I will give it a read.

Looking at the waveforms, they don't seem worried by a bit of damped ringing after transients. A pity they didn't take the inverting amplifier out from the IC so you could use your own reference. 24V maximum input - not bad.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 23, 2012, 12:06:02 am
AcHmed99, we are probably at cross purposes here.

I am looking at a general purpose power supply, so I have to assume that the supply has to manage its current limiting without dragging down the source, even if it is only for a few microseconds. If I am designing a short circuit protected supply, I am designing for the case where someone puts a dead short across the power terminals. There may be There may be other stuff running of the regulator source, so I do not want a big glitch on the source - again, that is my design choice.

I just do not want a supply that cannot control the current through the MOSFET properly, so i will look for a solution.

I just did a spice simulation of the Miller Effect current spike. My source impedance was 0.1 ohms which is realistic for a capacitor across the source. Load was .01 ohma and I included a .1 ohms current sense resistor.

I picked a Fairchild FDS6675 mosfet 30V,  20 milliohms resistance.

With a 30V supply and 29V out at 1A, a short results in a peak current through the mosfet of 80 Amps for about 100nS. If you reduce the gate drive to .01 ohm, the peak current is 15 A. If I replace the mosfet with a 200 milliohm one, I get 55A peak with a 100 ohm gate source but with a 1 ohm gate source or less, it reduces to about 8 A peak. A bit better.

If I use a an old 2N2955 PNP power transistor fed by a high impedance constant current base drive, I get a 3.4A peak current on a short. That is more like the number I want to see in a general purpose design.

These numbers sound about right to me.

As far as the buffer is concerned, I just have to be convinced that a buffer with lousy crossover is good for analog. It still looks like a switching buffer to me. I have been experimenting with a Mark III design based around PNP transistors with a constant current base drive, and it might be the way to go. The only trouble is that compensation seems to be more transistor dependant then the MOSFET design.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 24, 2012, 01:20:47 pm
How to turn four Arduino 8 bit PWM outputs into four independent D/A DC outputs with over 24 bits of monotonic resolution.

I am very close to a low cost power supply design I am really happy with. Different from the previous two, but I think the one I have now is the design I have been aiming at. Better then the Mark I and Mark II designs in many ways.

I have to thank AcHmed99. The discussions with him actually resolved some issue for me.

Anyway, I took a break from that to try out another idea. Going for the low cost solution, I wanted to drive the design from a PWM on something like an Arduino. Pwm is great in that it is totally monotonic which is something I really want in my design, but the resolution is lousy.  There is one 16 bit PWM, but that is still something like 0.5mV increments, if you are really careful about the scaling of the PWM output. The scaling will probably mean that full voltage out from the supply is only about 50% of full scale for the PWM.  I want software calibration, and I want to be able to finely adjust the output voltage so that I can get a 6 1/6 digit meter to show 10.00000 volts. That needs 20 bits of resolution or more.
 
I used the 8 bit PWM's in FAST mode, and correct for accumulated error every PWM cycle. I ran the Arduino's PWM at maximum speed of 32KHz. The filter was a 3 stage 10k/0.1uf RC chain. Two stages are not enough to clean out the sub mV ripple.  I am pretty happy with the results.

It means with some better coding, I should be able to get 4 independent PWM outputs with sub microvolt resolution.

Here is the code I used to test it, if anyone is interested.  Pretty rough - I only wanted to get it to work, and I would probably go to assembler in the interrupt routine to implement it properly.

Code: [Select]

unsigned long value ;
unsigned long pwm_accum ;

volatile int Sec2 = 0;

// Interrupt every PWM cycle - this is where all the magic happens

ISR(TIMER2_COMPA_vect) {
  digitalWrite(13, HIGH);   // set the LED on - just toggling this so I can see when the interrupt routine is running
  OCR2B = (byte) (pwm_accum >> 24) ;   // Send the top byte of the PWM error accumulator to the PWM for the next cycle.
  pwm_accum = pwm_accum - (((unsigned long) OCR2B) << 24 ) ;  // Subtract the byte sent to the PWM from the top byte of the PWM error accumulator.
  pwm_accum = pwm_accum + value;   //Add the intended value for the output to the error from the last cycle
  digitalWrite(13, LOW);    // set the LED off
}

void setup() {

  pinMode(3, OUTPUT);  //  PWM OCR2B
  pinMode(11, OUTPUT); // PWM OCR2A
  pinMode(13,OUTPUT) ;
  TCCR2A = _BV(COM2A1) | _BV(COM2B1) | _BV(WGM21) | _BV(WGM20);
//  TCCR2B = _BV(CS22);
  TCCR2B = 0x01;  //Full 16MHz click for the PWM
//  OCR2A = 180;
//  OCR2B = 255;
  value = 0L ;
  pwm_accum = value ;
  TIMSK2 = (1 << OCIE2A);   // Enable interrupt when Timer reaches OCRA
  sei();
}

void loop() {
 
  value = 0x08980000L; // Equals 0.1678466 volts )
}

The PWM is run in FAST mode at a 16MHz clock rate. There are some things I will need to discover like what can go wrong with a current PWM cycle when you change the PWM register. Even if every PWM cycle is not perfect, if I get a monotonic control output with no evident digitizing steps, no evident voltage fluctuations and as much resolution as the power supply regulator allows, I will be extremely happy.

It is much slower of course then a DAC. Small changes settle quickly, but a large change like from 0V to maximum would take about 1 second to settle properly.

To implement it properly, you cannot use the PWM straight out of the Atmel.  I would probably use a 74HC family non inverting buffer powered from a voltage reference to generate an accurate PWM output.

It may be that running the PWM at full speed adds to many errors due to hardware delay variations, and in that case, I will just slow the PWM down by a factor of 8. A better idea would be to use a high speed 74HC family synchronous flip-flop to reconstitute an accurately times PWM.

Back to the voltage regulator design. I will post it soon.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: Bored@Work on March 24, 2012, 03:27:23 pm
How to turn four Arduino 8 bit PWM outputs into four independent D/A DC outputs with over 24 bits of monotonic resolution.

Do you have a clock reference that good? A voltage reference that good? All other parts low drift, low tempco, etc.? Otherwise the LSBs will stagger around like a drunken sailor after a weekend of shore leave.

A 24 bit DAC with a 5V reference means you deal with approx. a 300 nV LSB, with a 3.3V reference the LSB is 200 nV. Is your opamp at the end of the RC filter that good?
Title: Re: General Purpose Power Supply Design
Post by: markus_b on March 24, 2012, 05:42:49 pm
I find a 12 bit resolution plenty. Allows for 0-40V in 10mV steps. This is in the same league as the 0.1% resistors specified by Dave. 24bit is equivalent to 0.1 ppm, way out of my league certainly not in a low cost design.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 24, 2012, 06:59:58 pm
Don't confuse resolution with accuracy. I want the D/A resolution better the the supply noise, so there is no noticeable digitizing steps at all. I like using my supplies for lots a of things, including some precision work. So if a calibration instruction says "attach 18.0000 volts to the input, I like being able to fine tune the output so a precision voltmeter says "18.0000".

Why would I want to spend extra money for a DAC that could only adjust to 17.99863V, and was not monotonic, so for fine adjustment, it could drop a few mVs as you carefully wind up the voltage?

Richard.
Title: Re: General Purpose Power Supply Design
Post by: IanB on March 24, 2012, 07:24:27 pm
I used the 8 bit PWM's in FAST mode, and correct for accumulated error every PWM cycle. I ran the Arduino's PWM at maximum speed of 32KHz.

Can you give the high level summary of how you get 24 bit resolution from an 8 bit source? I'm not immediately grokking it. Does "correcting for accumulated error" imply some kind of measurement feedback on the output or is it purely a predictive algorithm? As I write this, I am wondering if you are dithering the output so that a combination of different 8 bit words averages out to 24 bit resolution?
Title: Re: General Purpose Power Supply Design
Post by: BravoV on March 24, 2012, 08:13:04 pm
I want software calibration, and I want to be able to finely adjust the output voltage so that I can get a 6 1/6 digit meter to show 10.00000 volts. That needs 20 bits of resolution or more.

Don't confuse resolution with accuracy. I want the D/A resolution better the the supply noise, so there is no noticeable digitizing steps at all. I like using my supplies for lots a of things, including some precision work. So if a calibration instruction says "attach 18.0000 volts to the input, I like being able to fine tune the output so a precision voltmeter says "18.0000".

With the current discussion on the PWM -> VRef circuit, although I don't know crap about this, Richard, should your design needs quite an intensive adjustments & tunings to reach certain accuracies, just want to say I'm your backer here. Also since this project is aimed for one off DIY project or limited build anyway, even they're time consuming and possibly quite a hassle, they should not be a deal breaker for diy community.

Unlike Dave's design, of course its different story since it will be made into mass produced product, tuning & adjusting manually could be a headache for him.

Eagerly to see the upcoming stages of your design.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 24, 2012, 08:40:32 pm
The output of the 8 bit PWM corresponds to about 100mV steps on the output.

Let's say I want 1.05 V out. I get this by outputting a 1v pulse, then a 1.1v pulse and repeating this. Average the result and you get 1.05 V. So I am actually adding a software controlled PWM to the output of the hardware PWM. The value I want is stored in a 32 bit register, and the software will correctly modulate the hardware PWM to get an average pulse width value that exactly mathematically equals that 32 bit number - as long as you average over about 10 minutes.

The algorithm is very simple. First PWM output, it takes the 1.05 V and rounds it down to the nearest 100 mV step - or 1 V. It then adds the .05 V error to 1.05 to give 1.1 and repeats the algorithm. This time it outputs a 1.1 V pulse.

The end result is you can have as much resolution a you want, as long as the filter averages over enough PWM pulses. You just pick a good compromise between speed and resolution, and you can always add a electrolytic cap on the power supply output if you needed more resolution.

I will probably pick a filter that will result in about a 22 bit resolution, and will settle reasonably quickly.

Richard. 
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 24, 2012, 08:58:43 pm
BravoB, thanks for the encouragement. I am trying to make something ready cheap that had decent performance.

If it is cheap enough, you can afford to build several, and then use them in parallel for more current, or series for more voltage. If I can work out a master-slave system, then you could build $20 slave supplies that just follow the master.  Slaves would not need a control panel.

The actual regulator board would be well under $5 for parts excluding the PCB, and could be used as a general purpose module in other projects.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: ejeffrey on March 24, 2012, 09:11:45 pm
I used the 8 bit PWM's in FAST mode, and correct for accumulated error every PWM cycle. I ran the Arduino's PWM at maximum speed of 32KHz.

Can you give the high level summary of how you get 24 bit resolution from an 8 bit source? I'm not immediately grokking it. Does "correcting for accumulated error" imply some kind of measurement feedback on the output or is it purely a predictive algorithm?

It is a first order sigma-delta loop implemented in software.  You accumulate the error due to the finite resolution of your DAC and add that back into the output.  What this means is that if your ideal final value is halfway between two possible output values the DAC will alternate between those values.  This pushes noise to high frequency, but if you don't need the bandwidth you just put a bit of extra filtering and win.  This works with any DAC, but better with intrinsically linear devices like PWM.
Title: Re: General Purpose Power Supply Design
Post by: IanB on March 24, 2012, 09:55:22 pm
The output of the 8 bit PWM corresponds to about 100mV steps on the output.

Let's say I want 1.05 V out. I get this by outputting a 1v pulse, then a 1.1v pulse and repeating this. Average the result and you get 1.05 B.C. So I am actually adding a software controlled PWM to the output of the hardware PWM. The value I want is stored in a 32 bit register, and the software will correctly modulate the hardware PWM to get an average pulse width value that exactly mathematically equals that 32 bit number - as long as you average over about 10 minutes.

The algorithm is very simple. First PWM output, it takes the 1.05 V and rounds it down to the nearest 100 mV step - or 1 V. It then adds the .05 V error to 1.05 to give 1.1 and repeats the algorithm. This time it outputs a 1.1 V pulse.

The end result is you can have as much resolution a you want, as long as the filter averages over enough PWM pulses. You just pick a good compromise between speed and resolution, and you can always add a electrolytic cap on the power supply output if you needed more resolution.

I will probably pick a filter that will result in about a 22 bit resolution, and will settle reasonably quickly.

Interesting. I note the sigma-delta algorithm that ejeffrey mentioned, but I think this can also be looked at mathematically.

Suppose I have a 24 bit value that I want to output over an 8 bit analog channel. I can break the 24 bit word into three 8 bit bytes, the most significant (MSB), intermediate (ISB), and lowest (LSB). To get the required interpolated result I have to output the MSB 65536 times per cycle (giving it a "weight" 2^16 times greater than the LSB), the ISB 256 times per cycle, and the LSB once per cycle. The total cycle length at 32 kHz is then about 2 seconds, meaning I need a low pass filter that rolls off everything above 0.5 Hz in order to recover the average steady value.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 24, 2012, 10:08:04 pm
It is a first order sigma-delta loop implemented in software.

Wow! I have a fancy name for what I am doing now. Thanks for the explanation.

Just so you know why I want the resolution. I have a Fluke 540A AC transfer calibration unit. You can use this to measure AC RMS values to 0.01%. It does this by thermally comparing the heat generated by the AC with the heat generated by an equivalent DC voltage. One of the things you need is a DC supply that can output over 10mA and can be adjusted to within 5uV for the lowest range of the 540A. A bit of ripple or noise down at 5uV does not matter and I can let the supply stabilize for an hour to reduce the opamp drift.

I currently do not have a supply that can do the job, so I hope this design will be good enough.

Old linear supplies with the potentiometers just cannot be adjusted with enough accuracy. The pots get noisy with age as well. With many digital supplies, you are lucky to be able to adjust to better then 1mV.

I could go all out and use auto-zero opamps, expensive references and thick film divider networks to make a variable voltage source that is inherently stable, but I would end up with something expensive and not generally useful. I actually like the LM324 with its weird 30V base breakdown voltage input transistors

Richard.
Title: Re: General Purpose Power Supply Design
Post by: Bored@Work on March 24, 2012, 10:17:38 pm
just want to say I'm your backer here.

You can back him as much as you like. Even with only 20 bits he is playing in 1ppm territory. A 1ppm/°C voltage reference is affordable these days. But with a 1ppm/1°C reference a 1°C temperature change in the case already ruins his LSB. Better, and you start to pay $50 or $100 just for the reference.

And then there is the long-term drift of the reference. Maybe 10ppm/1000h for an affordable reference. Here goes another digit.

Oh, and don't forget the load regulation of the reference. He needs to power the whole micro with that reference, and the micro's current consumption varies. But well, the reference might anyhow not be capable of supplying the micro. So it needs to be used as part of a voltage regulator. The whole voltage regulator needs to be ultra stable. Good luck building that.

The micro itself might also have a few nasty surprises up it's sleeve. E.g. there is no guarantee that the high and low output levels don't vary a little bit, depending on other active pins, active periphery, temperature and whatnot.

And until now we have just looked at the voltage reference and the micro. We haven't looked at the RC filter, the following buffer OpAmp, the power stage and whatever else is there. There is still a long way to got until to get that 1ppm voltage to the load.

In short, don't hold your breath.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 24, 2012, 10:49:40 pm
The total cycle length at 32 kHz is then about 2 seconds, meaning I need a low pass filter that rolls off everything above 0.5 Hz in order to recover the average steady value.

You have that exactly right. I think that is too slow for a supply, so I will loose a few bits of filtering and use a faster filter. I have gone for 0.2 seconds to settle within 1mV for a 2V step change. The result is I will add some extra ripple - something like 140uV peak to peak and less then 10uV RMS ripple for a 25V supply. Increasing the RC filter stages from 3 to 6 and I can reduce the peak to peak ripple to about 20uV. Slowing the settling time to around 0.5 seconds with a 3 stage filter also will get you 20uV peak-to-peak noise.  For a lower voltage supply, the noise will scale down proportionally. This kind of ripple does not affect a precision DC voltmeter as you can set it to read over 100 mains cycles and it will average out this noise, and it would not affect my use with a Fluke 540A.

I may be able to come up with a method of correction that goes for slightly less resolution, but has less low frequency components. That is for the future.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 24, 2012, 11:00:07 pm
just want to say I'm your backer here.

You can back him as much as you like. Even with only 20 bits he is playing in 1ppm territory. A 1ppm/°C voltage reference is affordable these days. But with a 1ppm/1°C reference a 1°C temperature change in the case already ruins his LSB. Better, and you start to pay $50 or $100 just for the reference.

And then there is the long-term drift of the reference. Maybe 10ppm/1000h for an affordable reference. Here goes another digit.

Oh, and don't forget the load regulation of the reference. He needs to power the whole micro with that reference, and the micro's current consumption varies. But well, the reference might anyhow not be capable of supplying the micro. So it needs to be used as part of a voltage regulator. The whole voltage regulator needs to be ultra stable. Good luck building that.

The micro itself might also have a few nasty surprises up it's sleeve. E.g. there is no guarantee that the high and low output levels don't vary a little bit, depending on other active pins, active periphery, temperature and whatnot.

And until now we have just looked at the voltage reference and the micro. We haven't looked at the RC filter, the following buffer OpAmp, the power stage and whatever else is there. There is still a long way to got until to get that 1ppm voltage to the load.

In short, don't hold your breath.
You are missing the point. I don't want great accuracy, and I have already discussed the issue with the micro output problems. 0.1% stability for accuracy after calibration would be absolutely great but I can live with less.  All I want is resolution with no evident digitizing steps on the output.

I definitely wouldn't use the output straight out of the micro - it has to come out via a high speed cmos digital IC powered by a voltage reference, and I  as mentioned above, I can pick a synchronous register for my cmos IC to reconstruct the PWM timing if the micro timing is irregular.

All the problems have been taken care of, so you can breath again.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: markus_b on March 25, 2012, 10:31:34 am
This kind of ripple does not affect a precision DC voltmeter as you can set it to read over 100 mains cycles and it will average out this noise, and it would not affect my use with a Fluke 540A.
Richard, this is all very good and is what you need for your Fluke 540A. But this is far from the 'General Purpose Power Supply Design' I came here to discuss. It may well be that the power stage can used for both, so I'm hanging in here :-).
Title: Re: General Purpose Power Supply Design
Post by: SeanB on March 25, 2012, 10:57:52 am
An easy way to get the voltage stable is to only power the actual PWM output from a stable reference, by using a 4050 buffer fed from the reference. Will handle the pwm, and will provide isolation. You will need to have a 5V micro and a 5V reference. If you use a single transistor inverter to do level conversion you can run the 4050 off a 10V reference to get a larger output, and make small voltage drops less important.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 25, 2012, 11:49:48 am
This kind of ripple does not affect a precision DC voltmeter as you can set it to read over 100 mains cycles and it will average out this noise, and it would not affect my use with a Fluke 540A.
Richard, this is all very good and is what you need for your Fluke 540A. But this is far from the 'General Purpose Power Supply Design' I came here to discuss. It may well be that the power stage can used for both, so I'm hanging in here :-).

By general purpose, I mean I am trying to make it useful to as many applications as I can. If I have a supply that outputs in almost 1mv steps but not quite, I will make the supply useless for anyone who wants to be able to do what they could do with their old Course/Fine adjust analog power supply. And remember, the PWM solution will be cheaper then D/A converters, and it gives me up to four D/A outputs. Obviously I need voltage and current outputs. There are possibilities for the other two.

 I have to apologize as I am just putting a picture together in my head about where this could go, and I think my project will end up looking very different from Dave's, which is a good thing I think. I have a few surprises of my own, but my basic regulator board should be able to provide 0 to 24V at 1A  with no heatsink. It will have a linear regulator output with a switching pre-regulator of some kind. That is what I am working on now.

I am concerned about switching noise getting to the outputs, but if I can get a pretty clean switching supply going, then I have some surprises of my own. That is one area that I will have to wait for a bench test.

Running off a battery is definitely  possibility, but it is not a focus of my design. It may be an option on the final package, and anyone could just use the board with a battery in their own package. The control panel is a separate module again for reasons that will become clear. Lets just say that like Dave, I want to come up with a package that does not exist right now, but its new features go in a totally different direction to Dave's supply.

One thing though. I am really starting to appreciate how much work Dave has put into his design.

Richard.



Title: Re: General Purpose Power Supply Design
Post by: amspire on March 25, 2012, 12:03:49 pm
An easy way to get the voltage stable is to only power the actual PWM output from a stable reference, by using a 4050 buffer fed from the reference. Will handle the pwm, and will provide isolation. You will need to have a 5V micro and a 5V reference. If you use a single transistor inverter to do level conversion you can run the 4050 off a 10V reference to get a larger output, and make small voltage drops less important.

I love the old 4000 series CMOS, but the speed is too high. The clock to the PWM is at 16MHz and I need very clean switching waveforms at that frequency.  It doesn't matter though as I can use a high speed CMOS family, like the 74HC family. I can get all the stability I need from a lower voltage supply I believe.

It is possible I will have a 2.7V microprocessor and and a 2V reference, but right now, the need for low voltages is fading away. There are fast cmos buffer chips for the PWM output that can work at 2V, and their inputs can connect to 2.7V without buffers. Even a 2V reference is absolutely fine.

Richard.

Title: Re: General Purpose Power Supply Design
Post by: alm on March 25, 2012, 12:16:49 pm
I have to apologize as I am just putting a picture together in my head about where this could go, and I think my project will end up looking very different from Dave's, which is a good thing I think. I have a few surprises of my own, but my basic regulator board should be able to provide 0 to 24V at 1A  with no heatsink. It will have a linear regulator output with a switching pre-regulator of some kind. That is what I am working on now.
Feel free to change your mind as often as you want, you're doing 99.9% of the work, so you get to decide.

I love the old 4000 series CMOS, but the speed is too high. The clock to the PWM is at 16MHz and I need very clean switching waveforms at that frequency.
Doesn't clean, fast switching also imply additional HF noise you have to get rid off? Or do you expect the low-pass filter to have enough attenuation to deal with this? I can see that fast edges are critical to the linearity, although I guess you could correct for this in software.

I really like your idea of shooting for similar resolution to the old analog coarse/fine (or multi-turn) pot. These supplies have a lousy accuracy and tempco, but the good ones have no problems with sub-mV settability, and tend to be quite stable once they're warmed up.
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on March 25, 2012, 12:36:23 pm
Firstly, I would like to thank you both, Richard and AcHmed99, for your interesting exchange of views.

Richard, I would never think of expanding the 256-bit PWM AVR modules because of the dramatically reduced speed of the extended PWM cycles. In the past I had thought to combine (to scale and add the outputs of) the 16-bit hardware PWM module output with the 8-bit one to create a faster 24-bit PWM module; but the 8/16 MHz driven 16-bit PWM cycle was already slow enough for such tasks and this topology would require one AVR device per PWM module.

Now, thanks to your previous idea I was inspired to give it a try, using the AVR tiny261/461/861 or the tiny25/45/85 that have a PLL driven timer-counter clock up to 64 MHz, which speeds up dramatically the 16/24-bit software extended PWM modules. Since I do not use the Arduino platform I do not know how efficient code your example can produce. So, I wrote the TIM1_COMPA/B/D ISR in assembly from scratch, and the results are very promising: Only 52 CPU cycles (including the call and return) for the 24-bit sigma-delta loop! Mind you that I have not even simulated it but I do not think that there are any errors or omissions; anyway, here it is:

Code: [Select]
; This is the ATtiny861 PWM Timer1 Compare-A/B/D ISR handler (in Fast PWM Mode), where:
; * Vlt_Out: 24-bit PWM target output value, in 3 SRAM consecutive bytes, MSB first
; * Vlt_Err: 24-bit PWM error accumulator, in 3 SRAM consecutive bytes, MSB first
; * OCR1C holds the Timer1 TOP value, which must be set equal to 0xFF
; * TC1H (the 10-bit Timer1 high byte) is set equal to 0x00; or else set it to zero before the update of OCR1x
; For the Current reference output 24-bit PWM ISR there will be needed another similar set of 3+3 SRAM
;  registers, the Amp_Out and Amp_Err for the second PWM Timer1 Compare-A/B/D ISR handler
; The registers A0..A3 can be any high or low registers of the AVR register-file

push A0 ; [+3c]
push A1 ; Temps: A3:A0 (Non-destructive)
push A2
push A3
in A3,SREG
push A3 ; [14c]
; A2:A0 = Vlt_Err
lds A0,Vlt_Err+2 ; Load A the PWM error accumulator
lds A1,Vlt_Err+1
lds A2,Vlt_Err+0 ; [20c]
; --Magic part #1:
out OCR1A,A2 ; Send the top byte of the PWM error accumulator to the PWM for the next cycle
; --Magic part #2:
sub A2,A2 ; Subtract the byte sent to the PWM from the top byte of the PWM error accumulator
; --Magic part #3:
lds A3,Vlt_Out+2 ; Add the target output value to the error accumulator remainder
add A0,A3
lds A3,Vlt_Out+1
adc A1,A3
lds A3,Vlt_Out+0
adc A2,A3 ; [31c]
; Vlt_Err = A2:A0
sts Vlt_Out+2,A0 ; Save the PWM error accumulator
sts Vlt_Out+1,A1
sts Vlt_Out+0,A2 ; [37c]
; Done
pop A3
out SREG,A3
pop A3
pop A2
pop A1
pop A0 ; [48c]
reti ; [52c] (= 6.50µs @ 8 MHz)

Feel free to try that piece of code and/or to optimise it further, since I wrote it in such a way in order to be easily readable and not speed or code optimised. Finally, the AVR PWM output can easily drive 1.2V-5.0V powered buffers of the 74LVXxx or similar logic family that have 5V tolerant inputs.


-George


<EDIT> Minor code and comments corrections... ToldYa! :P
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 25, 2012, 02:22:15 pm
George, this is brilliant.

I did mention that the control panel is a different module.

What I didn't say is that for reasons to become evident, the regulator module has to be isolated from the control panel electrically. This means that if I want the control panel option, I need another small dedicated micro on the regulator board doing the basic stiff like the PWM.

Also I was looking how to get about a fourfold improvement just to get the PWM noise below 10 uV.

I think you may have solved the problem.

Had a look at your code and it looks right.
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on March 25, 2012, 03:04:50 pm
Thank you, Richard.

I think that isolation could introduce excessive jitter if not implemented carefully. But I cannot see any problems in using the micro as a dedicated DAC itself, directly producing the reference voltage only, and doing nothing else, while communicating with the control via its fast SPI hardware module as a slave, using isolation. This makes the low power, wide supply voltage range, 8-pin tiny45 become very attractive as a near-ideal DAC with better linearity that any other very expensive <1 LSB INL dedicated DAC.

The only drawback I can see in this topology is the unavoidable introduction of glitches at the output under certain circumstances, where the diff error value loaded at the compare-match registers needs less CPU cycles to complete that the CPU cycles required by the ISR itself. Or glitches, again, when the asynchronous and faster PLL clock finishes before the ISR does. Of course, the OCR1x loading can be moved at the beginning of the ISR (right after pushing the first temp and reading the loaded value) to speed up things a little. But I do not think that there can be any substantial speed code optimizations, since the posted code above is already quite fast. The ISR code can become a little faster if both the 16/24/32-bit variables are loaded not to the SRAM but directly to the 32-byte register-file, which can be more than twice as fast as the SRAM in access time.


-George
Title: Re: General Purpose Power Supply Design
Post by: Bored@Work on March 25, 2012, 03:24:17 pm
This makes the low power, wide supply voltage range, 8-pin tiny45 become very attractive as a near-ideal DAC with better linearity that any other very expensive <1 LSB INL dedicated DAC.

Only in your dreams.
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on March 25, 2012, 03:49:52 pm
Yes, though I have not given it a try yet, I also believe that it will be quite noisy, even as a 16-bit DAC.
However, given the insignificant cost and the simplicity of the design, I think it is worth spending some time to test how exactly it behaves.


-George
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 25, 2012, 04:50:35 pm
I have to add an offset to the buffer output amp anyway, because if the tiny PWM is like the Arduino PWM, it doesn't go to 0V.

However, I can see one problem with the tiny. If the PWM is at 64 MHz, and the micro runs at 8MHz, the interrupt takes longer then the PWM cycle. Is there a single 64 bit PWM we can use for the voltage?

I can think of ways we can still use 8 bit PWM at a least resolution for the current limit.

Otherwise there is an already at strategy that works almost as well. You move your code to a timer interrupt - say a 50us interrupt. It calculate the correction based on a PWM cycle count register and puts the PWM preset into a register.

All the PWM    interrupt does is this. If the preset register is non-zero, it loads it into the PWM, zeros the preset register and sets the cycle count register to one. Otherwise it increments the cycle count  register and returns.
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on March 25, 2012, 10:23:37 pm
Why does the Arduino PWM output not go down to ground? The AVR has true complementary outputs with Rdson 24 ohm at Vdd 5V at room temperature, for both the high and the low output stages. Maybe something is interfering with the PWM out pin or its pull-up feature? Does that pin remain an output even for zero input at the OCRx register? I am nor familiar with the Arduino platform but the m168/m328 are reliable chips. A tiny861 10-bit pure hardware PWM test circuit I had recently implemented was going perfectly down to 0.00V for 0x000 PWM input and had a surprising good linearity. See the t85 and t861[A][P] (go for the [P]ico-Power version) data sheets (http://www.atmel.com/products/microcontrollers/avr/tinyavr.aspx) (Yes, I know, they made their site worse than their AVR Studio 5).

The ATtiny 64/32 MHz PLL clock has a programmable prescaler that outputs the following frequencies: PCK/1, PCK/2, PCK/4, ..., PCK/16384. No need to run the timer at full speed. If, for example the ISR is 52 CPU cycles long, that is 6.50µs @ 8 MHz, 3.25µs @ 16 MHz, 1.625µs @ 32 MHz or 812.5ns @ 64 MHz. You choose the best clock speed in order to have a PWM cycle of at least one and a half ISR's time, to adjust the OCR1x safely. In the paradigm demonstrated above, the time ratio at 8MHz is 1:5, so the timer's clock frequency can safely be raised two times up.

In order to minimise power consumption, you can run only the PWM module with the idle sleep enabled. There is no need to do calculations with such tight code execution. Just implement a simple software SPI with three of the remaining pins that only receives 16/24-bit full length words and updates the PWM unit.


-George
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 25, 2012, 10:35:13 pm
Obviously the ATtiny PWM is butter designed then the Arduino processor. For a PWM value of 0, the Arduino puts out a single clock width pulse.

The thimg with the prescaling is I want to  run the PWM at 64 MHz.  :)

Anything less and I do get a detectable noise on the output.

I will take a look at  ATtiny specs today.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on March 25, 2012, 10:54:42 pm
The ATtiny line actually is a stripped down ATmega implementation; for example, the tinies do not have a hardware multiplier or USARTs. Both of these lines are of the same material, with a few special exceptions that have additional LCD/CAN/USB/PLL/etc. support. By the way, the tiny861 10-bit PWM test circuit I wrote about above was constructed on a breadboard! So, if something was nor working as expected, like what you reported, I would rather be suspicious of the "sketch"/"shield" software/hardware platform than the AVR chip itself.


-George
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 25, 2012, 11:57:59 pm
Just started having a look at the ATtiny data sheet. They give you one or two options don't they.  :o

I have the suspicion that the Fast PWM mode which is the one I used might work the same as the Atmega in that the match is acted on in the following cycle, so if the register has 0 in it, it will only clear the output on the second clock. But they data sheet didn't explain it as clearly as the Atmega, so I will have to actually read it.

But there is good news. I did some testing and the correction calculations can be slowed down to as much as once per millisecond and the results form the filter are still beautiful. The code that would run at the PWM interrupt is probably well under 10 clock cycles.  I have the idea in my mind and so I will put up some code/pseudo code today.

There is actually no advantage at all in doing the correction per PWM cycle at all is seems. This is great as it means even if there is a PWM update issue, only a tiny number of PWM cycles could be effected. Correcting at a 1KHz rate produces in effect a 1KHz square wave with an amplitude of 1mV or less, and my 3 stage 10k/0.1uF filter reduces the amplitude of that to below 1uV. Perfect!

Is there a way to stop any other interrupts occurring during the processing of the PWM interrupt?

Richard.

Title: Re: General Purpose Power Supply Design
Post by: fmaimon on March 26, 2012, 12:09:58 am
All interrupts are disabled during the ISR. The only way another interrupt can occur during an ISR is by enabling the interrupts inside the ISR. The interrupts are re-enabled after reti.
Title: Re: General Purpose Power Supply Design
Post by: IanB on March 26, 2012, 01:05:33 am
All interrupts are disabled during the ISR. The only way another interrupt can occur during an ISR is by enabling the interrupts inside the ISR. The interrupts are re-enabled after reti.

Is there any concept of interrupt priorities on the AVR chips?
Title: Re: General Purpose Power Supply Design
Post by: TerminalJack505 on March 26, 2012, 01:14:21 am
Quote
Is there any concept of interrupt priorities on the AVR chips?

An interrupt's priority is determined by its position in the interrupt vector table.  Interrupts with lower addresses have higher priority.
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on March 26, 2012, 03:40:01 am
Complementing on TerminalJack505, only xMegas have a real interrupt priority scheme.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 26, 2012, 05:57:46 am
If anyone understands the Atmel family, how are 32 "General Purpose Registers" ( addresses 0x00 to 0x1F including the X, Y and Z registers) accessed separately from the thing Atmel calls the "Registers" in the data sheet - the 48 byte locations where all the configuration, ports, ADC outputs, Timers, etc are located. They are located in addresses 0x00 to 0x3F.

Are the "General Purpose Registers" the things called "Registers" in the assembler, and the "Registers" the thing called "Ports" in the assembler?

Richard.
Title: Re: General Purpose Power Supply Design
Post by: IanB on March 26, 2012, 06:36:41 am
Most likely so. I understand the AVR is a RISC architecture, so the 32 general purpose registers would be typical of that kind of architecture and intended for use by programs. The "other" registers are probably what would be called control registers in general processor terminology.
Title: Re: General Purpose Power Supply Design
Post by: TerminalJack505 on March 26, 2012, 06:46:42 am
If anyone understands the Atmel family, how are 32 "General Purpose Registers" ( addresses 0x00 to 0x1F including the X, Y and Z registers) accessed separately from the thing Atmel calls the "Registers" in the data sheet - the 48 byte locations where all the configuration, ports, ADC outputs, Timers, etc are located. They are located in addresses 0x00 to 0x3F.

Are the "General Purpose Registers" the things called "Registers" in the assembler, and the "Registers" the thing called "Ports" in the assembler?

Richard.

It's confusing but once you realize that the CPU has several different address spaces (aka addressing modes) it will make sense.  They did this so that they could reduce the size of the CPU instructions by cramming the 'addresses' into the op code.  The general registers (aka register file) and the ports (aka I/O registers) seem to have overlapping addresses but don't since they live in separate address spaces.  For convenience, they are mapped into data space (SRAM) which means they may have a different address in that space than they do in their normal address space.   

The ports (I/O registers) can be accessed either from the SRAM memory space or via special CPU instructions.  When accessed from the SRAM memory space they will have 0x20 added to the 'address' (the register file is mapped into the first 32 bytes of data memory.)  The I/O register 'address' is used as-is with the special instructions--such as CBI, SBI, etc.

Check out the first couple of pages of the AVR Instructions Set PDF:

http://www.atmel.com/Images/doc0856.pdf (http://www.atmel.com/Images/doc0856.pdf)

It explains the different data addressing modes.
Title: Re: General Purpose Power Supply Design
Post by: Alex_arg on March 26, 2012, 03:47:32 pm
Hi amspire , i've been following Dave's PSU design and got the same idea, because i'm not very handy with microcontrollers , but i didn't find the time to try to make it "analog". The switching pre-regulator it's a great idea, but i
was stuck trying to find a simple way to control both regulators from an unique Vset potentiometer.
By the way i've got a cup of questions :
how you make this regulator go down to 0Volts?  negative control voltage ?

Are you aiming to make it portable? No sophisticated batteries in this zone, but i was thinking to use a 12V 7A bat to make it work (those from alarm systems) and a suitable charger.

Greetings
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on March 26, 2012, 04:57:19 pm
Richard, the AVR "32 general purpose registers" is the processor's Register-File, i.e. the special SRAM registers the ALU has direct access to. It is what the older 8051 and the PIC architectures call the Accumulator/Working Register, with the difference that in the AVR it is not a single register but a whole set of 32 registers. You can see that this is the same approach of the MSP and the ARM, for example, family processors that have a register file of 16 uniform registers. In the AVR, everything beyond the Register-File and before the SRAM space is called I/O space and is used to be accessing the microcontroller's peripherals.

The AVR Register-File is not a uniform one. It consists of the low (r0..r15) and the high (r16..r31) registers. The low registers cannot handle immediate values; the high registers can. The first bottom register pair (r1:r0) is also used for the storage of the hardware multiplier 16-bit product. The four top register pairs (r25:r24, r27:r26 or XH:XL or X, r29:r28 or YH:YL or Y, and r31:r30 or ZH:ZL or Z) have 16-bit addressing capability for the 16-bit ADIW and SBIW math instructions. The three top register pairs (X, Y and Z) can be used for indirect addressing of the whole SRAM/EEPROM spaces and the top register pair (Z) can also be used for the indirect access of the FLASH memory space.

Why is the large Register-File important is obvious, since it eliminates the need to be constantly accessing the SRAM space in order, for example, to deal with multi-byte figures, since almost every instruction that accesses the register file takes one CPU cycle only, while the direct access of the SRAM registers takes two.


I hope this helps,
-George
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on March 26, 2012, 07:05:13 pm
Richard, in order to realise the benefits of a large Register-File, I took the time to rewrite the TIM1_COMPA/B/D ISR I posted previously (https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/msg100107/#msg100107), using exclusively registers of the AVR Register-File. Please, notice that this is a real world example and not an Academic demonstration of the AVR capabilities.

Code: [Select]
; This is the ATtiny861 PWM Timer1 Compare-A ISR handler (in Fast PWM Mode), where:
; * r2:r0: 24-bit PWM target output value, MSB first
; * r5:r3: 24-bit PWM error accumulator, MSB first
; * r15: Used as a temp to preserve the Status Register
; * OCR1C holds the Timer1 TOP value, which must be set equal to 0xFF
; * TC1H (the 10-bit Timer1 high byte) is set equal to 0x00; or else set it to zero before the update of OCR1x
; For the Current reference output 24-bit PWM ISR there will be needed another similar set of 3+3 registers
;  for the second PWM Timer1 Compare-B/D ISR handler, while r15 can be reused for the same task.

in r15,SREG ; [+3c] Preserving the CPU Status Register
; --Magic part #1:
out OCR1A,r5 ; [5c] Send the top byte of the PWM error accumulator to the PWM for the next cycle
; --Magic part #2:
sub r5,r5 ; [6c] Subtract the byte sent to the PWM from the top byte of the PWM error accumulator
; --Magic part #3:
add r3,r0 ; [7c] Add the target output value to the error accumulator remainder
adc r4,r1
adc r5,r2 ; [9c]
; Done
out SREG,r15 ; [10c] Restore the Status Register
reti ; [15c] (= 1.875µs @ 8 MHz)

You can see that the same function has now become three and a half times faster than in the previous implementation! Using the same CPU and Timer1 clock frequency of 8 MHz, it now takes only 1.875µs for the ISR to complete against the 6.50µs previously needed! The obvious penalty is the loss of the registers r5:r0 and r15, that cannot be used anymore for anything else; but this is not really an issue because the processor has 25 general purpose registers left to use for other possible tasks! Isn't AVR a lovely chip?


-George



<EDIT>: Last minute corrections and clarifications...
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 26, 2012, 07:14:10 pm
Thanks for the explanation George. What  I found incredible is that the data sheets do not explain this well at all. No nice memory mapping diagram. It has a command summary full of letters like k, P, Rr, etc but they don't explain what the letters are.

There is probably a document somewhere that does explain this, but finding that document is not easy.
I have never touched Atmel assembler before and struggling with the data sheet was just odd. I was thinking there has to be general purpose registers, but where?  They are not in the "Register Summary". They are not in the Memory  section of the datasheet. Older processors like the 8051 used to explain all this extremely carefully, but Atmel can't be bothered.

In your first code, you use A1, A2, etc.  Other code uses R1, R2, etc. I assume they are the same?

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 26, 2012, 07:58:10 pm
Hi amspire , i've been following Dave's PSU design and got the same idea, because i'm not very handy with microcontrollers , but i didn't find the time to try to make it "analog". The switching pre-regulator it's a great idea, but i
was stuck trying to find a simple way to control both regulators from an unique Vset potentiometer.

The heart of this design is a very cheap board that can be controlled totally from potentiometers if you do not want to use microprocessors. I am making sure that none of the functionality is affected if you leave out the micro. I know that trying to get a micro programmed when you are not set up for it is not fun.
Quote

By the way i've got a cup of questions :
how you make this regulator go down to 0Volts?  negative control voltage ?
There are two parts to this. First getting 0 volts out is easy -if you reduce the current you are supplying down to zero, you have zero volts out.

Secondly is how you actually regulate down to zero volts.

The LM324 opamp inputs can actually work to a little below the negative supply rail. They do this with a clever design using PNP input transistors. A PNP transistor can still be working with the base at -0.1 volts and the collector between zero volts and +0.5 volts.
Quote
Are you aiming to make it portable?
If you put the board in your own box, it can be portable.  It will run of a 12 battery perfectly, but you would have to add a charger. The control panel version may end up being not portable, but I have other issues to work out before I get serious with the packaging.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on March 26, 2012, 08:06:05 pm
Richard, in the AVR assembler you can assign label names for everything. The original names of the Register-File members are r0, r1, r2, ..., r30 and r31. Since I almost always have to deal with 32-bit or longer figures, I usually rename sets of consecutive registers in order for the code to be easily readable. Regarding the A0, A1, etc. nomenclature I used previously, I just offered the convenience of using any registers available, as I explained it at the header.

In the assembler you can directly use the name "r15" or "R15" to access r15; but since, for example, I usually have a null value register (always loaded with the constant 0x00) I prefer to call it "Zero" instead of r15. Or "tmp1" and "tmp2" instead of "r16" and "r17." Specifically, I usually call A3:A0 the registers r21:r18, B3:B0 the registers r25:r21, etc. But this is only me! There are not any global rules that work for everyone; you just pick a style you are comfortable with and works for you.


-George



<EDIT>
Edited to say that I rather prefer to work with the "mature" AVR Studio 4, which can be found here (http://www.atmel.no/beta_ware/) (v4.19.720), that with that ugly creature they call AVR Studio 5...
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 26, 2012, 08:55:30 pm
George, your latest code is probably useable, so I think I will drop my more complicated solution. We can get two PWMs going with a 32MHz clock. I probably need the option of running at 2.7 volts anyway.

I gather that any other interrupt routines will have to reenable the PWM interrupts as the first command.
Any further PWM outputs still just have to be plain 10 bit PWM.

If it is any use, there probably are some I/O registers we can pinch for other duties. I doubt I will be using the timer0 PWM registers or the dead time register.

Richard

Edit: I am happy loosing some general purpose registers to improve the interrupt speed. The micro will not have a lot of tasks to do.
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on March 26, 2012, 10:34:17 pm
Well, these are a few quick thoughts:

According to the data sheets, at 2.7V both the t85 and the t861 can run at 10 MHz CPU clock frequency and their high-speed timers at 64 MHz. Since the t861 has a three-channel 10-bit hardware fast PWM stage and t85 has a two-channel 8-bit one, this rules out the use of the latter chip. What worries me is the unavoidable noise induced by the CPU/Timer digital stages transitions and the jitter of the RC/PLL clock generators that affects the output linearity. I am afraid that I am not even sure if a decent 16-bit linear output is feasible, where 1 LSB = 41.20µV; this is getting much worse for a 24-bit solution, where 1 LSB = 160.9nV...

Now, the AVR can execute nested subroutines on demand (by the manual enable of the global interrupts flag within the Status Register, at some point within an ISR) but why do that? The idea is to finish the critical ISR code execution as soon as possible and not to extend it any further. But this can be arranged in favour of preventing output glitches in the case of an interrupt firing while another ISR is executed.

After booting up, the firmware initialises the hardware modules and their variables, it starts the PWM modules, enables the global interrupts and enters the main, where it does nothing else than sleeping to reduce power consumption while waiting to receive from the serial line any further commands and/or new values for the PWM modules. The SPI protocol seems to be better for synchronization purposes, since the CPU workload is not negligible in this application.

The latest ISR code above will need 1.875µs for the completion of the extended PWM ISR, which means that 256 timer steps (a complete hardware PWM cycle) should not take less time than that figure, which implies that the PWM clock tick should be no less than 7.32 ns or its frequency be no more than 136 MHz. So, we are good running the PWM timer at full speed. These figures even allow us to add a second extended PWM ISR if we reduce the PWM speed in half.


-George
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 26, 2012, 11:01:26 pm
The other thing is if we move to 10 bit, we get a time gain of four, so even though there will be some extra code, it is probably OK.  I will take a look at the PLL stability spec, but with al the filtering, it will probably be OK in the end.

Linearity really isn't a concern, as the truth is every time someone wants a really accurate output, they will use a multimeter. 1% accuracy is all you need for general use, and I am sure we can do better then that. We should get a monotonic output though which is my no.1 demand.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: hlavac on March 26, 2012, 11:06:44 pm
Guys, why do you concern yourself about the ISR length? The 64MHz is PWM CLOCK, not PWM frequency, that will be 256 times less for 8-bit PWM, or 250kHz. Plenty of CPU cycles - you can run CPU at 16MHz (Pclk/4), thats 64 CPU cycles per one PWM cycle/interrupt, more than enough...
And as for the supposed glitches, the PWM registers are double buffered to avoid just that (i.e. whatever you write will affect the next cycle, not current cycle).
At least for the ATtinys I'm familiar with...
I would keep the PWM stuff in interrupt as is and do the SPI reading/target value setting in main loop via polling, no need of nasty interrupt nesting.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 27, 2012, 12:01:42 am
Guys, why do you concern yourself about the ISR length? The 64MHz is PWM CLOCK, not PWM frequency, that will be 256 times less for 8-bit PWM, or 250kHz. Plenty of CPU cycles - you can run CPU at 16MHz (Pclk/4), thats 64 CPU cycles per one PWM cycle/interrupt, more than enough...

And as for the supposed glitches, the PWM registers are double buffered to avoid just that (i.e. whatever you write will affect the next cycle, not current cycle).
We have been working with these numbers. We need two PWM's and that is when it gets very tight. About the glitches, there things that we have to watch out for. For example, triggering off a match means the code can run before the next match. However, it may not complete before the next PWM cycle starts, and so double buffering means that the new value does not get run till the cycle after.

Probably triggering of the end of the PWM is best. That means the one interrupt will process both PWM's at the same time, and that saves a few cycles as well.

Quote
At least for the ATtinys I'm familiar with...
I would keep the PWM stuff in interrupt as is and do the SPI reading/target value setting in main loop via polling, no need of nasty interrupt nesting.
That sound like a good plan. The micro really does not have much to do.

Richard
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on March 27, 2012, 12:33:59 am
Richard, moving to a 10-bit PWM is even easier: You just set the module up once and you literally forget about it because everything happens in hardware with absolutely no CPU intervention! The t861 Timer1 has a three-channel 10-bit hardware fast PWM stage that needs no maintenance at all after having it initially set up. You only have to modify a couple of registers (TC1H:OCR1x) in order to change its output.

Speaking of the PWM output, it is monotonic by principle: There are no magic value quantities to be added to/subtracted from, that must be exactly equal to the next_value - 1 LSB to the previous_value + 1 LSB; and the length of the output pulse is directly proportional to the OCRx input value, which is a promise for good linearity. There are not any "missing codes" in this topology. But I do not know what happens in these expanded PWM cycles, where the target RMS output is produced by non symmetrical pulse trains.


hlavac, there is a concern of the ISR code length because the CPU runs at 8 MHz and the ISR at 250 KHz (= 64MHz / 256), which leaves a 4 µs time window for the ISR code to do its magic. In 4 µs time, the CPU has 32 machine cycles (which is 32 CPU clock cycles for the AVR) to do what it needs to be done, while the code above (which I do not consider to be final) takes 15 of them for every extended PWM channel. Yes, this is not a tight situation exactly but the previous implementation of that ISR needed 52 cycles and could not be run at that high speeds that do not require heavy output filtering and are faster in response. Neither would I like to raise the CPU frequency to 16 MHz because the current consumption would almost be doubled and the AVR needs to be powered by an accurate source that usually does not (and should not) deliver much power. We agree, though, in the polling SPI implementation, especially since the tinies do not have a dedicated SPI controller as the megas do.


-George
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on March 27, 2012, 05:49:58 am
Since we got into the business of counting cycles, I discovered a few mistakes in my calculations above.

The ISR execution response time is not 3 (this is for a subroutine call) but 4 CPU cycles plus another 4c if this occurs while the AVR is in sleep mode. This makes the time duration of the ISR above to be not 15 cycles but 16c. Now, the worst case scenario is both the ISRs to fire simultaneously while:
1. The AVR is in sleep mode. This extends the 16c time by 4 more cycles.
2. The AVR executes a multi-cycle instruction (a 4 cycles "return," in the worst case), where that instruction will be completely executed before the pending interrupt is served. This extends the 16c time by 4 more cycles.
Notice that when the AVR exits from an ISR, it will always return to the main program and execute one more instruction before any pending interrupt is served.

Under these conditions, the total time needed for both the ISRs to finish will be 4c+16c+4c+16c = 40 CPU cycles plus 1c uncertainty due to the asynchronous nature of the high speed PLL clock. This requires the complete hardware PWM cycle (not the extended one) of 256 timer steps to be taking no less than 41 CPU cycles or, given that the CPU clock is 8 MHz, no less than 41*125ns = 5.125 µs, which is translated into a PLL clock speed of less than 49.9 MHz. The next acceptable PLL clock frequency is 32 MHz, which results in an 8.0 µs 8-bit hardware PWM cycle, in a 2.048 ms 16-bit extended PWM cycle and in a 524.288 ms 24-bit extended PWM extended cycle. This will need some serious filtering...

I think that the most viable option will be a dual 16-bit PWM with low pass filters of a couple of hundred milliseconds settling time to filter out the 2 ms PWM cycle irregularities.


-George



<EDIT>

Since the t861 Timer1 has a 10-bit hardware PWM, a 32 MHz clock will result in:
1. Setting the Timer1 TOP count to 511 (i.e. 9-bit PWM resolution) results in a 16.00 µs 9-bit hardware PWM cycle and in a 8.19 ms 18-bit extended PWM cycle.
2. Setting the Timer1 TOP count to 1023 (i.e. 10-bit PWM resolution) results in a 32.00 µs 10-bit hardware PWM cycle and in a 32.77 ms 20-bit extended PWM cycle.

After all, this set up does not sound to be that bad...
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 27, 2012, 12:34:24 pm
I suspect the filtering at 32MHz with a 3 stage RC filter is much better then you are expecting. I will definitely give it a go, but I will not return to 16 bit PWM.  Just not good enough.

I might have to do a properly designed filter to get a bit more from the 32 MHz then the very basic RC filters can do. I am sure we can make it work. George, I am totally grateful at all your help so far. It is this kind of detail that takes more time then you think.

Right now I am working to see if it is possible to add a switching pre-converter without making the supply too noisy. If you attach a scope to a circuit under test and see switching noise, it is just not going to work. If I can get the switching supply to work, I totally solve heat issues, allow the supply to run from a huge range of voltages, and I get isolation from the supplies (it is a transformer based switching supply).

I am going to put together a test supply tonight and tomorrow to at least check my choice of a particular toroid can work over the range at full power, but I am sure I will have to do some more design work on the transformer to keep the noise away from the secondary.

Again, I am looking at economy. I want the BOM for the basic supply board and pre-regulator to be under $20.  SMD transformers can be very expensive, and they still may not be right. I have found a small toroid core I can get very cheap, and there are not many turns, so it hopefully will not be hard to make.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: Alex_arg on March 27, 2012, 07:42:50 pm
ahh , of course!  thanks for the clarification Richard, i was not thinking in the adjustable current, and all supplies i've built have negative supply to achieve cero volts..(and for the OpAmps) Good luck   
Title: Re: General Purpose Power Supply Design
Post by: BravoV on March 28, 2012, 06:01:21 am
Richard, I know its still in very early stage, just curious on your choice for the power switching part ? or maybe the potential list of switcher ic candidates that you're going to experiment ?
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 28, 2012, 08:29:25 am
I am building a test switcher with the wrong IC - it is just one I happen to have. A UC3842 which stops working when the input voltage gets down to 10V. It will be enough to get the measurements I need. The reason I need to do testing is that a 3 to 20V input, and a 3 to 27 volts output is a huge range if I want to get a full 1A out for every input/output combinations. I may have to cut the input range back to 10V to 20V. That range means old PC supplies could be used as a power source.

3V input would allow a single Lithium battery to be used, but to get 1A out at 25V, a 3V lithium cell would be outputting about 13A. For people who wanted to make a small 200mA supply, currents of up to 2.5 A peak from the cell sound a lot better.

To get the full range of input and output, I am using a flyback design. I want to get it working to test out the transformer and the secondary circuit. With the peak current that is the result of the big voltage range, I probably have to use a controller with an external power MOSFET, but I am not going to choose a regulator until I have a good feel for the frequency I need and I have worked out the transformer details. It is a spare time job, but I might get a few days to work on it this week, which will be good.

Once I know where I am going with the switching pre-regulator, I will put together something summarizing all the ideas, but to give a preview, the main reason I want the boards to be fully isolated from the power source is that I am designing the 25V 1A supply boards so they can run in parallel or serial in a master-slave configuration. So if you want a 25v 5A supply, just put 5 boards in parallel. If you want 100V 1A supply, put 4 boards in series. Or if you want a 100V 5A supply, then I know you are crazy - but why not? It is only 20 boards.  :)

What I discovered is it is probably impossible to come up with a general purpose design for a single regulator that could be scaled from a 100mA supply to a 10A supply without a redesign. But I can make a single fixed size board that is highly versatile and configurable.

I am borrowing the series/paralleling idea from the old HP supplies, but it is one of those ideas I will have to test for real. No reason why it shouldn't work though. 

If you are building a bigger supply, you could use a PC power supply as a source. One of the compact-sized PC supplies (200W - 350W) is still pretty compact,

It may sound odd, but the thing is if each board is very cheap, it will probably end up being a much cheaper and quicker way to get a supply going then trying to custom design a dedicated supply. It is quite possible that the BOM of the parts for a board excluding the PCB will be under $10. All the parts are easily available through hole, so it is possible to have a through-hole kit - not that I have any real plans at this stage.

It is possible that I can get the board over 1A, but the first rev will be 1A to be conservative. Don't think I want to go above 25Volts. 30V is technically possible, but it is getting too close to the opamp limits for my liking.

There will also be an option of a linear pre-regulator with a heatsink, so you can put the board in a box with with a transformer.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: BravoV on March 29, 2012, 04:34:42 pm
Richard, I really wish your modular design can work with two versions of switching pre-regulator for two kind of sources which are battery powered (step up and down) with much lower current capability, and the 2nd version with higher current source like pc power supply or even step-down transformer (step down only).

Title: Re: General Purpose Power Supply Design
Post by: amspire on March 30, 2012, 01:18:57 am
If you are planning on battery operation you may want to look into a sepic converter for your preregulator. There is one here.

http://panteltje.com/panteltje/pic/pwr_pic/ (http://panteltje.com/panteltje/pic/pwr_pic/)

Thanks for the link. Sepic converters have been one of the options I have been looking at. I will finally power up my test flyback transformer converter today. Took longer then I was hoping just because I needed a pretty good layout to have a chance at low noise. If the isolated option turns out to be just too noisy, a non-isolated sepic controller design will probably be my next choice.

I am sticking to the linear output stage, just due to the fact it perfoms better then a switching supply output.  The circuit in the link has a 2000uF capacitor on the output and that will be needed to get reasonable regulation, transient response and reasonably low noise on the output. The problem with that is even if you set the current limit to 10mA on the supply, then if the circuit under tests shorts the supply, then all the energy in the 2000uF cap goes into the component shorting the supply and that can damage the very circuit you intend to protect. A good linear supply can give better regulation, better current limiting and better transient response with only a 10uF cap on the output. 

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 30, 2012, 01:47:51 am
Richard, I really wish your modular design can work with two versions of switching pre-regulator for two kind of sources which are battery powered (step up and down) with much lower current capability, and the 2nd version with higher current source like pc power supply or even step-down transformer (step down only).

Definitely something like a 100mA supply is all you need for testing circuits like microcontroller and opamp circuits - very useful. Or a 1A 0-5V supply that decreases to 100mA at 20V out. When I get to the stage of have some working preregulators, I will look at how to organize the different options to make it understandable. I know if you give too many options, it just gets too confusing.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 30, 2012, 02:17:51 am
Not trying to nit-pick here but if your load is shorting out isn’t it safe to assume its already destroyed and therefore it is the regulator you are trying to protect. If you have multipile loads on the regulator if one shorts out, the voltage after the pass device will still collapse no matter how fast your current limiting is if that’s the concern. That’s how current limiting works.
No. The short can be from wiring faults, from say a switching regulator circuit you are debugging that switches hard on, from a transistor bridge ciruit or audio amplifier output stage where both transistors turn on at the same time - lots of reasons. The diea of current limiting is  that you do not blow anything up duing the debugging.
Quote

Yes you are definetly better off using a post regulator not only for noise attenuation but it will ease the magnetics desighn. You may find it to be benificial to use some type of frequency foldback at lower output voltages (powers) where you would be likely to change operating modes from DCM to CCM. A wide input will definetly add to the complexity. May be worthwhile to add a boost to feed your flyback a regulated input.
You are right about the fact that to get a supply working with a wide ranging input and output voltage and current range, I will have to switch between the CCM (a continuous current through the inductor/transformer) and DCM (the inductor/transformer current drops to zero during the discharge cycle) modes.

At high input voltage at minimum volts and amps out, the supply regulation circuit will force a lower switching frequency anyway without an intentional frequency foldback circuit.  The regulation circuit will just not allow the supply to switch again till the output voltage has dropped below the regulation voltage. If there are regulators that implement a deliberate frequency foldback scheme, I would be interested to know about them.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 30, 2012, 10:57:48 am

No. The short can be from wiring faults, from say a switching regulator circuit you are debugging that switches hard on, from a transistor bridge circuit or audio amplifier output stage where both transistors turn on at the same time - lots of reasons. The idea of current limiting is  that you do not blow anything up duing the debugging.
Sorry but again I'm not following your reasoning for this. You can't control both CC and CV simultaneously. If you have too fast a CC loop then it could prove to be a nuisance.
No, it is not that much of a problem. In normal use, the power supply is not near the constant current limit, so the constant current circuit is hard off. It is tricky getting the supply totally stable right at the precise point where both controls are active at the same time. this crossover window though is extremely tight -  a windows of a few microvolts and a few micro amps, so a problem there is rarely a big problem. The constant current loop has to be pretty fast.
Quote


You are right about the fact that to get a supply working with a wide ranging input and output voltage and current range, I will have to switch between the CCM (a continuous current through the inductor/transformer) and DCM (the inductor/transformer current drops to zero during the discharge cycle) modes.

At high input voltage at minimum volts and amps out, the supply regulation circuit will force a lower switching frequency anyway without an intentional frequency foldback circuit.  The regulation circuit will just not allow the supply to switch again till the output voltage has dropped below the regulation voltage. If there are regulators that implement a deliberate frequency foldback scheme, I would be interested to know about them.

Richard.

I think there are some but what I am doing using the cmos version of the UC384x series is clocking it from a PIC10F. If you control the duty of the clock via a PIC you control the maximum duty of the controller thereby limiting maximum power transfer. If you also provide a regulated voltage in my case to an asymmetrical flyback halfbridge via a APFC this allows for pretty precise power limiting or a lot more precise then wide input. My idea for frequency fold back is just to use a Flip flop to divide by 2 the frequency when the voltage, power demand drops below a certain level.
I am testing with a UC3842, but it does have the problem that is shuts down at 10V. How are you changing the clocking frequency without affecting the Rt/Ct ramp amplitude and shape?

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 30, 2012, 11:50:38 am
You have definitely given me ideas about getting a big range. It is possible to just let the regulator cope with very low loads by triggering for a few cycles till the voltage is too high and then shutting down till the voltage is too low again, but changing the frequency lets the regulator run in a more predictable way - probably with much better regulation.

Definitely worth a look. Thanks

Richard.

Title: Re: General Purpose Power Supply Design
Post by: robrenz on March 30, 2012, 01:56:40 pm
This is the type of peaceable constructive community brainstorming that makes this forum great! Keep up the good work :)
Title: Re: General Purpose Power Supply Design
Post by: king.oslo on March 30, 2012, 02:28:39 pm
Richard, I am impressed.M
Title: Re: General Purpose Power Supply Design
Post by: BravoV on March 31, 2012, 06:01:10 am
Richard and probably to Achmed as well, not to derail the current discussion and also I'm aware you're working on fly back topology, just for curiosity sake, why Cuk converter topology is not popular since it has excellent ripple output ?

Cause I've been thinking since we're going to wind our transformer anyway. Regarding inverted output of Cuk converter, CMIIW this should not be a problem for this purpose right ?

PS : I don't have any experience in this Cuk, its just I've been reading quite some literatures about it, and it seems like implementation of this topology is quite rare.

Apology if this is way OOT.
Title: Re: General Purpose Power Supply Design
Post by: amspire on March 31, 2012, 06:41:38 am
I have not actually tried to design a CUK converter. Usually the reason is the simpler design is tried first, and if that works, the more complex design is ignored. I might have to see if someone else has experience.

The flyback design is capable of great range and is about as simple as you can get.  I am really working on costs, and I cannot see how a CUK design would not be more expensive.

The initial tests look good, but now I need to isolate the secondary. Looking around for an optocoupler. I thought I had some, but they are all opto-triacs.

I think I better throw together an adjustable current sink for testing the supply.

Richard
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 01, 2012, 07:39:11 am
I have a isolating switching pre-regulator working and it is looking pretty good. Everything is running very cool.

Tried out the feedback via an optocoupler and it worked first time.

Once I have put together a constant current load, I will do some tests and post the results. It is not the final circuit as I am using just the parts I had lying around.

The UC3842 chip I am using for the moment only lets me test down to 10V minimum input and I want it to work down to 3V DC input, but using different regulator chip will not change the performance of the switching supply much. Currently using a 300kHz switching frequency.

Since I am using it as a pre-regulator, I do not need much accuracy. The current circuit will run at about 1.3V above the linear supply output voltage and I could end up sticking with that.

I hope to post the circuit and test results tomorrow. Once I have fully tested my test supply, I can put together a full Rev 1 design that allows you to take any voltage source between about 3V and 20V and convert it to an isolated 0 to 24V 1A linear supply.

Richard.

Title: Re: General Purpose Power Supply Design
Post by: electronwaster on April 01, 2012, 09:13:32 am
This sounds great, it sounds like (if I'm not misunderstanding) it can be built without a microcontroller, in which case I'm definitely building one (or a combinable pair) as a lab PSU.

I have been trying to design and build a PSU starting from scratch (no electronics knowledge whatsoever), and so far I have an zener/opamp/pass transistor circuit that can go down to 0V and offers reasonable load regulation, but no constant current limit. You have just provided me with a great shortcut! 

Thank you for your efforts putting this together, I am really grateful!

electronwaster
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 01, 2012, 11:03:31 am
This sounds great, it sounds like (if I'm not misunderstanding) it can be built without a microcontroller, in which case I'm definitely building one (or a combinable pair) as a lab PSU.
Definitely. It can be fully used without any micro. Also the idea will probably be to do two versions - a through hole version that would be easy to build, and a smaller SMD board. So far all the parts I am using are available in both forms, but I still have to pick the switching regulator. If you don't mind having a heatsink, the linear pre-regulator will be a simpler option and will be noise free. A heatsink probably does cost more then the parts for a switching regulator.
Quote

I have been trying to design and build a PSU starting from scratch (no electronics knowledge whatsoever), and so far I have an zener/opamp/pass transistor circuit that can go down to 0V and offers reasonable load regulation, but no constant current limit. You have just provided me with a great shortcut! 

Thank you for your efforts putting this together, I am really grateful!

electronwaster
Thanks for the encouragement.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: markus_b on April 01, 2012, 11:18:20 am
Thank you for your efforts putting this together, I am really grateful!

electronwaster
Thanks for the encouragement.

Richard.
Mee too !

Contrary to electronwaster I like the microcontroller, but the design allows for both. I'm comfortable to design (and program) the micro, but for the analog and switching stuff I'm lacking experience.
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on April 01, 2012, 05:42:31 pm
Richard, I remember reading an article while I was researching about the efficiency of SEPIC converters, in which was shown that the SEPIC topology is in many ways better than Flyback: SEPIC outperforms the flyback (http://www.eetimes.com/design/power-management-design/4009613/No-need-to-fear-SEPIC-outperforms-the-flyback). Not to mention another article, where is shown that SEPIC Converter Benefits from Leakage Inductance (http://www.powerpulse.net/techPaper.php?paperID=153).

Now that I finally found some time to play with it, having already a spare ATtiny861A in hand, I constructed a simple test circuit to see how a 16-bit Sigma-Delta PWM loop DAC behaves. I also connected to the t861A an LCD module and a few push-buttons to be changing the 16-bit DAC target value on the fly. Using the t861A Timer1 Compare-A in Fast PWM Mode running at 32 MHz, I observed that:
1. TC1COMPA will start only when the output value is greater than or equal to 0x0081 (129d), and
2. TC1COMPA saturates (PWM output always HIGH) when the output value is equal to 0xFF00 (65280d); beyond that value the output diminishes, since the MSB overflows and the ISR disregards any possible carry bits.

Both of the observations above were expected, since the 8-bit base PWM ISR,
1. Will not fire when the PWM MSB is equal to zero, so there is no update of the error accumulator, and
2. Will have an always high output when the PWM MSB is equal to 0xFF.

The Sigma-Delta extended PWM loop DAC sounds to be a nice idea but, I am sorry, no cigar...


-George
Title: Re: General Purpose Power Supply Design
Post by: IanB on April 01, 2012, 07:15:38 pm
The Sigma-Delta extended PWM loop DAC sounds to be a nice idea but, I am sorry, no cigar...

However, I don't think sigma-delta is your only choice of algorithm. You could use a direct computational algorithm.

For instance, to output 16 bits of precision on an 8 bit PWM you could proceed as follows:

1. The MSB has 256 times the magnitude of the LSB, so output it 256 times.
2. After outputting the MSB 256 times, output the LSB once.
3. Repeat from step 1.

Unfortunately the LSB is going to appear as a "bump" every 256 cycles, so heavy filtering is going to be required to obtain the smooth average value.
Title: Re: General Purpose Power Supply Design
Post by: markus_b on April 01, 2012, 07:29:16 pm
The Sigma-Delta extended PWM loop DAC sounds to be a nice idea but, I am sorry, no cigar...
However, I don't think sigma-delta is your only choice of algorithm. You could use a direct computational algorithm.
I think it may be easier to combine two PWMs one for the upper and one for the lower 8 bits and combine them externally with a resistor network. This requires slightly more external hardware to combine the two PWMs, but the filter remains simple.
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on April 01, 2012, 08:33:02 pm
Ian, I think that you are correct. <8_bit_MSB>*2^8 + <8_bit_LSB>*2^0 (or <8_bit_MSB>*2^16 + <8_bit_NSB>*2^8 + <8_bit_LSB>*2^0, for a 24-bit solution) using an 8-bit hardware PWM stage sounds right to me. However, this raises the complexity of the code and renders all the remaining fast PWM hardware modules of Timer1 incapable of producing a second PWM output, while the test circuit described above is already producing two 16-bit PWM outputs (using the Timer1 Compare-A and Compare-B fast PWM channels) and it has the third fast PWM channel (the Timer1 Compare-D one) free to produce yet another 8..10-bit PWM output.

Markus, this is right in theory; but the external resistor network adder of the two PWM outputs should be of a 16-bit precision in order to preserve the output linearity and avoid any output missing codes.


In my opinion, it will be easier to use any other AVR (of the mega family, for example) with a hardware 16-bit PWM to produce a 16-bit DAC output. But, again, for every 16-bit PWM DAC it will be needed a separate AVR chip.

Since we are not talking about a mass production device but about an one-off solution, I would prefer to use a <10 USD worth Analog Devices or Linear Technology <1 LSB INL 16-bit DAC of 1 MSPS update rate for each Voltage/Current channel, which will additionally offer me the possibility of modulating the PSU output in a user programmable manner, since my initial thought was to add an arbitrary waveform output functionality (https://www.eevblog.com/forum/blog-specific/eevblog-259-psu-rev-c-schematic-part-12/msg97898/#msg97898) to my PSU.


-George
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 02, 2012, 12:48:05 am
The Sigma-Delta extended PWM loop DAC sounds to be a nice idea but, I am sorry, no cigar...
However, I don't think sigma-delta is your only choice of algorithm. You could use a direct computational algorithm.
I think it may be easier to combine two PWMs one for the upper and one for the lower 8 bits and combine them externally with a resistor network. This requires slightly more external hardware to combine the two PWMs, but the filter remains simple.

Combining two DACs to get extra resolution is in general a bad idea. As George pointed out, unless the two are matched incredibly well, you end up with a poor result. My no.1 requirement is a monotonic output and that means a single PWM.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 02, 2012, 01:53:10 am
The Sigma-Delta extended PWM loop DAC sounds to be a nice idea but, I am sorry, no cigar...

However, I don't think sigma-delta is your only choice of algorithm. You could use a direct computational algorithm.

For instance, to output 16 bits of precision on an 8 bit PWM you could proceed as follows:

1. The MSB has 256 times the magnitude of the LSB, so output it 256 times.
2. After outputting the MSB 256 times, output the LSB once.
3. Repeat from step 1.

Unfortunately the LSB is going to appear as a "bump" every 256 cycles, so heavy filtering is going to be required to obtain the smooth average value.

I actually like this idea a lot, and you do not need heavy filtering. Say you use the atiny with the 64MHz clocked PWM. The 8 bit PWM cycle is 250KHz. With your scheme, an 250KHz/256 = 0.976Khz component will be added. The simple 3 stage RC filter (10k/1uF) I was proposing has a rejection of 1KHz components of  over 100dB. That is excellent.

Ok. I want better then 16 bit resolution, and there is no reason not to go for it.

If I increase the filter to a 4 stage 100K/.22u, then by adding an extra correction every 16 of the previous corrections, I end up with a worse case P-P ripple of 1uV. On average it will be half that. Even with 3 stages, the RMS ripple is less then 1uV.

To put these numbers into context, the output noise due to the LM324 opamp will probably be 1-2uV.

The beauty of this method of correction is that the corrections can be pre-calculated, so all we need in the PWM interrupt routine is two counters. Once every 256 PWM cycles, we use the first correction factor. Once every 256* 16 cycles, we use the second. The rest of the time, we use the non-corrected 8bit PWM value. 

I suspect this could work to give a 22 bit PWM result.

Richard.

Edit: The implementation is slightly more complex - but not by much.  The complication is this. Say the 8 PWM value is "186" and at the end of 256 cycles, we need to add an extra 215 - we cannot get a PWM cycle that somehow outputs  186+215 for one cycle.  We can make sure that for PWM counts below 128, we always need a positive correction, and for PWM counts above 128 we always need a negative correction. Then instead of correcting every 256 PWM cycles, we correct every 128 cycles. It also means the amplitude of each correction is half, that all helps.

As long as it works in the end. I have done this kind of micro work before, and you get it working somehow. Once it is working, it doesn't matter how untidy it looks under the bonnet.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 02, 2012, 02:12:28 am
Since we are not talking about a mass production device but about an one-off solution, I would prefer to use a <10 USD worth Analog Devices or Linear Technology <1 LSB INL 16-bit DAC of 1 MSPS update rate for each Voltage/Current channel, which will additionally offer me the possibility of modulating the PSU output in a user programmable manner, since my initial thought was to add an arbitrary waveform output functionality (https://www.eevblog.com/forum/blog-specific/eevblog-259-psu-rev-c-schematic-part-12/msg97898/#msg97898) to my PSU.

-George
George everything you say is true, but I am being pretty ruthless with my costs. Any half decent A/D dac with a good monoticity will cost more then all the rest of the main supply board parts combined.  Basically, if there is any way to get a $1 micro to do the job, I will still continue to chase it.

It is fine if the micro is spending 95% of its processing time doing the PWM. I would use a single PWM interrupt to handle both PWM outputs, so that  saves the cycles for one "iret".

In my response to IanB's suggestion, I proposed a 22 bit method that would need two 8 bit counters in the interrupt routine (shared by both channels). The first is incremented every cycle then second is incremented when the first overflows.

Based on the counters one of 3 precalculated PWM values are loaded. This eliminates any calculations from within the PWM interrupt.

The same method would work very much easier with 16 bit PWM, but I don't want to go to a much more expensive processor to get two 16 bit PWM's.  Using two 10 bit PWM's in the ATtiny 861 is worth looking into. It should give more time for the interrupt, even with the fact that two PWM registers have to be controlled instead of one. It would mean that one correction cycle is done every 1024 PWM cycles, and then one secondary correction cycle is done  every 4096 PWM cycles. The rest of the time, the PWM value is unchanging and all the PWM interrupt will be doing is incrementing a 2 byte counter and doing a 10 bit comparison.

Richard.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: IanB on April 02, 2012, 03:08:54 am
Edit: The implementation is slightly more complex - but not by much.  The complication is this. Say the 8 PWM value is "186" and at the end of 256 cycles, we need to add an extra 215 - we cannot get a PWM cycle that somehow outputs  186+215 for one cycle.  We can make sure that for PWM counts below 128, we always need a positive correction, and for PWM counts above 128 we always need a negative correction. Then instead of correcting every 256 PWM cycles, we correct every 128 cycles. It also means the amplitude of each correction is half, that all helps.

I was scratching my head over this before and I thought I was OK to output the LSB alone on the 257th cycle, but your comment above prompted me to think about what happens when the LSB is 0. In that case the algorithm would have sent a zero every 257th cycle, effectively multiplying the required output by 256/257. So I see you are right, it is more complicated. I don't fancy solving the complication as it's not my problem  :)  but apparently you have it covered.

(However, I cannot stop my brain from trying to solve the complication even when I tell it not to. Silly brain.)

So, if you add 186+215 you will overflow the 8 bits into the 9th bit; in other words 186+215 = 256 + 145. However, 256 neatly divides by 256 and becomes the lowest order bit of the MSB. So all we need to do is add one to the MSB and reduce the LSB accordingly. When MSB = 186 and LSB = 215, we output 187 for 255 cycles and 146 on the 256th cycle.
Title: Re: General Purpose Power Supply Design
Post by: BravoV on April 02, 2012, 04:30:04 am
I have a isolating switching pre-regulator working and it is looking pretty good. Everything is running very cool.

Richard, if its not troubling you too much, apart from the circuit that you're going to post, please post few photos of that working switcher, this will at least give us a clue how it looks like physically.

Frankly, I'm particularly interested with the transformer and assuming you made it your self.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 02, 2012, 05:27:23 am
I am making it myself using a toroid that can be very cheap from the right source. Something like 7c each if I buy a bag of 500.  I am currently using a Micrometals T50-52 core, and I hope I can use an even smaller T44-52 core that is just 11.2mm outside diameter. I am pretty happy with the way the powder core toriod is working at 300KHz so far, and I will probably try increasing to 500Khz.

http://www.micrometals.com/parts_index.html (http://www.micrometals.com/parts_index.html)

These types of cores have been used a lot in things like PC motherboards, so I assume that various Chinese manufacturers are making compatible cores by the truckload.

Ferrite cores can be very expensive, so if I can use this cheap one, it will be great. Somewhere out there, there may be a cheap off-the-shelf transformer that would work at an affordable price, but I am after everyday parts, and that transformer will not really fit with that plan. In general, one off prices for SMD transformers can easily be over $10, and I have to test them first before I even know if they will work adequately.

So I am not even trying to find a transformer. If I was a corporation planning on a production run of 100,000+ supplies, that would be different.

I will post some photos, but I still have to finish building my constant current load so I can test the supply at full power out. (My selection of power resistors is not very good). Probably another hour of work to finish the load this evening before I return to the supply.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on April 02, 2012, 11:00:09 pm
I have found a problem. It might be me but I do not think so, since a 1.5c update delay for the asynchronous t85/t861A PWM timer registers is already documented in the data sheets. Let me explain myself:

Experimenting with the Fast (64/32 MHz) PWM of the t861A asynchronous Timer1, I discovered that though I am able to change the PWM output in one Timer1 clock cycle time by modifying the PWM Output Compare Match registers, I can do it only if I am not updating a previous PWM value of 0x00. This means that the Sigma-Delta extended PWM loop, that often needs to load a PWM value of 0x00 and then change it rapidly to something else, will not be able to run correctly due to the extended restart delay of the PWM module after an update of a zero PWM value.

Since I initially thought that this was happening because of an extremely low PWM value loaded, that could not start the corresponding ISR responsible to update the PWM error accumulator, I moved both the PWM output channel ISRs code to the Timer1 overflow ISR, which is always served every 256 timer cycles, regardless of any possible PWM channel being enabled or not. I did that in order to have a means to be constantly updating the PWM error accumulators, independently of the state of the PWM channels. But I stumbled on the PWM module update delay that occurs when the previous PWM value is equal to 0x00... I will try to further investigate this anomaly, since it might be happening because of a possible detail I may have overlooked.

Of course, there is the ATtiny84 with a true 16-bit dual channel PWM hardware module, able of running at CPU speed, that can produce a two channel 16-bit PWM output with absolutely no CPU intervention. Speaking of cost sensitivity, the 2 Kbyte FLASH t24/t25/t261 are more inexpensive than the 4 Kbyte FLASH t44/t45/t461 or the 8 Kbyte FLASH t84/t85/t861 devices.


-George
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 02, 2012, 11:57:30 pm
George, if it helps, I will never be using a PWM value of 0x00 as I am adding some offset.

The reason I need to add some offset is it is essential if I am going to have software calibration - I need to be able to adjust either way near zero.

This is a problem for a design where you were choosing a good reference and high tolerance resistors just so calibration was not needed - in that case you do need 0x00 to be 0V and 0xFF to be maximum volts.

In my case, I want to be able for calibrate for opamp offsets and differential amp errors in my Current measurement circuit, so I will probably be using the PWM range typically from 0x08 to 0xF8.  With calibration, I could get down to 0x04. If there is a problem with low PWM values, I can increase the offset.

Richard.

Title: Re: General Purpose Power Supply Design
Post by: A Hellene on April 03, 2012, 10:47:30 am
In that case, Richard, I think that the 16/24-bit extended PWM code posted previously is ready to be used! There are no problems at all for PWM values between 0x0100[00]+1 and 0xFF00[00]-1; keep in mind though than the TOP value of the extended PWM DAC is equal to 0xFF00[00]-1 (and not 0xFFFF[FF]), for the correct calculation of the DAC output gain coefficients (I am using brackets for the possible 24-bit LSB of the PWM values).

Speaking of the asynchronous Timer1 PWM update delay I mentioned above, here are the readings of the Fast Mode PWM stage output of the t861A asynchronous Timer1 (set for 32 MHz clock frequency), where one clock cycle time is equal to 30.7 ns (f=32.6 MHz) and a complete PWM cycle period of 256 cycles is 7.87 µs (f=127KHz). The clock frequency deviation is due to the fact that the AVR internal oscillator is factory calibrated for use at Vdd=3.0V, while the test circuit supply voltage was 5.0V. If it is required, the oscillator can be re-calibrated for 1% accuracy over a wide supply range of 1.8V .. 5.5V.

The Fast Mode PWM was specifically programmed to output the following pulse train pattern, in nine discrete steps (where c is the PWM Compare-Match value loaded to the OCR1A/OCR1B registers, while the TOP counter value was set to 0xFF). The readings captured below were synchronised to Channel 2 (blue trace) that was triggered by positive pulses (of a specific width for each case), while Channel 1 (the yellow trace) was testing the PWM recovery time after setting the PWM value to 0x00 at Step 4.

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=22884)
Step 1. Ch2 = 1c, Ch1 = 1c: Correct.

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=22886)
Step 2. Ch2 = 2c, Ch1 = 2c: Correct.

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=22888)
Step 3. Ch2 = 3c, Ch1 = 3c: Correct.

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=22890)
Step 4. Ch2 = 4c, Ch1 = 0c: Correct.

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=22892)
Step 5. Ch2 = 5c, Ch1 = 5c: WRONG!
Channel 1 should be producing a 5c positive pulse.

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=22894)
Step 6. Ch2 = 6c, Ch1 = Unchanged (5c):
The Ch1 5c positive pulse (that was loaded and should had been produced at the previous step) is present now, delayed by one Timer1 clock cycle.

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=22896)
Step 7. Ch2 = 7c, Ch1 = 7c: Correct.

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=22898)
Step 8. Ch2 = 8c, Ch1 = 254c: Correct.

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=22900)
Step 9. Ch2 = 9c, Ch1 = 1c: Correct.


It is obvious that the PWM value of 0x05 at step 4, loaded right after the PWM value of 0x00 at step 3, takes two Timer1 clock cycles to be produced while every other PWM update that does not follow a previous PWM value of 0x00 takes only one. Clearly, this is a problem for a Sigma-Delta extended PWM loop DAC implementation that is expected to produce a sub-MSB value output.

This is what the t861A Timer1 Overflow ISR Handler test code looks like:
Code: [Select]
in r4,SREG ; Status Register preservation
push YL
push YH

; Nine-step PWM output sequence
cpi YL,1
brne PC+2
ldi YH,1

cpi YL,2
brne PC+2
ldi YH,2

cpi YL,3
brne PC+2
ldi YH,3

cpi YL,4
brne PC+2
ldi YH,0

cpi YL,5
brne PC+2
ldi YH,5

cpi YL,6
brne PC+2
rjmp _ReloadB
; ldi YH,6

cpi YL,7
brne PC+2
ldi YH,7

cpi YL,8
brne PC+2
ldi YH,-2

cpi YL,9
brne PC+2
ldi YH,1

out OCR1A,YH
 _ReloadB: out OCR1B,YL

inc YL
cpi YL,10
brne PC+2
ldi YL,1

; Done
pop YH
pop YL
out SREG,r4 ; Status Register restore
reti

-George


EDIT: Corrections and additions.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 03, 2012, 03:34:00 pm
Sounds like good news George.

Still trying to finish up my Switching preconverter tests. Managed to blow up a Schottky diode on the transformer output, so I will get back to it tomorrow. I need to get this done so I can document the full Mark III design.

Then I think I will do some kind of micro test.  I want to build up a proper filtered PWM and take a look. I have a digital pot somewhere I can use.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: jahonen on April 08, 2012, 07:13:55 pm
Somewhat unrelated implementation work but anyway, inspired from amspire's idea, I did a delta-sigma modulator in an Altera 2C8 FPGA just for interest, and reduced the "PWM" to just 1-bit one. It really does work quite nicely, as I was able to clock the modulator up to 150 MHz. That pushes the noise to quite high at frequency spectrum. I used 24-bit resolution, but that is easy to change in VHDL code. This is definitely a strange combination of DC precision and careful high-speed design. Switching a precision voltage reference in such a high rate does add some complications :)

I was able to adjust the output in very small steps, some µV or so. But of course, IO voltage supply is not a precision one by any means, so there were quite significant drift.

First test was just a ramp generator, the analog post filter was just 39k/4n7 RC (just some random convenient values without any design) from a junkbox:

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=23030;image)

I thought about testing that as an audio DAC but didn't bother to interface it to a SPDIF receiver :) Then I tried adding two inputs which let me adjust the value up and down. I measured the result with Gossen's Metrahit energy after adding second RC stage of 10k/1µ (again, no any design, just a test). As you can see, the result is quite nice:

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=23032;image)

Of course, there was some drift but the result was still surprisingly good for such a crude and simple circuit.

Here is also the digital signal spectrum measured directly from a FPGA pin (before RC filters).

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=23034;image)

You can see the notch at 150 MHz, which is the operating frequency of the modulator. That reminds me that some pre-filtering is probably useful, as the attenuation of a "low-frequency" filter tends to suffer at higher frequencies due to nonidealities.

Regards,
Janne
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on April 08, 2012, 08:11:12 pm
Ah! The wonders of the 1-bit DAC! With one only imperfection: The digital output stage limitations of reaching the true Vdd and GND levels, while hunting down 0.06 ppm accuracy of the 24-bit requested resolution... But then again, is there any other way of pursuing such goals?

Very nicely done, Janne!


-George
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 09, 2012, 12:30:07 am
Janne,

It is pretty amazing seeing the results of your 1 bit PWM. The fact you were able to adjust it to 50.000mV on the meter means you must have had surprising good stability, especially when you consider the clock frequency.

It is very encouraging to see this. With 24 bit resolution, that means you need you need a RC time constant of about 0.1 seconds, so two stages of 100K/1uF RC filters would give a really clean result. That should reduce the PWM noise to well below the 1uV level.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: BravoV on April 09, 2012, 10:54:02 am
Although I can't contribute much on this, just want to say currently this is one the best thread in this forum.

Keep up the excellent works, really appreciate the contributions made.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 09, 2012, 11:08:21 am
Thanks. I will start the posts on the switching regulator design - just haven't had much time last few days.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on April 12, 2012, 12:29:00 pm
I cannot explain my persistence for the implementation of a 16-bit PWM DAC. Maybe it is because the tiny24, which has a true 16-bit dual channel PWM (like all the mega's), costs USD 1.01 a piece in single quantities from Digi-Key and because a dual 16-bit PWM DAC is monotonic by principle; so, in that regard, it is more accurate and better than most of the 12-bit "affordable" stand alone DACs (https://www.eevblog.com/forum/blog-specific/what-dac-would-you-used-for-usupply-rev-b/msg102236/#msg102236). The beauty of this implementation is its simplicity: You just set it up once and you forget it! The CPU spends all its time in sleep mode, with an overall consumption of less than 5mA (or less than 2.5mA for the Pico-Power parts). Should you need to change any of the outputs, you just modify a 16-bit register pair for each channel and you are done: The hardware takes care of the PWM internal elements update in order to avoid any output glitches!

In the example below, the PWM frequency is set to 8 MHz (a compromise of output update speed and chip current consumption), which gives a full 16-bit PWM cycle time duration of 2^16 * 125ns = 8.192ms. 1 LSB represents a 76.29 µV step for Vdd = 5.0 V (5V/2^16LSB) or a 50.35 µV step for Vdd = 3.3 V or a 41.20 µV step for Vdd = 2.7 V. For the output filter component values I did not even pull a calculator; I just used a simple two stage RC filter of 15K/0µ1 (multilayer) for the first sweep and of 15K/1µ0 (tantalium) for the second one.

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=23154)
1. 16-bit PWM sweep with a 2-stage output filter of 15K/0µ1

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=23156)
2. 16-bit PWM sweep with a 2-stage output filter of 15K/1µ0

I ported the tiny861 code above to a mega88 I have already had in hand and programmed it to output the sweep above, for the codes 0x0000 .. 0xFFFF. Well, not exactly for all the codes because 2^16 steps of 8.192ms per step takes 537 sec and it would take ages to plot; what I did was to increase the PWM code by 32 LSB (8.192ms * 2^16/32 = 16.8s) on every 16-bit PWM cycle completion; much better now!


-George
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 12, 2012, 12:57:48 pm
George, can you set the PWM to a few static levels and measure the DC stability of the DC out? I do not know what kind of multimeters you have but any results would be very interesting.

I know you are probably just using a test setup and the micro supply stability may be nothing special, but it would be good to see the results. One of the things I was wondering is that if you went from a low duty cycle to a high duty cycle, will the upper FET in the output start increasing in resistance causing the voltage to drop slightly over time.

Also you used 15K resistors. Using 100K would put much less load on the output, so in theory, the stability should be better.

Also what is the AC on the output according to the meter? Can your DMM see any noticeable noise? Test micro circuits tend to be noisy anyway, but again it would be interesting.

Excellent stuff.  I haven't disappeared - I have just been busy with other work the last two weeks, but I will be doing a series of posts very soon on the latest work.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on April 12, 2012, 03:10:03 pm
Richard, I am sorry but my multimeters are not capable of reading microvolts or nanoampers. And, even though I do not have second thoughts on spending for example an amount of USD 500 for an SSD of a three-years long life expectancy, or half of that monetary amount for a toy-oscilloscope, I do not feel like investing such figures in immature software-based multimeters that I will not be able to completely trust in the long run --even though the industry seems it does. I guess I'll have to begin watering down my wine in this department, too... Awareness, after a certain point, really sucks! :P

What I could do instead, is to set up a high gain op-amp (100x/1000x) to make such readings; but again, being the whole setup constructed on breadboards, hunting down such resolution and accuracy figures shouts for the need of carefully arranged ground islands beneath the chips and the filters and of guarding loops around the sensitive lines. The digital output stages limitations are also considerable, since their expected characteristics drift due to temperature variations does never work in favour of accuracy or stability.


-George



EDIT: Corrections...
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 15, 2012, 05:23:39 am
I did some serious number crunching work on the PWM DAC so I can build up a test circuit for my own, and found that the original scheme of an 8 bit PWM with corrections every PWM cycle performed better then all the other ideas that have come up since then. 10 bit PWM is messy since the lower 8 bits are double buffered and the top 2 bits are not - basically 10 bit PWM is for constant PWM. 16 bit PWM means that the output frequency is pretty low  - 244 Hz for a 16Mhz PWM clock - and the results through the filter is far worse then the results you get with an 8 bit PWM.

I also looked at an active filter instead of the simple PWM, but the problem there is the main noise is at 62Khz when the opamps are loosing a lot of their gain. The simple RC filter gives far superior results. So I will take Georges code and modify it for an Atmega328  (that's what I have for now), and set it up with a good reference.

The best filter looks like a three stage RC filter consisting of 22K resistors and 1u capacitors. There are no stability and accuracy requirement for these parts, so supply filter 1uF caps are fine. With these values, the output settles from a large voltage change to within 1% in less then 0.6 seconds, and to within 1uV of the final value within 1.5 seconds. I can live with that. Theoretically, the ripple from the PWM + correction with a 16Mhz PWM clock should be less then 1uV RMS on the final supply output  - probably below the noise from the opamps. It works out better then I expected, as the PWM cycle-by-cycle correction code is pretty good at minimizing the end noise because it spreads out corrections over the full correction cycle is a smooth way.

I will try both the PWM straight from the chip, and also PWM from a CMOS synchronous register powered by the reference. I will use the synchronous register to restore the timing for the PWM output using the Atmega's clock. The resulting waveform should be much better formed, and the levels more precise, as the CMOS chip is dedicated to this task - not handling 10 other loads like a Micro.

I aim to get some numbers out for linearity, short and long term stability and noise. 

Richard.
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on April 15, 2012, 09:52:32 pm
An AVR output lower mosfet has an Rdson between about 20 R (-40C),  23 R (25C)  and 28R (85C) and the upper one has between 10 R (-40C), 12.5 R (25C) and 15 R (85C), both at 5V. These are typical figures, taken from the datasheet (m328P) graphs of the pin driver strength and 10 mA draw.

An HC00 @ 4.5V (there is no figure for 5V, even for the HCT) has Ron for the lower one of 37.5 R typical (25C) and max of 82.5 R (entire temperature range) and 45 R typical (25C) and 165 R (entire temperature range) for the upper one. The HC244 doesn't have typical figures but has a maximun Ron for 67 R (lower mosfet) and 133 R (upper mosfet). These are taken from NXP's datasheets.

Of course you can parallel multiple CMOS drivers to lower the Ron, but the pin driver of the AVR is better.
Title: Re: General Purpose Power Supply Design
Post by: caroper on April 15, 2012, 10:36:58 pm
16 bit PWM means that the output frequency is pretty low  - 244 Hz for a 16Mhz PWM clock - and the results through the filter is far worse then the results you get with an 8 bit PWM.

I have some PIC32MX150F128B SPDIP Samples on the way, it may be worth trying the 16Bit PWM with the 40Mz clock.
They are for another project but I am sure I could reserve one or two and try getting the CHIPKIT Bootloader on them and see if I cant get them to work with the MPIDE to make porting Arduino Sketches easier for those that would like a more powerful CPU.

I am busy building a custom bootloader for the 32MX695 at the moment so the groundwork should be in place by the time the 32MX150's arrive.

Cheers
Chris
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 15, 2012, 11:05:02 pm
An AVR output lower mosfet has an Rdson between about 20 R (-40C),  23 R (25C)  and 28R (85C) and the upper one has between 10 R (-40C), 12.5 R (25C) and 15 R (85C), both at 5V. These are typical figures, taken from the datasheet (m328P) graphs of the pin driver strength and 10 mA draw.

An HC00 @ 4.5V (there is no figure for 5V, even for the HCT) has Ron for the lower one of 37.5 R typical (25C) and max of 82.5 R (entire temperature range) and 45 R typical (25C) and 165 R (entire temperature range) for the upper one. The HC244 doesn't have typical figures but has a maximun Ron for 67 R (lower mosfet) and 133 R (upper mosfet). These are taken from NXP's datasheets.

The problem with using the micro outputs directly is that the other ports are driving other loads, and all the total current and transient loads goes through the common supply pins. The PWM will suffer voltage changes through resistive drops in the power supply pins as the total load changes. It may be I can avoid any heavy loads on other output pins which could make the micro outputs look pretty good. The RC filter look like a resistive load of between 22K and 220K depending on the final value I choose. If it is 220K, then a 10 ohm change in a output driver resistance would cause  something like a 0.005% change. 

i will have to see what kind of resistive change you actually get in the short term, as I am mainly concerned with short term stability after everything has had time to warm up.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 17, 2012, 02:34:02 pm
My test breadboard to check out the PWM DAC performance is going well. I have an Arduino micro running with a LCD panel and pushbuttons.

So far the PWM looks like it may be able to get at least 0.1% accuracy, and it is definitely adjustable to better then 10uV.

The problems I have at the moment is the variable load from the micro and display is causing the micro supply to vary in the sub-mV range, and since the PWM output is proportional to the micro supply, I cannot measure the PWM stability till I solve the micro supply stability. I will probably take the PWM out to a buffer running from a precision voltage reference.

Also I found that the PWM interrupts are incompatible with the Arduino LCD routine. I suspect the LCD routing is using interrupts, or sharing the timer0 interrupt. So if I write to the display, then PWM output goes pretty bad.  It should be very fixable - no reason for the LCD routine to use any interrupts.

I want to get it running with software calibration, and the means to control the output voltage down to uV level. I am using Arduino 1.0 IDE and finding it pretty good. So far, it has not been hard to update libraries for the changes in Arduino 1.0.

I will post a circuit and some photos tomorrow.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 19, 2012, 01:11:33 am
I finally got over my problems getting the micro up and running, so I should able able to get a really good test of the PWM DAC working today.

It am using a atmega328 running at 16MHz. Since I do not have the constraints George had, I am able to write the interrupt in C. I can easily fit the interrupt code for managing two timers inside the 16uS PWM period. It will probably end up using something like 8uS, so that is all I need for a good test.

This code does not use any dedicated registers - just standard RAM memory - so it is not nearly as efficient as George's code. There is a good chance I will end up using George's code in a final version, except if I use a micro that does not have a built-in clock multiplier for the PWM clock, then I will not use dedicated registers.

Here is the C code with the assembler the compiler generated:

Code: [Select]
ISR(TIMER2_OVF_vect) {
     b2a: 1f 92        push r1
     b2c: 0f 92        push r0
     b2e: 0f b6        in r0, 0x3f ; 63
     b30: 0f 92        push r0
     b32: 11 24        eor r1, r1
     b34: 2f 93        push r18
     b36: 3f 93        push r19
     b38: 4f 93        push r20
     b3a: 5f 93        push r21
     b3c: 8f 93        push r24
     b3e: 9f 93        push r25
     b40: af 93        push r26
     b42: bf 93        push r27

  OCR2A = (byte) (pwm_accum / 0x01000000L ) ;  // 16 cycles

     b46: 80 91 80 01 lds r24, 0x0180
     b4a: 90 91 81 01 lds r25, 0x0181
     b4e: a0 91 82 01 lds r26, 0x0182
     b52: b0 91 83 01 lds r27, 0x0183
     b56: 2b 2f        mov r18, r27
     b58: 33 27        eor r19, r19
     b5a: 44 27        eor r20, r20
     b5c: 55 27        eor r21, r21
     b5e: 20 93 b3 00 sts 0x00B3, r18

  pwm_accum &= 0x00FFFFFFL ; // 7 cycles

     b62: b0 70        andi r27, 0x00 ; 0
     b64: 20 91 7c 01 lds r18, 0x017C
     b68: 30 91 7d 01 lds r19, 0x017D
     b6c: 40 91 7e 01 lds r20, 0x017E
     b70: 50 91 7f 01 lds r21, 0x017F

  pwm_accum +=  value ;  // 11 cycles

     b74: 82 0f        add r24, r18
     b76: 93 1f        adc r25, r19
     b78: a4 1f        adc r26, r20
     b7a: b5 1f        adc r27, r21
     b7c: 80 93 80 01 sts 0x0180, r24
     b80: 90 93 81 01 sts 0x0181, r25
     b84: a0 93 82 01 sts 0x0182, r26
     b88: b0 93 83 01 sts 0x0183, r27

}
     b8e: bf 91        pop r27
     b90: af 91        pop r26
     b92: 9f 91        pop r25
     b94: 8f 91        pop r24
     b96: 5f 91        pop r21
     b98: 4f 91        pop r20
     b9a: 3f 91        pop r19
     b9c: 2f 91        pop r18
     b9e: 0f 90        pop r0
     ba0: 0f be        out 0x3f, r0 ; 63
     ba2: 0f 90        pop r0
     ba4: 1f 90        pop r1
     ba6: 18 95        reti


I am really impressed that the code optimizer translated

OCR2A = (byte) (pwm_accum / 0x01000000L )

into a move, and three exclusive ORs and a sts command. It didn't try to divide at all. It could have left out the eor commands, but that is just 3 cycles.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 19, 2012, 04:05:41 pm
I have my PWM test setup working and it is not bad.

The breadboard is limited by 0v rail digital noise around the 500uV level, so I cannot properly check out the performance of the PWM into the microvolt level, but the results are definitely promising. Transients from things like the LCD display are getting to the output. 

Looks like a linearity and accuracy of less them 10mV error can be expected which is pretty good for a basic 25v supply. I am typically getting within 2mV and since I have scaled the output for 25V maximum output, 2mV equates to 13 to 14 bits of DAC accuracy. That is good. I have a monotonic 32 bit DAC (well 23 bits practically)  that performs at least as well for accuracy as a 13-14 bit commercial DAC. I am very happy with that.

The output works well down to near zero volts just by using the LM324 amplifier on the PWM output with a 10K pull down resistor on the output. I am currently getting 4mV out at  minimum voltage. At 18 mV set, I get 15mV out. At 0.1V set, I get 97mV out. That is not bad performance for a single supply opamp circuit.

Long term accuracy is another issue, but there is no real reason for the output to change much.

As far as I can work out, with a proper layout, you should be able to adjust to within 10uV as a short term stability, but that does depend on the voltage reference used, and an excellent board layout to isolate digital noise from the analog sections.

I found that it may be hard to use the PWM from the micro directly. Loads on other outputs do affect the PWM output levels when you are looking at 0.01% error levels.

I have taken the PWM output to a cmos buffer which is powered by a 0.6ppm/C 5v reference IC just so I can look at the PWM accuracy and not the reference accuracy too. Definitely using something cheaper in the design.

It is a bit late now to get some pictures, but I will hopefully find time tomorrow. Overall though, the concept looks like it is good. It should give me the adjustment resolution I want down into the uV region. The negatives compared to a DAC is that the output takes up to a second to settle fully and the board layout will definitely be much more critical compared to a DAC.

How to adjust the output voltage in a way that gives you fine resolution - that will be another big challenge.

Before I switch it off for the night, here are some random results:

Setting             Output
0.9266V            0.9236V
3.1523V            3.1493V
4.9663V            4.9635V
6.7801V            6.7776V
10.7124V         10.7105V
13.1595V         13.1581V
15.4267V         15.4250V

All the readings are low by two or three millivolts and that is just the calibration is not quite right. I have not done any calibration of the linearity - that is the inherent linearity of the PWM. I just calibrate at 1V and 10V, and all the other voltages are calculated by the PWM reference using those two numbers.

To get a feel for the short term stability that may be possible, I have set the voltmeter to average over 20 mains cycles, and right now, it is stable to 100uV with 15V out and that is on a noisy breadboard.

A precision version of this as a high resolution  programmable reference box (a really good reference , better opamps and a dual supply) may be a handy spinoff from this work.

Richard.

Title: Re: General Purpose Power Supply Design
Post by: BravoV on April 19, 2012, 04:24:54 pm
Richard,

Looks really promising ! Thanks for the update !


A precision version of this as a high resolution  programmable reference box (a really good reference , better opamps and a dual supply) may be a handy spinoff from this work.

I'm in if you decided to design this too !
Title: Re: General Purpose Power Supply Design
Post by: m12lrpv on April 19, 2012, 09:52:50 pm
I have taken the PWM output to a cmos buffer which is powered by a 0.6ppm/C 5v reference IC just so I can look at the PWM accuracy and not the reference accuracy too. Definitely using something cheaper in the design.

This is something that's completely new to me (references and powering things from them) so i'm interested in knowing what the reference is that you're using so that I can learn more about it.

Title: Re: General Purpose Power Supply Design
Post by: amspire on April 20, 2012, 12:25:01 am
I have taken the PWM output to a cmos buffer which is powered by a 0.6ppm/C 5v reference IC just so I can look at the PWM accuracy and not the reference accuracy too. Definitely using something cheaper in the design.

This is something that's completely new to me (references and powering things from them) so i'm interested in knowing what the reference is that you're using so that I can learn more about it.
You won't want to know about the reference IC's I am using. VRE305A made by Thaler Corp. and they are actually hybrids - a buried zener reference IC mounted on a thick film temperature compensation network. It is laser trimmed for accuracy and temperature coefficient. I bought them directly from Thaler at something like $10-$15 each, but Thaler have been taken over by Cirrus, and the one-off price is now about $70. The specs are generally better then the best references IC's but too expensive unless you are desperate.

There are lots of great reference IC's, and a good place to start is to google REF01 and REF02. The 8 pin DIP pinout has become an industry standard, so you can often replace one reference with another completely different part number from a different manufacturer.

There are 2 common type of references. The best is the zener diode based references, but the zener references need at least 6.3V, and so these ICs usually need 10-15V to operate.

The second type uses the voltage differences between the base voltages of matched transistors at different currents to provide a low voltage reference. Not as good as the zeners, but still impressive, and it is excellent for 1.25 to 2.5V low power references running of 2.7V to 5V supplies. Good enough for most uses.

There are few other types of references but these are the most common.

Another really neat reference IC is the Texas Instruments TL431.

This is a very clever 3 pin shunt  regulator. It is not as good as the best of the 8 pin references, but it is far more versatile, and a lot of fun to play with. It basically can be used as an active part of a circuit, rather then just a reference.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 20, 2012, 12:49:11 am
Richard,

Looks really promising ! Thanks for the update !


A precision version of this as a high resolution  programmable reference box (a really good reference , better opamps and a dual supply) may be a handy spinoff from this work.

I'm in if you decided to design this too !

Just wondering how to proceed since I am really trying out ideas related to a really cheap quality power supply design rather then making a product.

I think the way I will go is to do it as a modular design. This will mean I can post the finished modules without needing solutions to everything.

If someone wants to integrate the ideas back into a single board - great.

The PWM does work better then expected so I am interested in looking at a high performance design. I have a Kelvin-Varley divider project that is in hybernation for the moment, but this could replace it.

A 2 point calibration for the PWM at zero volts and one reference voltage using a auto zero offset opamp based galvanometer should be straightforward, and if I can get a 0.001% linearity, it would be nice. Looking at the test PWM performance, resistor stability may be a bigger problem then the PWM linearity. Resistors better then 20ppm/C cost a lot, and it takes very little power to make a 20ppm/C resistor change significantly when you are looking for better then 0.1%.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: m12lrpv on April 20, 2012, 12:53:46 am
You won't want to know about the reference IC's I am using. VRE305A made by Thaler Corp. and they are actually hybrids - a buried zener reference IC mounted on a thick film temperature compensation network. It is laser trimmed for accuracy and temperature coefficient. I bought them directly from Thaler at something like $10-$15 each, but Thaler have been taken over by Cirrus, and the one-off price is now about $70. The specs are generally better then the best references IC's but too expensive unless you are desperate.

...

Thanks.

I was more interested in the specs of what you were using because i've got some TL431's for use as ADC references and i'm looking at them wondering if I really could power a cmos buffer or inverter of them.
Title: Re: General Purpose Power Supply Design
Post by: BravoV on April 20, 2012, 12:58:45 am
Thanks, about programmable reference box, if you have time, please design it and definitely I will build it.

About the vref, I'm aware of that high end Thaler's stuff, just asking for other alternatives, though not as good in initial accuracy compared to Thaler, I have few of these in my component bins, these should be good enough right ?

MAX6350 (buried zener)
-> 1ppm/°C Max Tempco , 3µVp-p Noise , ±0.02% initial accuracy, has external trim feature
-> http://www.maxim-ic.com/datasheet/index.mvp/id/1700 (http://www.maxim-ic.com/datasheet/index.mvp/id/1700)

or this one

LTC6655
->  2ppm/°C Max Tempco , 0.25 ppm p-p Noise , ±0.025% initial accuracy, has kelvin sense pins
-> http://www.linear.com/product/LTC6655 (http://www.linear.com/product/LTC6655)
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 20, 2012, 05:20:38 am

Thanks.

I was more interested in the specs of what you were using because i've got some TL431's for use as ADC references and i'm looking at them wondering if I really could power a cmos buffer or inverter of them.
References tend to have opamp output rather then power supply outputs, but they can usually manage up to about 10mA that is fine for low power IC's,   Make sure you have a ceramic 1uF cap or similar directly across the CMOS IC as even though they consume almost no power when static, the peak transient switching current can be quite high. The VRE305A is 10mA peak output.

I like to limit the current to 1 to 3mA maximum, but they will still work well at 10mA out.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: EEVblog on April 20, 2012, 07:05:28 am
I will try both the PWM straight from the chip, and also PWM from a CMOS synchronous register powered by the reference. I will use the synchronous register to restore the timing for the PWM output using the Atmega's clock. The resulting waveform should be much better formed, and the levels more precise, as the CMOS chip is dedicated to this task - not handling 10 other loads like a Micro.

Yes, my guess would have been that a decent accurate 16bit PWM from a direct micro might be asking a bit much, especially if the micro is handling other current stuff like direct LED drive.

Dave.
Title: Re: General Purpose Power Supply Design
Post by: EEVblog on April 20, 2012, 07:07:53 am
I was more interested in the specs of what you were using because i've got some TL431's for use as ADC references and i'm looking at them wondering if I really could power a cmos buffer or inverter of them.

Easily.
I've powered micros directly with voltage references for the supply, and it works a treat at providing an accurate ADC and PWM DAC system.

Dave.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 20, 2012, 07:45:05 am

Yes, my guess would have been that a decent accurate 16bit PWM from a direct micro might be asking a bit much, especially if the micro is handling other current stuff like direct LED drive.

Dave.
That is exactly what I am seeing. I have an old-style 16x2 LCD display attached, and every time I write to it, I am seeing a 10mV glitch on the Atmega328 outputs. That is nothing as far as digital is concerned, but pretty bad for precision analog.

It may be possible to get accurate PWM out of a dedicated micro that is doing PWM and nothing else. Something like a ATtiny chip. How would you control it though?

I think I will go for the external CMOS buffer run from a reference. I have also found it is really important to get the capacitor in the first RC stage of the filter really close to the CMOS buffer to minimize the path of the transient current. Even though I am using 100K resistors and 0.22uF caps, the transient does infiltrate the later analog stages.

Richard.

Title: Re: General Purpose Power Supply Design
Post by: jahonen on April 20, 2012, 08:01:42 am
I think I will go for the external CMOS buffer run from a reference. I have also found it is really important to get the capacitor in the first RC stage of the filter really close to the CMOS buffer to minimize the path of the transient current. Even though I am using 100K resistors and 0.22uF caps, the transient does infiltrate the later analog stages.

Richard.

That's why I thought that it would be probably a good idea to first shave off the highest frequency components (MHz and above), before doing any actual PWM filtering (see my spectrum measurements). Large-valued resistors tend to suffer from parasitic capacitance across which don't mix well with those steep edge rate signals. First thing to try might be putting a small cap (few tens of pF perhaps) directly at the logic gate output, that will slow down edges quite significantly.

Also, forget breadboarding and use that solid copper clad board that Jim Williams would use for the output logic gate buffer and PWM filter.

Regards,
Janne
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 20, 2012, 01:36:22 pm

Also, forget breadboarding and use that solid copper clad board that Jim Williams would use for the output logic gate buffer and PWM filter.

Regards,
Janne
You mean like this  :)

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=23458)

I know what I should be doing. It is just that trying to work Jim Williams style drives me a bit nuts. I think I will just make a PCB for the next effort. Definitely, my current breadboard is useless below 1mV with all the noise on the 0V line just because of the presence of the micro. I may also try running the micro from batteries, and moving the analog to a different breadboard.

For anyone interested, the Arduino compatible Atmega328 RBBB board is on the left. The small Kapton tape wrapped board (top center) contains  a 4069 hex inverter with all six inverters in parallel plus decoupling caps. I definitely could move the first RC filter stage to that board. I had to use the small board as the 4069 was a smd package.

The 8 pin IC that is in front of the buffer board is the VRE305A reference and right is a LM324  IC.

The 4 switches from left to right are step down, step up, save 1V reference and save 10V reference. The down and up switches step in different increments depending on whether I single click, double click or single click, so that is how I can manage to adjust the 32 bit PWM value with two switches.

Richard
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 22, 2012, 07:36:00 am
Inspired by Janne, I though I had better improve my PWM test setup a little.

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=23474)

In the photo above I have my PWM reference set for 10mV out, and it is actually putting out 10.141mV. Just to prove it works down to 0V.

I separated the Analog from the digital breadboard, and powered the micro from batteries, just so the analog breadboard only had one point of contact from the digital circuit. The analog board had a 74HC10A gate acting as a buffer  powered from a 5V reference. The filter was 3 stage RC filter with a 100K/22uF combination. A LM324 unity gain amp followed, and then I had another stage with an offset of about 50mV and a gain of 5.

I decided to check the jitter of the Atmega328 which was using a 16MHz ceramic resonator.

It turned out to be pretty bad - 4 nS jitter and the big errors were erratic, so it would not be hidden by the averaging all that much. It turns out that the clock was in the low power mode which is prone to noise sensitivity.  Changing the fuses to High Power mode for the clock reduced the jitter to below 0.5nS (I cannot measure below that). This is good enough for better then 1 part in 10-5, so I do not need a crystal oscillator or anything to recover the edges accurately.

How did it work out. Well extremely well actually.

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=23476)

If you look at the 14V reading, you see that as I approach the higher voltages, the error seems to be increasing. The error of .2mV amounts to a 15ppm error. A 50ppm/C metal film resistor in my LM324 amplifier circuit feedback can cause this if the resistor's temperature warms by just 0.33 deg C as the voltage across it increases. Also I have scaled this for 25V full scale, so an error of 0.2mV is just 8ppm of full scale. I really think this is amazing from such a simple circuit.

Is there anything for 10 times the cost  that comes close?

I am really on the limits of basic resistor and LM324 performance here. For my power supply, I am very happy to go for 10mV absolute accuracy, with typical accuracy being 1mV, and it looks like I get that with the most basic of parts.

I cannot see any reason why the results would not be even better with high stability resistors and ultra low offset & current opamps.

Richard.

Title: Re: General Purpose Power Supply Design
Post by: amspire on April 22, 2012, 08:39:06 am
One of the motivations for starting this power supply project is I need a supply that is adjustable down to the microvolt level for a Fluke540A Thermal Transfer Standard. The 540A can calibrate an AC signal to a 0.01% RMS accuracy by comparing it with an equivalent DC signal.

For this, I really need something that is stable in the short term and settable to 0.001%. With a 400mV RMS AC signal, that means I need to be able to adjust down to 4uV DC. A supply is needed that can drive the 200 ohms/volt of the 540A, and it is amazing how much drift you get out of many standard power supplies. Just about all the digital supplies are totally useless as their resolution is so bad. A supply that has 1mV resolution is marginally useful for measuring above 10VAC and is only properly useful above 100V AC - but then the power supply probably doesn't go that high.

So I tried using the reference to null a random setting on the 540A, and it really worked brilliantly. Adjusting down in the uV level was brilliant - very monotonic and no jumps at all. Stability was perfectly adequate for the task.

I put up a photo. Watching a 540A work is not exciting. All you are trying to do is to get the galvanometer to 0.0 on HIGH sensitivity, but here it is. A deflection of +/- 6 corresponds to a +/- 0.01% error. I didn't wait for thermal equilibrium of the sensor, so the needle was still creeping up very slowly as I took the photo. It looks like it is about 0.003% above zero. This corresponds to an output voltage of about 410 mV from the PWM reference.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: Leo Bodnar on April 22, 2012, 11:01:19 am
It may be possible to get accurate PWM out of a dedicated micro that is doing PWM and nothing else. Something like a ATtiny chip. How would you control it though?
Through three SPI pins (CS, CLK, MOSI) with inline high value resistors to reduce noise injection from master.
Preferably make their default state low.

Leo
Title: Re: General Purpose Power Supply Design
Post by: Leo Bodnar on April 22, 2012, 11:16:40 am
Is there anything for 10 times the cost  that comes close?
Dave has an episode on precision voltage reference (http://www.eevblog.com/2011/10/24/eevblog-210-krohn-hite-dc-voltage-standard-teardown-calibration/) that is nothing more than a voltage reference IC and a bunch of resistor dividers in a box.

I know you are excited!  :)

But by the time you put $1 something-duino in a rack enclosure, add power supply, user interface, go through agencies approvals,  issue calibration certificate, print user manual and product shipping package (so that it can be sold side-by-side with big guys) it will cost $500.

Leo
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 22, 2012, 12:47:19 pm
Is there anything for 10 times the cost  that comes close?
Dave has an episode on precision voltage reference (http://www.eevblog.com/2011/10/24/eevblog-210-krohn-hite-dc-voltage-standard-teardown-calibration/) that is nothing more than a voltage reference IC and a bunch of resistor dividers in a box.
Just a bunch of resistors.  ::)

I would love place I could just buy that bunch of resistors at an affordable price. It is very easy to underestimate what Krohn-Hite had to do to get that bunch of resistors. You don't get anything with custom matched resistors like that for anywhere near $1000 new. Out of the range of hobbyists for sure.

Quote

I know you are excited!  :)

But by the time you put $1 something-duino in a rack enclosure, add power supply, user interface, go through agencies approvals,  issue calibration certificate, print user manual and product shipping package (so that it can be sold side-by-side with big guys) it will cost $500.

Leo
Which is why I am not getting involved with that. My PWM DAC is for a basic power supply. The fact it will have a D/A that will probably kill anything in commercial power supplies for 100 times the price is OK - I am not complaining.

If I design a precision programmable voltage reference as well, I think it would be ideal as a hobbyist project - they can make something for $10 - $20 that is probably better then that $500+ commercial stuff that you are talking about.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: BravoV on April 24, 2012, 04:26:29 am
If you look at the 14V reading, you see that as I approach the higher voltages, the error seems to be increasing. The error of .2mV amounts to a 15ppm error. A 50ppm/C metal film resistor in my LM324 amplifier circuit feedback can cause this if the resistor's temperature warms by just 0.33 deg C as the voltage across it increases. Also I have scaled this for 25V full scale, so an error of 0.2mV is just 8ppm of full scale. I really think this is amazing from such a simple circuit.

I am really on the limits of basic resistor and LM324 performance here. For my power supply, I am very happy to go for 10mV absolute accuracy, with typical accuracy being 1mV, and it looks like I get that with the most basic of parts.

I cannot see any reason why the results would not be even better with high stability resistors and ultra low offset & current opamps.

Richard, I'm guessing that the resistors you're talking about are those in the 3 stages RC filter ?

Btw, cmiiw, looks like now you've finalized the adjustable vref module right ? How is the linear power part, are you going to work on that soon ?
Title: Re: General Purpose Power Supply Design
Post by: BravoV on April 24, 2012, 04:41:56 am
Is there anything for 10 times the cost  that comes close?
Dave has an episode on precision voltage reference (http://www.eevblog.com/2011/10/24/eevblog-210-krohn-hite-dc-voltage-standard-teardown-calibration/) that is nothing more than a voltage reference IC and a bunch of resistor dividers in a box.
I don't think those resistors are just jelly bean resistors, suggesting you to search here at this forum on the metrology discussions, there are plenty of it here, and Richard was also quite active in those discussions, I believe he knows what he is talking about when it comes to resistor in precision circuit.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 24, 2012, 06:27:06 am
If you look at the 14V reading, you see that as I approach the higher voltages, the error seems to be increasing. The error of .2mV amounts to a 15ppm error. A 50ppm/C metal film resistor in my LM324 amplifier circuit feedback can cause this if the resistor's temperature warms by just 0.33 deg C as the voltage across it increases. Also I have scaled this for 25V full scale, so an error of 0.2mV is just 8ppm of full scale. I really think this is amazing from such a simple circuit.

I am really on the limits of basic resistor and LM324 performance here. For my power supply, I am very happy to go for 10mV absolute accuracy, with typical accuracy being 1mV, and it looks like I get that with the most basic of parts.

I cannot see any reason why the results would not be even better with high stability resistors and ultra low offset & current opamps.

Richard, I'm guessing that the resistors you're talking about are those in the 3 stages RC filter ?

Btw, cmiiw, looks like now you've finalized the adjustable vref module right ? How is the linear power part, are you going to work on that soon ?

I am entering the circuit into KiCad, but I admit, once I post it, I could really do with some ideas about the interface.

The cheapest approach would be to use an ATtiny processor with the QTouch hardware for capacitive buttons, but a power supply without a knob or two and real switches? - I just do not know.

Every half decent power supply I have built or used can easily last for decades. I want to end up with something that has an efficient interface that lets me switch from rough control to very fine easily.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 24, 2012, 06:40:04 am
Richard, I'm guessing that the resistors you're talking about are those in the 3 stages RC filter ?
No The resistors and the capacitors in the RC filter can be very cheap - it doesn't matter. As long as the capacitors do not have a really bad ESR and as long as the leakage current is negligible. Drift in the filter resistors cause no real error, so the only problems are if they have a big effective parallel capacitance or are really noisy.

I need to amplify the output of the DAC up to the actual intended supply voltage, so that might mean amplifying by a factor of up to 8 times. The resistors in that amplifier will probably cause more error then the PWM dac. It really does not matter though. If a basic 25V supply is accurate to 10mV, that is impressive. I am not going to try for 100uV accuracy for the power supply. If I need high stability, I am happy to run the supply for half an hour to let it stabilize thermally.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: markus_b on April 24, 2012, 06:48:54 am
Every half decent power supply I have built or used can easily last for decades. I want to end up with something that has an efficient interface that lets me switch from rough control to very fine easily.
I would go for a rotary encoder. Turning a knob is still the best use-interface for fine-tuning stuff. If you take one with a built-in push-button you can switch between fast/slow easily. I also like software-controlled accelleration. If you turn is slowly you change in 1mV steps if you turn faster it changes in 10mV steps, if you turn very fast you change in 100mV steps.

Also a rotary encoder needs 2 pins, like two pushbuttons, there is no difference in consumption of port pins.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 24, 2012, 07:18:15 am
Every half decent power supply I have built or used can easily last for decades. I want to end up with something that has an efficient interface that lets me switch from rough control to very fine easily.
I would go for a rotary encoder. Turning a knob is still the best use-interface for fine-tuning stuff. If you take one with a built-in push-button you can switch between fast/slow easily. I also like software-controlled accelleration. If you turn is slowly you change in 1mV steps if you turn faster it changes in 10mV steps, if you turn very fast you change in 100mV steps.

Also a rotary encoder needs 2 pins, like two pushbuttons, there is no difference in consumption of port pins.
That is the direction I am leaning, even though it means a more complex build.

One of the build options I have been considering is a small box (battery or power adapter powered) like a large smartphone size and about 15mm - 20mm thick. With touch switches, the back of the PCB can also form the top of the case, with perhaps a thin plastic sheet on top. This would be a lower power version - perhaps 200mA. I do not need a heatsink, so the actual power supply board using surface mount parts can be very thin.

You would have this sitting flat on the bench right next to the load. Once I start adding knobs and switches though, I am not sure that idea works as well. If I add a knob, it will probably have to be one that can be switched between volts and current adjust easily.

Dave is right about the importance of packaging. It is probably the hardest part of the project.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: BravoV on April 24, 2012, 07:37:45 am
Richard, forgot to ask, on the pwm generator, what is your decision ? A separated and dedicated mcu for pulse generation ?
Title: Re: General Purpose Power Supply Design
Post by: markus_b on April 24, 2012, 07:55:51 am
Dave is right about the importance of packaging. It is probably the hardest part of the project.
Yes, very true.

I'm leaning towards a similar small box as Dave is using. I like the vertical front as this allows me to stack them up on the shelf. I may have several of them.

For Volts/Amps I think I prefer separate knobs. You could also switch between the two using the pushbutton, but there is always the danger that you change the wrong thing. Some additional buttons for special functions would be nice too. Something like 'Menu', 'OK', 'Cancel'.

I also like a graphic LCD, something like the 65x128 display from newhaven. Does not cost more than a character display, but gives more options for future firmware with interesting features, like displaying current spikes, etc. The only catch is that you think I'd need a microcontroller with enough flash to hold a character table.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 24, 2012, 08:07:37 am
Richard, forgot to ask, on the pwm generator, what is your decision ? A separated and dedicated mcu for pulse generation ?
A single micro in the supply.

The PWM drives a cmos logic gate powered by the reference to generate the precision PWM output. I will probably stick to an Arduino processor, but I will have to see how the pin allocation goes - there are never enough. I see programming a micro as being a frustration to many people who want to build the supply, and Arduino probably gives the easiest way in. You can buy a $20 Arduino, and use it to program another blank Atmega IC - or you can just buy the IC pre-programmed with bootloader from any Arduino supplier.

There are great chips in TI's MSP430 family, but there is just no cheap way to program them. As far as I know, the cheapest way to start is a $99 device from TI.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: markus_b on April 24, 2012, 08:27:37 am
The PWM drives a cmos logic gate powered by the reference to generate the precision PWM output. I will probably stick to an Arduino processor, but I will have to see how the pin allocation goes - there are never enough. I see programming a micro as being a frustration to many people who want to build the supply, and Arduino probably gives the easiest way in. You can buy a $20 Arduino, and use it to program another blank Atmega IC - or you can just buy the IC pre-programmed with bootloader from any Arduino supplier.
Why not building it as Arduino shield ?

Then you can concentrate on the power stuff and sort of offload the microcontroller/programming related worries to the Arduino. Things like providing a chip with an Arduino bootloader will be take care of. It also sort of fixes the form-factor.
Title: Re: General Purpose Power Supply Design
Post by: Leo Bodnar on April 24, 2012, 09:38:53 am
Have you considered using standard 24 or 18 bit delta-sigma audio DAC?  They are very cheap and interfacing to I2S is trivial.  You can drop the sampling clock rate to match your MCU internal frequency.

Leo
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 24, 2012, 11:08:46 am
Have you considered using standard 24 or 18 bit delta-sigma audio DAC?  They are very cheap and interfacing to I2S is trivial.  You can drop the sampling clock rate to match your MCU internal frequency.

Leo
The problem is they are not designed for DC stability, and there is usually nothing in the spec to tell you much about DC stability. They may be cheap, but cheaper then a few resistors and capacitors, and a cmos gate IC? Also, the idea of this design was as much as possible use common parts - the delta-sigma DACs are moving slightly to the exotic.

Basically, as far as I can see, the micro implements a delta-sigma dac almost perfectly, so in a sense, I already have one. Why buy another?

Richard.
Title: Re: General Purpose Power Supply Design
Post by: Leo Bodnar on April 24, 2012, 11:26:15 am
Basically, as far as I can see, the micro implements a delta-sigma dac almost perfectly, so in a sense, I already have one. Why buy another?
To reduce output settling time by the factor of 1000?

Leo
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 24, 2012, 12:37:19 pm
Basically, as far as I can see, the micro implements a delta-sigma dac almost perfectly, so in a sense, I already have one. Why buy another?
To reduce output settling time by the factor of 1000?

Leo
It could be worth it for some people if you can tell me some DC stability specs for the delta-sigma converters.

I am pretty happy with the settling time I have for manual use, but it would be useless for, say, remotely controlled automated testing. Fast settling specs can become useless if the supplies do not have active pull down on the output - something I am considering.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: free_electron on April 24, 2012, 02:07:51 pm
I have to admit that i have not read the whole topic, but just a quick sidenote ( this may or may not have been covered )
Are you using a PWM or a BRM ? In a BRM the pulse width is always fixed but the delay between them changes. This is typically made with an accumulator and checking for overflow.

In cpus this is very efficient.

Slow Timed interrupt :
Add reg, rate
If carry then {flag = true, clear carry}
Output = flag.
Return

Fast timed interrupt:
Flag =false
Return

Fast timed interrupt needs highest priority. So it can clear the flag.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 24, 2012, 02:17:11 pm
I have to admit that i have not read the whole topic, but just a quick sidenote ( this may or may not have been covered )
Are you using a PWM or a BRM ?
I am using PWM. It turned out to be very important that I was modulating an 8 bit PWM, as it means the fundamental PWM frequency is always 62.5KHz and this is high enough to be very effectively filtered out to DC. 16 bit PWM or BRM can end up with much lower frequency fundamentals that do not get fully removed by the filter.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: ejeffrey on April 24, 2012, 03:31:24 pm
I am using PWM. It turned out to be very important that I was modulating an 8 bit PWM, as it means the fundamental PWM frequency is always 62.5KHz and this is high enough to be very effectively filtered out to DC. 16 bit PWM or BRM can end up with much lower frequency fundamentals that do not get fully removed by the filter.

You should be aware that PWM can also generate low frequency components depending on the output code.  For instance, if you have 8 bit PWM @ 62.5 KHz and output the 24 bit code 0x800100 your PWM will be 0x80 for 255 cycles and 0x81 for 1 cycle, giving you a pulses at 244 Hz.  To solve this you have to use a multi-order sigma-delta. Basically this will allow the feedback loop to overshoot and use codes 0x7F and 0x81.  This pushes the noise to higher frequency where they can be filtered more effectively.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 25, 2012, 01:12:04 am

You should be aware that PWM can also generate low frequency components depending on the output code.  For instance, if you have 8 bit PWM @ 62.5 KHz and output the 24 bit code 0x800100 your PWM will be 0x80 for 255 cycles and 0x81 for 1 cycle, giving you a pulses at 244 Hz.  To solve this you have to use a multi-order sigma-delta. Basically this will allow the feedback loop to overshoot and use codes 0x7F and 0x81.  This pushes the noise to higher frequency where they can be filtered more effectively.
I haven't looked at a multi-order sigma delta at all yet, but it sounds like more cycles of processing in the PWM interrupt that can be a problem. Until I was told, I never knew I was designing a delta-sigma PWM.

But to really understand the noise from my PWM, we have to do some really difficult and complex calculations - well actually no, it turns out to be extremely easy. Don't need to look at a single textbook. Just a bit of LTSpice.

Lets just take my RC filter time constant (100K/0.22uF) as fixed, the micro speed (16MHz) as fixed and the PWM speed (62.5KHz) as fixed. The rejection of anything above above 1Khz is close to absolute - less then 30nV rms on the 25V power supply output. To verify that, all you have to do is work out the impedance of the .22uF cap at 1KHz, and then use that to work out the attenuation of each stage.  As a result, we can ignore totally the normal 62KHz PWM output, and all we have to look at is the effect of the corrections - we can treat them as separate pulses.

The worse case is a single correction pulse, all thanks to the way the algorithm I am using that spreads corrections out evenly.

A single pulse when scaled to the output voltage is 30V in amplitude and 62.5 nS wide (1/16MHz). Here is the result at the output for a 3 stage RC filter and a 6 stage RC filter. The input pulse is too short to plot in the graph but it is there at time 0.0:

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=23564)

These waveforms say everything. The worse case noise will be 9uV p-p which means the worse case RMS noise will be around 3uV RMS. If I used a 6 stage filter, you get about half this.

I think the truth is that 9uV of low frequency noise is low enough to be fine - Agilent are proud to boast that their E36xx series supplies have less then 0.35mV of RMS noise.  However, all  you need to do to reduce the noise further is to control the minimum rate of the error correction. It is a very simple matter of controlling the resolution of the PWM numbers I use. Lets use pulses at 20Hz. you get this:

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=23566)

The 3 stage filter noise has dropped to just over 1uV RMS, and with a 6 stage filter, the noise is essentially gone.
The cost of limiting the minimum correction pulse frequency to 20Hz is that you loose resolution - the smallest adjustment step is 40uV. What is happening is the next correction pulse arrives well before the first has decayed so they combine reducing the peak to peak noise.

I prefer to leave the resolution unlimited, and the user can add a big cap on the supply output terminals if they need lower ripple for some reason. I just think that if you are trying to run a circuit from a power supply that is sensitive to very low frequency noise at the uV level, you will be struggling anyway, particularly if the supply has noise generating microprocessors, a switching pre-regulators, etc.

For people who want minimum noise at the expense of resolution, it is one line of code that needs to be changed.

I could go to a 6 stage filter, but I am not sure it is worth the trouble. I just do not think anyone will notice the difference in reality. With one more capacitor in the gain stage that amplifies the reference output, I can reduce the worse case peak-to-peak noise from 9uV to 5uv and that is probably where I will stop.

It's good enough. It is easy to get carried away with making the numbers look perfect when in reality, it just does not matter. When your load current increases by 1mA, you will get a 9uV+ change anyway due to the resistance of your power leads to the load.

Richard.

EDIT: Thinking about this a bit more, I will limit my resolution to 24 bits. This gives me a minimum adjustment step size of 2uV and the worse case noise will be 7uV p-p. In terms of RMS, it will be more like 1.5uV RMS noise at 1Hz minimum frequency. By setting a minimum frequency for the correction noise, it means that if you needed a super low noise output, add a resistor and capacitor to the output with a time constant over 10 seconds. Going to a 64MHz ATTiny PWM doesn't improve things as much as you would think - you would need 128MHz PWM clock or more to get big improvements. With the ATTiny's 64MHz PWM, I would be worried that jitter might make it worse then the 16MHz Atmega PWM.
Title: Re: General Purpose Power Supply Design
Post by: IanB on April 25, 2012, 01:40:26 am
I may not be the only one, but I have a complete mental block on how a sigma-delta algorithm works in this context (and Google doesn't help).

Maybe you could explain it in words of one (mathematical) syllable?

For instance, this is where I am stuck. Suppose you have an 8-bit PWM, and for one cycle you output a value of 200. This corresponds to an analog value of 200/255. If you output 200 indefinitely you get a constant output of 200/255.

Now suppose you output 200 for one cycle, and 100 the next cycle. At this point you care about the filtering. With no filtering at all, the output makes a step change from 200/255 to 100/255. However, with some filtering the output moves slowly from 200/255 to 100/255. By measuring the output at different times you could measure any value between 200 and 100. If you alternate between 200 and 100 you could obtain an average value somewhere between the two. If you adjust the mark/space ratio of the 200 and 100 outputs you could position the average value anywhere in the range you wish. In particular, if you alternated between 200 and 199 you could set the average output at some fractional value between those two limits.

Where I get stuck, is what is the actual algorithm you are using to do this, in layman's terms? You posted some code before, but I couldn't deduce what it was actually doing.

Help me out here, and perhaps you will help many others?
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 25, 2012, 02:25:16 am
I may not be the only one, but I have a complete mental block on how a sigma-delta algorithm works in this context (and Google doesn't help).

Maybe you could explain it in words of one (mathematical) syllable?
I am just going to explain it.

 Say I take my Atmega328 IC, and apply a 255V supply-  imagine this chip can take it.

Then when you use the 8 bit PWM, if you send it 123, you get 123V DC out from the filter.

What happens if you want 123.3V DC out?

The way I am doing it is this. The first PWM cycle, I use the nearest lower PWM number, so I output 123V for one PWM cycle. I add the error (0.3V) to the value I want to the next cycle so that makes 123.3 + .3 = 123.6.

I repeat the same steps as above, so the nearest lower value I can output is 123V for the second PWM cycle. Total error is now 0.3V + 0.3V = 0.6V.

Repeat again - the value I want this time is 123.3 + 0.6V = 123.9V. So for the third PWM cycle, I output 123 V again, leaving an error now of 0.9V.

On the 4th cycle, I want 123.3 + 0.9V = 124.2 V, so this cycle I output 124 and the error is now 0.2 .

So all I am doing is keeping a running count of the error from the last PWM output, and adding it to the original value I want for the next cycle.

To implement this in code is amazingly easy. This code is run every time the timer counter for the PWM wraps around to zero:

Code: [Select]
  OCR2A = (byte) (pwm_accum / 0x01000000L ) ;  // Output the top byte of my PWM accumulator to the PWM
     // since the PWM uses double buffering, this code will only reach
     // the PWM registers the next time the timer counter reaches 00.
     // This way, the PWM never changes in the middle of a PWM cycle - it only changes just as it is about to
     //     start a new cycle.
  pwm_accum &= 0x00FFFFFFL ; // Delete the top byte leaving just the error
  pwm_accum +=  value ;  // Add the original intended value to the error in the accumulator for the next PWM cycle


Just those 3 steps turn an 8 bit PWM to in this case a 32 bit PWM as my accumulator happens to be 32 bits in size. To actually get 32 bit DC out, I would have to use a filter with a time constant of about an hour though. You can basically choose any resolution you want just by adjusting the number of bits in the accumulator.

In diagrams of sigma-delta PWM's you will see an integrator. My PWM accumulator register is the integrator.

A really interesting thing to come from this is that if you wanted to get 16 bit accuracy, an 8 bit PWM with 8 bits of correction far exceeds the performance of a straight 16 bit PWM. The 16 bit PWM needs a filter time constant for a 3 stage filter of about 1 second. The 8 bit corrected PWM (or sigma-delta or whatever you want to call it) only needs a time constant of about 20 mSecs for a 3 stage filter to equal the 16bit PWM. That is an amazing improvement in speed.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: IanB on April 25, 2012, 03:53:45 am
Ah, that almost seems too simple. I will have to reflect on that a bit and convince myself that it always has the desired outcome. Thanks.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 25, 2012, 04:54:38 am
Ah, that almost seems too simple. I will have to reflect on that a bit and convince myself that it always has the desired outcome. Thanks.

People understand money really well, so a money analogy might convince you.

Say you have to pay Joe $500 a year, but you have to pay every day, and you have to pay in $1 coins.

Now if you pay $1 a day, that is $365 a year - too low. $2 a day and that makes $730 a year - ouch! Definitely not going to do that.

Joe is a really nice guy and he doesn't mind if you owe him less then $1.

So you work out that you need to pay $1.369863 a day for 2011 (no leap year).

You pay him each day the amount owed rounded down to the nearest dollar and and add the error (the cents part of the amount owed that you didn't pay) to the amount you owe the following day.

At the end of the year, you will have paid exactly $500.  In the case of my accumulator, each day you would have added 1.369863 and each day you will have subtracted the actual coins you have paid. At the end of the year, you will discover the accumulator = 365 * 1.369863 - 500*$1  = $0. It is that simple.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: Leo Bodnar on April 25, 2012, 08:10:21 am
There are multi-level delta-sigma DACs that use two or more level outputs.  Say you have two outputs - 100% level output and 10% level output. 
For 1% output instead of triggering main output each 100th cycle you trigger 10% output each 10th.  This increases settling time by a large margin.
Second and further level outputs don't have to be of high precision because they are only "filling the gaps" between the main output action if this makes sense.

Leo
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 25, 2012, 08:31:53 am
Leo, it makes perfect sense and I have been considering something like that. Something like an 18 bit + a 6 bit secondary PWM would be nice, but it does mean extra parts, and without a negative supply rail, summing the two together gets a bit messy.

So good idea, but the extra parts may end up ruling it out unless I can find a great way to implement it.

Have to admit that right now, I am struggling with something else - the controls. I am not convinced that contact-switch based rotary encoder are reliable. The moment the contacts start bouncing, it is really hard to decode them reliably. I would love to find a cheap optical rotary endcoder.

Richard.

Title: Re: General Purpose Power Supply Design
Post by: markus_b on April 25, 2012, 11:40:04 am
Have to admit that right now, I am struggling with something else - the controls. I am not convinced that contact-switch based rotary encoder are reliable. The moment the contacts start bouncing, it is really hard to decode them reliably. I would love to find a cheap optical rotary endcoder.
There rotary encoder code has been discussed on the forum before. There is a simple and reliable code here: Buxtronix: Rotary encoders, done properly (http://www.buxtronix.net/2011/10/rotary-encoders-done-properly.html). The code is for Arduino, but translates to C easily.
Bounce is not a problem at all with that code, the state machine seems immune to simple bouncing. If implemented with simple polling, the polling speed determines the speed you can read the encoder, though.

On the other hand I've played with encoders with 18 steps/revolution and find that too granular, I suspect that the standard 24 step types are not fine enough yet for my taste. So a optical, high resolution encoder would be welcome.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 25, 2012, 12:51:18 pm
There rotary encoder code has been discussed on the forum before. There is a simple and reliable code here: Buxtronix: Rotary encoders, done properly (http://www.buxtronix.net/2011/10/rotary-encoders-done-properly.html). The code is for Arduino, but translates to C easily.
Excellent. I missed that discussion but the code is a big help.

I don't see why optical encoders based on the mouse optical encoders that must cost nothing can't be available in a front panel control mounting. They would almost last forever, rather then 20-30000 rotation cycles. But I will probably have to go with a mechanical one.

Do I go with a $1 Chinese one that lasts "30,000 cycles" ?? or a 200000 cycle Bourns one at $4-$5.  $5 will more then cover the costs of all the parts of the regulator circuit - with lots to spare.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: BravoV on April 25, 2012, 01:00:44 pm
I don't see why optical encoders based on the mouse optical encoders that must cost nothing can't be available in a front panel control mounting.

Hey, that is a really cool idea, this will turned into nice thumb wheel with a push button too rather than ordinary knob style.

Time to search those old or broken mouses scattered somewhere in house.  ;D
Title: Re: General Purpose Power Supply Design
Post by: Leo Bodnar on April 25, 2012, 01:50:11 pm
Richard, I can't grasp what you are trying to design.

On one hand you are chasing sub-microvolt resolution that only makes sense if other equipment is of the same precision range (which means $$$.)
On the other hand you are dithering about using a $5 encoder.

Leo
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 25, 2012, 02:30:17 pm
Richard, I can't grasp what you are trying to design.

On one hand you are chasing sub-microvolt resolution that only makes sense if other equipment is of the same precision range (which means $$$.)
On the other hand you are dithering about using a $5 encoder.

Leo
I am going for really really cheap using the most common parts, but I want really really great performance. That is all I ask.

About the resolution, I want something like the old power supplies could do with the course/fine controls - but hopefully a bit better. They could easily be adjusted to better then 1mV, whereas a 25V supply with a 12 bit DAC can only be adjusted in steps of 6mV, or with more convenient scaling 10mV. That is a huge leap backwards. Accuracy doesn't matter since everyone will probably attach a DMM if they want an accurate voltage anyway.

To me, a supply should be adjustable to at least 10uV. That is a starting point. I am not interested in building a supply if it is not as good as the common supplies built 40 years ago.

The reason I am going for cheap is I am trying to build the kind of board that rather then just making one, you could make 5 or 10. I love parts costing less then 10c. Parts costing $1 will be very rare in this design.

I have a way the modules can be used in series in a master slave fashion so with 4, you get a 100V supply, or in parallel in a master slave fashion so with 5 modules, you get a 25V 5A supply. The slave boards do not need micro's. displays, etc, so the whole slave regulator board will be the PCB + under $10 in parts.

Richard.

Title: Re: General Purpose Power Supply Design
Post by: Leo Bodnar on April 25, 2012, 02:56:03 pm
Accuracy doesn't matter since everyone will probably attach a DMM if they want an accurate voltage anyway.
To me, a supply should be adjustable to at least 10uV. That is a starting point. I am not interested in building a supply if it is not as good as the common supplies built 40 years ago.
Parts costing $1 will be very rare in this design.
Does this mean your PSU will have less then 10uV of output noise and matching load regulation?  I can't see this built with sub-$1 parts.  Well, if it can be, I'd take my hat off. 

Leo
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 25, 2012, 03:18:25 pm
Accuracy doesn't matter since everyone will probably attach a DMM if they want an accurate voltage anyway.
To me, a supply should be adjustable to at least 10uV. That is a starting point. I am not interested in building a supply if it is not as good as the common supplies built 40 years ago.
Parts costing $1 will be very rare in this design.
Does this mean your PSU will have less then 10uV of output noise and matching load regulation?  I can't see this built with sub-$1 parts.  Well, if it can be, I'd take my hat off. 

Leo
Probably not, particularly with noise from micro's, and sometimes switching pre-regulators around. But as I said recently, you can add a big external cap if you want lower noise. Also many of the applications where you want the high resolution don't care much about noise. Say I want to set it to 10.00000V out using a precision DMM, so I can test other DMM's. The DMMs on the DC ranges can all handle low level noise without a problem.

With a 12 bit DAC based supply, you will end up with a voltage like 10.002625 and you have to mka e do with that.

And with the DAC, the power supply is not the only point. When I started playing with the idea, I though 1% accuracy would be fine and 0.1% would be really good. When I see that the same basic circuit can probably do 0.01% or lower with just a few improvements, that is really interesting, isn't it? Not for the power supply but for other designs. I am fascinated that at almost no cost, you can get into the realm of the really expensive DACs. I like the fact that I can now say "Yes I can use a PWM output from a micro to build a 24 bit Dac with really great linearity, and perhaps great accuracy for next to nothing". A month ago, I would have said "No way can you do it - you will just have to get the checkbook out and pay big money".

Maybe it is just me.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: ejeffrey on April 25, 2012, 05:35:57 pm
I am fascinated that at almost no cost, you can get into the realm of the really expensive DACs. I like the fact that I can now say "Yes I can use a PWM output from a micro to build a 24 bit Dac with really great linearity, and perhaps great accuracy for next to nothing". A month ago, I would have said "No way can you do it - you will just have to get the checkbook out and pay big money".

I don't think it is fair to compare your DAC to commercial offerings.  The settling time of your DAC is going to be 10s of seconds, whereas a commercial sigma-delta DAC costing < $5 will have a settling time of 10s of microseconds.   That isn't to say that your DAC is useless, but the brute force solution of using extremely slow filtering is not suitable for many applications.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 25, 2012, 06:41:23 pm
The settling time of my DAC is something like 0.6 seconds worse case to a millivolt. 10s of seconds would be useless. For small adjustments, it is much faster.

It is a DAC so of course it is fair to compare it to other DACs.

It is slower, but it has great linearity and resolution. I am making a power supply, not a video card or waveform generator.  Commercial sigma-delta DACs could be interesting if there is one spec'd for DC stability.

Richard. 
Title: Re: General Purpose Power Supply Design
Post by: Leo Bodnar on April 25, 2012, 06:54:36 pm
I can't believe that discussion about a PWM output fed into an RC filter has spread over 13 pages! ;)
Leo
Title: Re: General Purpose Power Supply Design
Post by: A Hellene on April 25, 2012, 07:41:47 pm
Why not, Leo?

Is the practical implementation and testing of such a technology being taught in any textbooks? After all, what I can see happening over here is a bunch of (bigger) boys having a good time playing with their beloved toys! At least, this is the way I feel about it!

In my opinion, the journey to Ithaca (http://users.hol.gr/~barbanis/cavafy/ithaca.html) is more important than the destination itself.



Richard, I was impressed by the results you got from your last experiment! I think, though, that I will settle for components like LTC2641-16 and LT1461A-2.5, which I find to be more suitable for my PSU needs. But I am following your progress!


-George
Title: Re: General Purpose Power Supply Design
Post by: ejeffrey on April 25, 2012, 07:52:06 pm
The settling time of my DAC is something like 0.6 seconds worse case to a millivolt. 10s of seconds would be useless. For small adjustments, it is much faster.

My bad, I misread your capacitor as 2.2 uF instead of .22.
Title: Re: General Purpose Power Supply Design
Post by: IanB on April 25, 2012, 10:18:04 pm
Ah, that almost seems too simple. I will have to reflect on that a bit and convince myself that it always has the desired outcome. Thanks.

People understand money really well, so a money analogy might convince you.

Actually I am quite happy with the general principle. But with things like this I tend to ask myself if there are edge cases, or limitations in application that might present unforeseen snags?

For instance your monetary example involves small amounts $1/day averaged over a long period (1 year). But what if the amounts were larger ($100/day) averaged over smaller periods (like 1 month or 1 week)? Or given $1/day, how many days does it take before the error in the $500/year rate is reduced below some tolerance like 0.1%? Where are the limits? What is the noise on the output? Does the noise filter introduce its own errors due to filter lag? All kinds of questions arise...

(...which you have been investigating of course, but still.)
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 25, 2012, 11:55:52 pm
The worse case error calculation is pretty simple. In the case of the coins, then worse case error is $1 so after $500 has been paid, the worse case error is +/- 0.2%.

In the case of the PWM, just count the resolution of the intended voltage value you are using for your PWM. If it is 24 bits, then you have about an error of about 1/224 (providing everything else in the circuit is perfect and the filter time constant is long enough).
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on April 27, 2012, 01:39:36 am
Richard,

You've mentioned several times that everything is going to cost just a few bucks. Which reference you will be using to achieve that and still have good stability in the 10's of uV, even if it is short term?
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 27, 2012, 01:54:06 am
Still thinking about that. It might even end up being something as basic as a TL431. I only need it to be stable after temperatures have stabilized, even if that takes an hour. Most of the time, no great stability is needed at all. For general use without a warm up, then better then 1% is fine, as far as I am concerned.

The reason why I may go for a TL431 is that this circuit like Dave's runs with any voltage from a battery voltage which might be a lithium battery or 3 or for AA cells up to 27V. So that means 3V to 27V . I need a low dropout reference, and as part of the design exercise I set myself, I am minimizing specialized parts. I have a TL431 + transistor combination in mind to make a wide range low dropout 2.5V reference.

I have a TL431 somewhere, so I think I will have to do a test. A TL431B should give about a 0.2% stability over a wide temperature range. The temp coefficient curve for the TL431 flattens in the middle of the range, but they are a bit vague about the actual temperatures where it does  flatten.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 27, 2012, 02:25:43 am
Just checking. Linear Technology have the LT1431 which is a higher spec'ed TL431.

I have got the short term stability I need in the past out of a LD117 LDO regulator, and definitely the LT1431 is more stable. So if I go with the LT431, then if people want better performance, they can use the LT1431.
Title: Re: General Purpose Power Supply Design
Post by: BravoV on April 27, 2012, 03:13:43 am
Richard, does the selection of the logic buffer for the pwm signal is critical ? or any jelly bean mos based buffer is good enough ?

Also regarding the precision voltage source, it supplies current only to these buffers right ?
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 27, 2012, 03:30:32 am
The buffer is a little critical, in that I found that 4000 cmos was too slow and was inaccurate. It has to have cmos output, so you cannot use the buffer chips with cmos input stages and transistor output stages.  Most fast CMOS logic chips should be fine.

It is giving me a few options, as I might be able to pick a chip with a spare gate or two that are useful elsewhere.
Title: Re: General Purpose Power Supply Design
Post by: BravoV on April 27, 2012, 05:54:19 am
The buffer is a little critical, in that I found that 4000 cmos was too slow and was inaccurate. It has to have cmos output, so you cannot use the buffer chips with cmos input stages and transistor output stages.  Most fast CMOS logic chips should be fine.

It is giving me a few options, as I might be able to pick a chip with a spare gate or two that are useful elsewhere.

Ok, no 4000 cmos series, but with bipolar input and cmos output, which series is that ?
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 27, 2012, 06:37:18 am
Just about all the cmos logic chips are fine. Some of the driver chips, particularly cmos input mosfet drivers are often bipolar output. If a mosfet driver had a cmos output, it would probably be excellent.
Title: Re: General Purpose Power Supply Design
Post by: BravoV on April 27, 2012, 08:03:36 am
Just about all the cmos logic chips are fine. Some of the driver chips, particularly cmos input mosfet drivers are often bipolar output. If a mosfet driver had a cmos output, it would probably be excellent.

Your 1st test that was using CD4069 has cmos output and input, but quite slow with transition time @5Volt is 150 ns.

Here your simplified 4069 schematic from it's datasheet :

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=23644;image)

I'm not nitpicking, its just I'm curious on how this buffer choice affects the accuracy performance ? Faster transition time is better right ? Really eager to learn here.  ;)
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 27, 2012, 08:22:56 am
it is all about transition speed. Imagine a minimum width PWM pulse of 62.5ns trying to get through a gate with 150nS delay. Basically the cmos buffer characteristics dominate the shape of the waveform, not the reference voltage. You end up with a triangular looking pulse that never reaches maximum.

If you choose a cmos IC with 10-20nS delay time, you get a good looking squarewave out and the top and bottom do reach the reference and zero voltage levels.

If you look at the PWM cycle, with a 10nS rise/fall time gate, 20nS out of 62.5mS are spent in the transitions. That is 0.033 percent of the time. Now if you assume that the rise and fall shapes will stay within about 10% of a normal shape, then you get down to 0.0033% linearity.

A cmos gate with very similar rise and fall time shapes would be ideal. A really fast gate such as 5nS or less could improve this more, but the faster the gate, the more chance transients may affect the levels. Really good decoupling is needed. I will probably use something like a 0.1u capacitor and a 1nF capacitor, and also the first filter capacitor will be very closely coupled to the gate.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on May 10, 2012, 12:36:45 am
Any news on the supply? I'm curious about the Rev. 3 :)
Title: Re: General Purpose Power Supply Design
Post by: amspire on May 10, 2012, 01:11:50 am
Apologies - I will post some news soon. I had started drawing the circuit, and then had an idea about an improvement that would need a slight redesign to the board.

The design is based around a PCB module that does all the regulation, and a pre-regulator - either linear or switching.

What I realized is that rather then limiting the maximum voltage to 25V, if the regulator board is powered by a floating supply that is isolated from the main supply to the pre-regulator, I was no longer limited to 25V maximum. The maximum voltage is only limited by the voltage rating of the pre-regulator so you could easily use the board to make a 50V, 100V or 500V supply - whatever you choose to make. As the regulation is still done on the board, the different voltages do not need any redesign of the compensation network.

However the moment I do allow the module to run in a floating mode, I have to look very carefully at making sure that the supply is still fully protected under fault and overload conditions. I also have to look into what sorts of pre-regulators will work reliably with the floating regulator module.

The pre-regulator can be as simple as a NPN darlington transistor used as an emitter follower. Use of MOSFETs is a bit more of a problem with the big variations in the gate turn on voltages. I would probably have to lower the maximum current a bit if a MOSFET was used so I can cover the gate voltage variations.

The module will still run in non-floating mode, and if you only need a 250mA supply, it can be used without any pre-regulator. The pre-regulator is only needed if the total power dissipation exceeds about 5W.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: HackedFridgeMagnet on May 10, 2012, 04:25:52 am
I am looking forward to making this design up Richard. Thanks for all your effort.
My current PSUs are not really up to scratch, just cheap kit supplies.
Are you going to layout the pcb, and specify hardware?
I really like the idea of very high resolution and good stability and just using my DMM to set the voltage accurately.
Obviously I like the preregulator too, but I would have thought this was fairly standard  these days.

Kudos to you too AHellene, I hope some of your code or ideas will be in the firmware, I would like to compare it against some of my AVR code, to look for improvements that I could include in mine.
Title: Re: General Purpose Power Supply Design
Post by: BravoV on May 14, 2012, 07:24:03 am
A bump for this fine thread, and really curious to see the next revision of linear front end part.  ;)
Title: Re: General Purpose Power Supply Design
Post by: heychris on May 15, 2012, 04:37:34 pm
I was wondering if anyone had thought about putting a couple USB charger ports on here.  I know that I have several USB wall warts I'd like to get rid of.  I know there needs to be a circuit to negotiate with chargers.  I've played with the TI tps2543.  http://www.ti.com/product/tps2543 (http://www.ti.com/product/tps2543)   It works quite well.
Title: Re: General Purpose Power Supply Design
Post by: amspire on May 16, 2012, 12:10:40 am
I will get back to posting some circuits today. The basic regulator board will not have a USB charger output, but there will be a separate isolated full featured control board, and that could have a USB charger.

The issue is that a USB charger outputs really need 5V at at least 1A to cope with modern phones and Kindles, and that is just not available on the basic regulator board.

Anyway, I just do not like USB outputs that are floating at the same potential as the power supply negative output. The whole idea of a floating output is you can connect it to anything - a 400V DC line, or a high voltage AC line, and I hate to think of a USB charging output at the same potential.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: markus_b on May 16, 2012, 09:16:35 am
I would leave the USB charging port out. While it can come handy at times, this is better served with a dedicated item. I have a four-port USB power supply at my desk for these needs. I also agree that separate potential for the lab power supply and USB devices are a good idea, other wise you are setting yourself a trap to break something down the road.
Title: Re: General Purpose Power Supply Design
Post by: amspire on May 16, 2012, 12:25:27 pm
I would leave the USB charging port out. While it can come handy at times, this is better served with a dedicated item. I have a four-port USB power supply at my desk for these needs. I also agree that separate potential for the lab power supply and USB devices are a good idea, other wise you are setting yourself a trap to break something down the road.

I will probably leave it out. The best way to add a USB port that is isolated from everything else is to buy a $5 USB adapter, break it open and put the board inside the supply. Why not just leave the adapter as it is in its fully double insulated rated adapter enclosure.

If I add a USB port to the version with a full control panel that will probably be able to control several supplies, it will be because it is functioning in some way as a USB port (such as datalogging, or programmable sequencing) rather then just being a 5V supply output.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on May 16, 2012, 03:10:54 pm
I will get back to the supply design.

Below I have the basic regulator, but the circuit will be changing a lot over the next few days as I add in the voltage and current reference components, the pre-regulator, high voltage mods and a few other enhancements.

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=24411)

I have settled on a PNP pass transistor, but instead of using a single PNP on a heatsink, I have gone for multiple 2N2907A transistors, or PZT2907A surface transistors on 1 square cm of PCB as a heatsink. The driver transistor is a 2N2222A or PZT2222A for surface mount use. The regulator board can have up to a 5V voltage drop at 1A without any heatsink. I am assuming the board will run at 75 deg C or less. A pre-regulator circuit will allow for the full 0 to 25V range at 1A.

You get a few things with this approach - the transistors can be very cheap particularly in quantity, and the transistors are operating at an optimal DC gain operating point at maximum output current.  There are specialized high gain PNP transistors from companies like Zetex that impressive performance, but the price is higher and the availability is lower. The bandwidth is good, and by eliminating an extra darlington-type gain stage, I get a much better stability margin. I think it will work well - better then my Mark I and Mark II designs.

The intended output is from 0V to 25V maximum for this configuration, but I will have a high voltage configuration that can go much higher without having to redesign the compensation circuit.

In the circuits I will be posting in the next few days, I will be giving three basic circuit choices:

1. Potentiometers for voltage and current control - meter modules for measuring voltage and current.
2. Basic microprocessor control with very basic single supply interface
3. Powerful controls on a separate isolated PCB that can drive several isolated regulator boards. Regulator boards have a simple microcontroller and talk to main controller via optocouplers.

I may also allow for paralleling modules for more then 1A output, and also master slave use for multiple tracking supplies.

I had done a fair bit of work on an isolated switching pre-regulator, but I am concerned about output noise, and the ease of making the transformers. I am not convinced I will go that way yet.

Linear pre-regulators are a simpler solution, and will definitely be an option.

More soon ....

Richard.

Title: Re: General Purpose Power Supply Design
Post by: markus_b on May 16, 2012, 03:58:09 pm
Richard, I find your solution interesting.

But I'm not convinced that it is better/cheaper than Daves version with a single LT3080. The 2n2907A is $0.80, a LT3080 is $4 so the price is about the same. But I'd feel more comfortable with the TO220 LT3080 screwed to a heatsink dissipating 25W than the same spread over 9 TO-18 devices with their flimsy heat-sinks.

The 25 W is probably about the worst case when drawing a full amp at low voltage.
Title: Re: General Purpose Power Supply Design
Post by: amspire on May 17, 2012, 01:03:48 am
Richard, I find your solution interesting.

But I'm not convinced that it is better/cheaper than Daves version with a single LT3080. The 2n2907A is $0.80, a LT3080 is $4 so the price is about the same. But I'd feel more comfortable with the TO220 LT3080 screwed to a heatsink dissipating 25W than the same spread over 9 TO-18 devices with their flimsy heat-sinks.

The 25 W is probably about the worst case when drawing a full amp at low voltage.

The 2N2907A is below 10c - if not you are being ripped off. In quantity, the prices get very low. The 2N2907A and the 2N2222A are exactly the kind of transistors it is great to stock in the lab anyway, so you can go for the 100 off prices without straining the wallet too much. I would use the TO92 devices, not the TO18 ones. The exact part number varies from manufacturer to manufacturer. The through hole version of the circuit relies on air cooling of the TO92 packaged transistors - no heatsink is used.  The PZT2907A and PZT2222A can dissipate over 1W, so they are pretty nice surface mount variations to have. I may have to increase the transistors to 10 for the through hole board.

My solution is fine, as long as I can limit the maximum dissipation on the board to 5W which amounts to about 3.6W peak in the transistors. My job is to see that the regulator board does not dissipate more then 5W continuous under any condition.

But why not just use Dave's LT3080? It is an extremely nice chip, but not perfect. Some of the problems are:

That list will do for the moment. The LT3080 is a brilliant chip, and Dave chose it for very good and sound reasons. My board is a different solution that will have its own positives and negatives.

Just to go back to the start, I was frustrated with the number of times people had to go to the LM317 IC to make a cheap power supply as it does not make a great lab supply. I initially wanted to see if I could come up with some kind of general purpose regulator board that could be used to make different supplies with different output ranges and current ranges without needing to design a new compensation circuit each time.

It looks like it just cannot be done - change a voltage divider or a regulator power transistor and you need to redesign the compensation. A really well designed power supply compensation circuit is very hard to do for any power supply as all lab power supplies relying on a feedback stabilization operate very close to instability. It is something impossible for beginners to get right, and it can be very time consuming to get right for experienced designers.

The reason why devices like the LM317 are so popular is they have built in compensation. Not perfect for all capacitive loads, but pretty good. The LT3080 also has excellent built in compensation.

There are IC's available that can drive an external MOSFET to make a linear supply, but I really do not like lab supplies using MOSFETS. The thing I just do not like is that if you switch a sudden overload on to a MOSFET supply, the Miller effect causes turn the MOSFET hard on causing  peak current in the 10s to 100s of Amps regardless of your current limit setting. This big current spike is something that can easily be eliminated in transistor-based supplies, but it is extremely hard to prevent in MOSFET based linear supplies. I have chosen to stick to transistor-based supply designs.

Inspired by some ideas in Dave's design - in particular the fact that the regulator was always adjusting for zero difference between the reference voltage in and the out voltage (no voltage dividers, so no loop gain change for different output voltage ranges) and the fact that the the supply to the reference circuit was allowed to change with the required output voltage - I started looking at a regulators board made from common parts that are extremely cheap to make a fully compensated module, and then work out how to add extra external parts to extend the range without affecting the regulation compensation.

Compensation ends up being much harder then looking at Bodes plots and getting the zero's and poles right. Things change for different currents, different voltages, different load capacitances, and even if you get stability with all those variations, then you have to look at conditional instability. If you tailor a load to force the regulating opamp into output slew rate limiting, you have changed the loop gain and opamp speed, and this can cause an instability that is not there with static loads. If you can force the opamp to saturate - more problems. Power supply compensation circuits can look simple when completed, but it can be a total nightmare finding that right solution. I bet there are many commercial lab supplies that are conditionally unstable and this is one of the things that separates the $1000+ quality designs from the $100 designs.

My board can be used directly to make a 0 - 22V 210mA supply or a 0-6V 800mA supply , and with an NPN darlington preregulator transistor, it could be extended to 0-25V at 1A. My latest idea would allow it to be extended further to almost anything -  in theory you could make a 0-1000V 1A supply. I will probably limit any designs to 60V maximum myself, but that will not be limited by my board.

I would be prepared to use my board to make an internal HV supply inside another project, but a HV lab supply is extremely dangerous - I really caution against the idea.

If I can get the module paralleling to work, then you can get 2, 3, 4 amps out and the modules will be cheap enough to make this economical.

All these supplies will regulate fully down to 0V.

At the moment, it is really hard to find any kind of generalized design that allows you to make a supply with exactly the voltage and current specs you need. Hopefully, this design will mean that there is at least one option available.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: markus_b on May 17, 2012, 08:47:30 pm
Richard,

You make an, excellent argument, way out of my league and experience to argue!

Personally I'm gunning for 30V/3Amps, sort of what a LT3083 can do. While it is a fine chip, it will have the same short comings as the LT3080 which you elaborated on.

A switching pre-stage will be an essential tool to get reasonable heat dissipation. The linear stage should only have to cope with 2V or so to keep the power losses down.

 I'm working on my own solution, using a 3080 for now, will show my hand when I'm confident not to be laughed out of the forum right away. :-).

Markus
Title: Re: General Purpose Power Supply Design
Post by: BravoV on May 17, 2012, 11:15:11 pm
Richard, thanks for posting the update, I did capture in ltspice and it seems like the lowest current in CC mode is around 700ma even the VRef for the current was set below 700mV like below example.

Any idea why ? Glitches at ltspice ?

Also attached the ltspice for the below circuit.

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=24449;image)
Title: Re: General Purpose Power Supply Design
Post by: amspire on May 18, 2012, 12:12:49 am
I did a few late changes without testing properly. I had reduced R10 to boost the drive current and I forgot to reduce R9. Make R9 330 ohms. Also add a 470 ohm from the output of U2 to ground.

When I finish my modifications, I have to go back and tweak the circuit a bit so there will be changes. I am sure I will change the current control a bit.  I will have to get my hands on a batch of PZT2907A and 2N2907A's to work out what gain I can expect for the range of 0.5V to 2V Vce. There are no specs for gain at low voltages, but it looks like gain of the 2N2907A is still very good at 1V.  The properties at about 1V will determine how much current I need through Q9, and after getting that right, I then have to tweak the compensation again.

It is one thing getting a design. it is another thing getting it to work with all the possible component variations.  This is a very much part time project, but I will try and get the bulk of the final circuit worked out over the next few days.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: sorin on May 26, 2012, 12:43:20 pm
What method you have used to calculate the value of PI regulator (R13,C1 ; R14,C2)???
thank you!
Title: Re: General Purpose Power Supply Design
Post by: amspire on May 27, 2012, 12:11:22 am
What method you have used to calculate the value of PI regulator (R13,C1 ; R14,C2)???
thank you!
I used LT Spice to open up the control loop ( a bit like a network analyzer) so I could look at the loop gain and phase. I then tried to adjust for a maximum phase shift of under 80 degrees from 100Hz to the unity gain point with no capacitors on the output (or less then 170 degrees with a huge lossless capacitor on the output). Many supply designs depend on a zero on the output caused by the esr of the load capacitance, and I am trying to avoid that so it will be stable with any capacitance.

To open up the loop, I add a resistor (perhaps 1Mohm) between R20 and the output, feed a signal source onto R20, and look at the output.

I will do something similar on the bench when I get to build a prototype, but I have been struggling to get time to work on this for the last couple of months. The bench work will be important as there is just not enough data in the datasheets to be able to do an accurate paper design.

It sounds like a fairly simple project and perhaps for a one off build, it would be. It is surprising how much work it takes for a really solid design that works with component variations and my design has always been more of a design exercise rather then a commercial product. Power supplies really do operate on the margins of stability which makes them much more work then you might expect. With a fixed load, it is not hard to get stability. With any load, it is hard.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on May 27, 2012, 01:35:30 am
Richard you might want to consider something like a NJT4031NT1G.
150mVcesat @1A
 
http://canada.newark.com/on-semiconductor/njt4031nt1g/bipolar-transistor-npn-40v-sot/dp/57M9869?ref=lookahead (http://canada.newark.com/on-semiconductor/njt4031nt1g/bipolar-transistor-npn-40v-sot/dp/57M9869?ref=lookahead)

An NPN pass device would simplify trying to compensate for every conceivable load, and esr  combination. The other advantage is no wasted base current.

I don’t think I’ve seen a GP Lab PSU with a PNP or PFET pass device, mind you I haven’t seen hundreds so who knows.

For those who don’t understand why Richard is having difficulty here is an application note from NATIONAL now TI.

www.national.com/an/AN/AN-1148.pdf (http://www.national.com/an/AN/AN-1148.pdf)
Thanks. That is a great transistor at a great price.

If you go back to the start, I did start with a NPN pass transistor, but it doesn't work as well as a PNP for low dropout mode (this power supply is always working with a low dropout). Of course the configuration can be changed to make it more conventional, but I really like many aspects of this low dropout configuration with the regulation that requires the output is the same voltage as the reference voltage.

What I found is that the PNP pass works great, as long as I can drive the base directly and do not use a darlington configuration. The moment I go to a darlington configuration, the compensation becomes far more critical.  PNP pass designs are widespread in IC regulators and they do perform well if you are driving the base with a current source. With the low dropout, I think the input noise rejection performance at higher frequencies was much better then the NPN circuit.

There are a small number of very high gain transistors, but I decided to really aim at common, extremely cheap parts. Why? I just decided to do it that way. Every time you replace a pass transistor, you have to restabilize the loop. 2907A transistors will always be available from many sources.

Will a njt4031nt1g transistor always be easily available? I doubt it.  Can I substitute it with transistors from other manufacturers without a redesign? Probably not.

The really big problem is that the manufacturers have lost interested in development on new discrete transistors which is a pity. New transistors are being developed all the time - in IC's. I cannot think of the number of times I wish I could get a discrete transistor that matches commonly used IC transistor. The super-beta transistors, the schottky base transistors, the transistors with a 30V base breakdown voltage, super matched transistor pairs, extremely low geometry transistors that work well down in the nA currents, multiple emitter transistors and multiple collector transistors. The standard CA3046 transistor array used in hundreds (thousands?) of analog scope designs has even been slated as obsolete and the supplies are disappearing. The manufactures could make something far superior to the ancient CA3046 today, but they don't bother.

The message is clear - mass production designs use IC's. The need for these devices as discreet designs have too low a volume to be worth much new development.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: BravoV on May 27, 2012, 09:04:37 am
I don’t think I’ve seen a GP Lab PSU with a PNP or PFET pass device, mind you I haven’t seen hundreds so who knows.
Agilent E361XA dc linear bench psu series uses mosfets like this below, partly captured schematic on the linear pass section :

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=24759;image)

The complete circuit is in here -> http://www.physics.fsu.edu/users/Wahl/labmanuals/instruments/ps/AgilentE361xAManual.pdf (http://www.physics.fsu.edu/users/Wahl/labmanuals/instruments/ps/AgilentE361xAManual.pdf)

I'm not qualified to comment though, but I'm guessing this must be good enough that made Agilent used this technique. Really eager to hear from experts on this linear pass configuration.

For those who don’t understand why Richard is having difficulty here is an application note from NATIONAL now TI.

www.national.com/an/AN/AN-1148.pdf (http://www.national.com/an/AN/AN-1148.pdf)
Thanks, good reading.

Title: Re: General Purpose Power Supply Design
Post by: amspire on May 27, 2012, 02:39:57 pm
Bravo,

The  HP/Agilent supplies are more conventional with enough extra supply voltage to drive NPN darlington pass transistors (in 3610A and 3611A) and MOSFETS (in 3612A). Definitely not a low dropout design, and as usual with HP, the custom transformer with a separate winding for the regulator circuit.

I still think transistors are superior to mosfets in terms of the current spike problems of mosfets when the output voltage drops suddenly. If I had to use mosfets, I would use mosfets, but if I have a choice, I use transistors.

The interesting thing is the manual shows three different voltage/current supply combinations all based on the same circuit and perhaps the same PCB. If you look, there are extensive component changes between the models, including all the compensation components.

That is the traditional problems of all supplies - change anything and the changes tend to cascade through the whole design. That is why it has been so hard finding a general purpose design.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: BravoV on June 02, 2012, 05:54:05 am
Richard, about finding the "right" compensation component's value, how hard is that ? Say I have a nice high power PNP with high beta even at high current instead of using multiple 2907s.

Will through trial & error with different compensation values possible ? Any guideline how to find them ? or its way too complicated for a hobbyist level ?
Title: Re: General Purpose Power Supply Design
Post by: IanB on June 02, 2012, 06:15:54 am
Richard, about finding the "right" compensation component's value, how hard is that ? Say I have a nice high power PNP with high beta even at high current instead of using multiple 2907s.

Will through trial & error with different compensation values possible ? Any guideline how to find them ? or its way too complicated for a hobbyist level ?

Broadly speaking I imagine this is difficult. This meaning of this magic "compensation" word is sometimes lost or not understood with overuse or use without definition. I'm in that boat. My understanding is that it means compensating for an unstable loop gain at certain frequencies.

However, stability is not the only goal. Achieving a loop that is stable under all circumstances is easy. They key thing is to make it stable while also responding fast enough to changes to keep things under control (supply changes or load changes, but especially load changes). If the circuit responds too slowly it ceases to be useful and so mere stability is not sufficient for success.

It follows that the design becomes something of a balancing act, sitting on a knife edge. Too far one way and it responds too slowly. Too far the other way and it is unstable. Given the nature of this balancing act trial and error is going to be difficult. You really need some analytical tools in your toolbox combined with some practical experiments to test the results.
Title: Re: General Purpose Power Supply Design
Post by: amspire on June 02, 2012, 06:22:09 am
Richard, about finding the "right" compensation component's value, how hard is that ? Say I have a nice high power PNP with high beta even at high current instead of using multiple 2907s.

Will through trial & error with different compensation values possible ? Any guideline how to find them ? or its way too complicated for a hobbyist level ?
The moment you change the transistors, you need to recompensate, and many of the PNP medium power transistors are slower and much harder to get a good broad compensation. I chose the 2907A as they really behaved very well. Trial and error s not always great, as it is really easy to get a conditional stability - it is stable until the right combination of load parameters, and then it is unstable.  Particularly this is an issue with loads that include low ESR electrolytics across the supply.
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on June 02, 2012, 10:23:06 pm
Here is the C code with the assembler the compiler generated:

Code: [Select]
ISR(TIMER2_OVF_vect) {

  OCR2A = (byte) (pwm_accum / 0x01000000L ) ;  // 16 cycles
  pwm_accum &= 0x00FFFFFFL ; // 7 cycles
  pwm_accum +=  value ;  // 11 cycles
}

Is that all the code needed for the 24 bit PWM? You se the value you want in the main loop and thats all?
Title: Re: General Purpose Power Supply Design
Post by: amspire on June 02, 2012, 11:09:10 pm
Here is the C code with the assembler the compiler generated:

Code: [Select]
ISR(TIMER2_OVF_vect) {

  OCR2A = (byte) (pwm_accum / 0x01000000L ) ;  // 16 cycles
  pwm_accum &= 0x00FFFFFFL ; // 7 cycles
  pwm_accum +=  value ;  // 11 cycles
}

Is that all the code needed for the 24 bit PWM? You se the value you want in the main loop and thats all?
Other then the setup code for the PWM and the interrupts, yes - that is all the code you need.

You have to make sure that no other interrupt routine is able to stop this interrupt from running and completing before the next PWM interrupt is due.

So either other interrupts have to be very short, or other interrupts have to re-enable the PWM interrupt in their first line of code so they will not block the pwm interrupt.

If the "value" is being changed regularly in the main loop, you may need some extra code to ensure that all bytes of "value" are written before the PWM interrupt is called. There are several ways to do this, but one way would be for the PWM to maintain a buffered copy of "value", and the PWM would look for a flag to indicate that a new "value" is available. This would mean an extra "if" statement is added to the interrupt routine.

If value is not changed regularly, you can probably live with any slight error in the output for one PWM cycle as value is changing. The effect will be hard to notice anyway and it is probably not worth worrying about.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: m12lrpv on June 03, 2012, 12:19:13 am
Is that all the code needed for the 24 bit PWM? You se the value you want in the main loop and thats all?
Here's a full test sketch I put together for a 12 bit implementation of this (I didn't need 24 bit).

I've already thanked Richard for developing this. The results are nothing short of brilliant.

Code: [Select]
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <digitalWriteFast.h>

LiquidCrystal_I2C lcd(I2C_ADDR,16,2);

unsigned int VoltageValue = 0;
unsigned int pwm_Voltage_accum;

void setup()
{
  lcd.init();                      // initialize the lcd
 
  // Print a message to the LCD.
  lcd.backlight();
  lcd.print("Hello, world!");
 
  pinMode( 13, OUTPUT );
  digitalWrite( 13, LOW );

  pinMode(A0, INPUT);

  SetupTimer2();

  VoltageValue = 4000;  // pin3

  digitalWrite( 4, HIGH );

}

void loop()
{
  int i, j;
  String TempString;
  int sensorValue = analogRead(A0);   
  sensorValue = analogRead(A0);   
  sensorValue = sensorValue + analogRead(A0);   
  sensorValue = sensorValue /2;
  lcd.clear();

  lcd.setCursor(0, 0);
  TempString = "A0 = ";
  TempString += sensorValue;
  TempString += "  ";
  lcd.print(TempString);


  delay(2000);
}

void SetupTimer2() {
  // Disable interrupts while setting registers
  cli();

  TCCR2A = 0xA3;
  VoltageValue = 0L ;
  pwm_Voltage_accum = VoltageValue ;
  TCCR2B = 0x01;  //1 gives no prescale 
  TIMSK2 = 0x01;   // Enable interrupt when Timer reaches OCRA
  sei();

}
ISR(TIMER2_OVF_vect) {
 
  //OCR2B = (byte) (pwm_Voltage_accum / 0x010L ) ;
  OCR2B = (byte) (pwm_Voltage_accum >> 4 ) ;  //Reduce from 12 bit to 8 bit
  pwm_Voltage_accum &= 0x00F ;
  pwm_Voltage_accum +=  VoltageValue ;
  if( pwm_Voltage_accum > 0xFFF ) pwm_Voltage_accum = 0xFFF;
}

Title: Re: General Purpose Power Supply Design
Post by: amspire on June 03, 2012, 01:11:17 am
I've already thanked Richard for developing this. The results are nothing short of brilliant.

Don't forget to thank George (A Hellene) for all the research and work he did in developing this PWM code.

By the way, if you are using  this PWM code, you have to check for the use of delayMicroseconds() in other libraries. This is the No1 source of errors for this routine on the Arduino.

delayMicroseconds() disables interrupts for the period of the delay. The Arduino LiquidCrystal library includes some very long delays involving delayMicroseconds(), and in my test code, I made a new local copy of LiquidCrystal.cpp and  LiquidCrystal.h (that I renamed) and I changed all the delayMicroseconds() calls (excluding calls to delayMicroseconds(1) - I do not change them) to calls to this new delay function:

Code: [Select]
void delayMicroseconds2(long delaytime) {
  long j;
  for (j = 0L; j <= delaytime/2L; j++)delayMicroseconds(1);
}

Not as accurate, but it allows for other interrupts to be serviced during the delay. This was just a quick hack to fix the problem, but it is not the best solution.

There is a better discussion of the issue at:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1248706486 (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1248706486)

It is possible to drive a LCD with no lost PWM interrupts.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: bingo600 on June 03, 2012, 05:58:53 pm
Regarding delays on the AVR
This is still the best (most accurate delay lib i have seen) for an AVR , if not using timers.

http://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_id=665&item_type=project (http://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_id=665&item_type=project)

/Bingo

Title: Re: General Purpose Power Supply Design
Post by: alm on June 03, 2012, 08:11:45 pm
What's wrong with the standard avr-libc util/delay.h?
Title: Re: General Purpose Power Supply Design
Post by: Bored@Work on June 03, 2012, 09:03:52 pm
What's wrong with the standard avr-libc util/delay.h?

For most practical purposes nothing. Under some circumstances the delay in avr-libc gets a few clock cycles wrong (thing of a kind of rounding). But that is irrelevant for most applications, because the surrounding code anyhow uses an unaccounted number of cycles. E.g. if you wrap the delay in some function, the calling of the function can anyhow (but must not) require some time. Or if you wrap the delay in some condition (if(x) delay(100);), the if() adds an unaccounted number of cycles.

As a rule of thumb, delays are not the right way to ensure clock cycle precise timing in an embedded C application. If you need it, you either have to study the resulting assembler code or directly write in assembler.  More often than not delays are anyhow used because the application's architecture is messed up. E.g. someone desperately trying to avoid a timer and interrupts.
Title: Re: General Purpose Power Supply Design
Post by: amspire on June 04, 2012, 12:05:20 am
What's wrong with the standard avr-libc util/delay.h?
I haven't looked at the code. If the standard avr-libc delay routines do not disable interrupts, then they might be great. If they do disable the interrupts during the period of the delay, then they are useless.

What's wrong with the standard avr-libc util/delay.h?
As a rule of thumb, delays are not the right way to ensure clock cycle precise timing in an embedded C application. If you need it, you either have to study the resulting assembler code or directly write in assembler.  More often than not delays are anyhow used because the application's architecture is messed up. E.g. someone desperately trying to avoid a timer and interrupts.
When you are writing general purpose routines designed to be able to run together, then as much as possible, you do not want the libraries to require any dedicated timers or interrupts. The moment two libraries both require Timer1, then they cannot be used together.  If the timing requirements are not critical (like a minimum settling time in a hardware handshake), the use of delay routines is an excellent solution by any programming "rule of thumb" in a simple dedicated microcontroller usage. It is just a matter of the best compromise. The Arduino LiquidCrystal library is a good example, because who wants to loose a timer or a hardware interrupt just to talk to a simple LCD module?

The issue is that if you write an delay routine to be very accurate, you have to disable interrupts. If you write a delay that is good enough to ensure a minimum settling time has passed, then you can allow for interrupts to stay enabled during the delay.

Two different delay routines are needed for the two different situations, and there is no way you can find one single perfect solution.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: BravoV on June 17, 2012, 08:05:15 am
Bump just hate to see this nice thread buried deep down there.  :P

Richard, understand you're still working on the linear front end part, any chance you could share the current pwm digital + vref generator module that you're currently using ?
Title: Re: General Purpose Power Supply Design
Post by: GK on June 18, 2012, 07:24:32 am
The conclusion is that for most power supplies, if it is stable with a 100,000uf capacitor under all output voltage and current conditions, it is probably going to be stable for most other loads.


Not really.

Suppose you have that 100,000 uF capacitor connected with 0.005 ohms of total lead resistance. Neglecting the capacitors ESR, that gives you a zero already at 318 Hz.

318 Hz is likely to be much lower than the unity loop gain frequency of your power supplies control loop, so in effect, that 100,000uF of capacitance plonked on the output will not degrade the control loops phase margin at all.
Title: Re: General Purpose Power Supply Design
Post by: amspire on June 18, 2012, 08:44:54 am
The conclusion is that for most power supplies, if it is stable with a 100,000uf capacitor under all output voltage and current conditions, it is probably going to be stable for most other loads.


Not really.

Suppose you have that 100,000 uF capacitor connected with 0.005 ohms of total lead resistance. Neglecting the capacitors ESR, that gives you a zero already at 318 Hz.

318 Hz is likely to be much lower than the unity loop gain frequency of your power supplies control loop, so in effect, that 100,000uF of capacitance plonked on the output will not degrade the control loops phase margin at all.
When you put a 100,000uF cap on the output, the unity gain of the control loop often drops to a low value - probably under 318Hz.

Anyway, you can get caught out if you think the power supply can only oscillate at the frequency where the control loop gain is unity, as virtually any frequency below the unity gain frequency can become a unity gain frequency - if the control loop is allowed to saturate. The only way to make sure a power supply is unconditionally stable with all capacitive loads is to make sure that total phase shift is less then 180 degrees at all positive gain frequencies. This means that without any output capacitor, the phase shift should be less then 90 degrees for all frequencies below the unity loop gain frequency. This is often not possible.

So lets say in the example you gave, the unity gain point was 400Hz. In this case, the zero at 318Hz would really help to make the supply very stable at 400Hz.  The supply may still be able to oscillate at 10Hz if at 10 Hz, the total phase shift reached 180 degrees. The small signal loop gain would be up around 30dB, but if the loop is driven towards saturation, then the effective gain starts to drop down to 0dB allowing an oscillation.

When you have a conditional instability, the supply appears to be totally stable, until it has just the right kind of load to trigger the instability. Often a load with a pulsed overload current at just the right frequency will trigger the instability.

Many supplies may be unstable with a big capacitor, and you probably would not notice. There may only be a 1mv triangular wave effect of the oscillation on the output DC volts, but if you look at the regulating opamp, it is a square wave out. The frequency can be low - even below 1Hz. It is still better to try for stability.

Richard.

Title: Re: General Purpose Power Supply Design
Post by: amspire on June 18, 2012, 08:56:13 am
Bump just hate to see this nice thread buried deep down there.  :P

Richard, understand you're still working on the linear front end part, any chance you could share the current pwm digital + vref generator module that you're currently using ?
I have slacked of this design a bit, as I have been thinking about a few other devices, and I was thinking about giving them a common design appearance.

A great way to manage the voltage and current setting still eludes me a bit, so I haven't rushed into a final control panel design, until I get inspiration.

This was never intended to be a commercial product, so it has been a design I do when I have the time. The type of build I was thinking about was something simple and functional, and I would leave it to others if they want to make it look more professional.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: GK on June 18, 2012, 09:13:19 am
Quote
When you put a 100,000uF cap on the output, the unity gain of the control loop often drops to a low value - probably under 318Hz.


It could; it all depends on the open loop output impedance of the supply. The only real point I would like to make here is that putting a really large capacitor on the output of a power supply isn't a very good stability test. It is typically not a really small or a really large value of capacitance which causes stability problems; it is usually a range in the middle.

I certainly wasn't suggesting that a conditionally stable contol loop (that being one in which the loop phase dips below +180 degrees at some point prior to the unity loop gain frequency) cannot oscillate under some conditions (such as control loop saturation); you've gone off on a bit of a tangent there. However since you bring it up, there are actual means of mittigating the dangers of conditionally stable loop and they do in fact have some benefits (such as greater loop gain prior to the ULGF due to a >1 pole roll off. Conditionally stable loops are in fact very common in switch mode power supply design. See here:

http://www.ridleyengineering.com/index.php/loop-stability-requirements.html?showall=&start=2 (http://www.ridleyengineering.com/index.php/loop-stability-requirements.html?showall=&start=2)
 
Title: Re: General Purpose Power Supply Design
Post by: amspire on June 18, 2012, 03:15:12 pm
Quote
When you put a 100,000uF cap on the output, the unity gain of the control loop often drops to a low value - probably under 318Hz.

It could; it all depends on the open loop output impedance of the supply. The only real point I would like to make here is that putting a really large capacitor on the output of a power supply isn't a very good stability test.

 It is typically not a really small or a really large value of capacitance which causes stability problems; it is usually a range in the middle.

No. A huge low ESR capacitor is not a stability test. But for a well designed lab power supply or regulator IC, it is still the most difficult load to stabilize. For a poorly designed supply, a smaller capacitor can easily be the value that triggers instability.
Quote

I certainly wasn't suggesting that a conditionally stable contol loop (that being one in which the loop phase dips below +180 degrees at some point prior to the unity loop gain frequency) cannot oscillate under some conditions (such as control loop saturation); you've gone off on a bit of a tangent there.

Not really. The point I was making is that you said if the pole frequency of the output cap was lower then the unity gain frequency:

Quote
that 100,000uF of capacitance plonked on the output will not degrade the control loops phase margin at all

The reason I guess you said this is that in this circumstance, the capacitor would look like a resistance rather then a capacitance at the loop unity gain frequency, and a resistive load will definitely not contribute to instability.

The point I was making is than any frequency lower then the loop unity gain frequency can also be a loop unity gain frequency if the loop is driven into saturation. In these cases, the 100,000uF can degrade the control loop phase margins at very low frequencies leading to conditional instability. I don't think that is going off on a tangent.
Quote

However since you bring it up, there are actual means of mittigating the dangers of conditionally stable loop and they do in fact have some benefits (such as greater loop gain prior to the ULGF due to a >1 pole roll off. Conditionally stable loops are in fact very common in switch mode power supply design. See here:

http://www.ridleyengineering.com/index.php/loop-stability-requirements.html?showall=&start=2 (http://www.ridleyengineering.com/index.php/loop-stability-requirements.html?showall=&start=2)
It is very common, but best avoided in a lab power supply. It is no big problem when you know of the specific load which is the case with most power supplies, but when the load can be absolutely anything (ie a lab supply), it is a very good idea to avoid a design with conditional instability. I mentioned that with conditional instability, you often need a very specific load to trigger the instability. In most dedicated supply designs, the specific load that can cause instability is not a real possibility, so the supply will never become unstable. In this case, you can ignore the conditional stability, and excess phase shift at the higher gain levels can be used to help improve the phase margins at the unity loop gain frequency enhancing the final stability.

Unfortunately, as that page suggests, there are many cases in power supply design where a total phase shift over 180 degrees at some some frequency where the loop gain is above unity is unavoidable. So with my supply, I am avoiding a design where a 180 deg phase shift is unavoidable. I did find it unavoidable with my circuit configuration if I used a PNP darlington for the power transistor, so I am not using a PNP darlington power transistor.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: GK on June 19, 2012, 12:26:54 am
No. A huge low ESR capacitor is not a stability test. But for a well designed lab power supply or regulator IC, it is still the most difficult load to stabilize. For a poorly designed supply, a smaller capacitor can easily be the value that triggers instability.
Quote

Not really. The point I was making is that you said if the pole frequency of the output cap was lower then the unity gain frequency:

The reason I guess you said this is that in this circumstance, the capacitor would look like a resistance rather then a capacitance at the loop unity gain frequency, and a resistive load will definitely not contribute to instability.[/quote]


I disagree from experience that an extremely large external capacitor is a particularly difficult load to stabilise against. When the capacitance is huge only a very small series resistance is required to form a stabilising zero.

This is especially the case in an advanced design which maintains a very low output impedance prior to closing the global loop, which can be achieved with nested feedback loops or compensation techinques such as Miller compensation.
 
Another thing to point out is that many regulators (including some IC types) have a rather high open loop output impedance combined with limited open loop gain. Putting a massive capacitor on the output in such cases reduce the loop gain to below unity at all frequencies, eliminating any posibility of instability.
Title: Re: General Purpose Power Supply Design
Post by: hlavac on June 19, 2012, 12:40:27 am
A great way to manage the voltage and current setting still eludes me a bit, so I haven't rushed into a final control panel design, until I get inspiration.

How about two capacitive sliders?
Title: Re: General Purpose Power Supply Design
Post by: amspire on June 19, 2012, 01:06:45 am
Quote
No. A huge low ESR capacitor is not a stability test. But for a well designed lab power supply or regulator IC, it is still the most difficult load to stabilize. For a poorly designed supply, a smaller capacitor can easily be the value that triggers instability.

Not really. The point I was making is that you said if the pole frequency of the output cap was lower then the unity gain frequency:

The reason I guess you said this is that in this circumstance, the capacitor would look like a resistance rather then a capacitance at the loop unity gain frequency, and a resistive load will definitely not contribute to instability.


I disagree from experience that an extremely large external capacitor is a particularly difficult load to stabilise against. When the capacitance is huge only a very small series resistance is required to form a stabilising zero.

This is especially the case in an advanced design which maintains a very low output impedance prior to closing the global loop, which can be achieved with nested feedback loops or compensation techinques such as Miller compensation.
 
Another thing to point out is that many regulators (including some IC types) have a rather high open loop output impedance combined with limited open loop gain. Putting a massive capacitor on the output in such cases reduce the loop gain to below unity at all frequencies, eliminating any posibility of instability.

You are completely correct that there are ways to compensate for the kinds of instabilities I was referring to. For my design, I was aiming at a simple design that had a minimum sensitivity to component variation, so I was looking for a solution that keeps things very simple. I use multiple 2N2907A or variants as the power transistor, and I wanted stability with one or 8 transistors. If I can keep the phase shift in the control below 90 degrees, then the supply should be unconditionally stable with any capacitive load. No extra more complex compensation circuits.

With IC regulators, I have noticed the older designs often never talked about ESR requirements for the output capacitor. It may be they are stable, or it may be that at the time they were designed, the low ESR multilayer ceramic capacitors and the super low ESR electro's were not available to be a problem.  Then came the designs like the LM1117 where an ESR between 0.3 ohms and 22 ohms is recommended for stability. There are a fair number of linear and switching regulators that require a certain amount of ESR.  Many of the latest IC's seem to be designed for stability with low ESR capacitors.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: GK on June 19, 2012, 01:57:03 am
Just to be clear my comments were made with no intention to imply anything disparaging about your design; they were just general. Most are aware that capacitive loads can cause problems and it is a common mistake to therefore assume that a very large capacitive load makes for an ultimate stability test in general. It’s not always that simple.

I agree that it is necessary to compensate a general purpose power supply to be stable for all practical load conditions. That usually comes with a lot of compromises that many don’t seem to like. I’ve seen a number of published designs for which the designer gloats over seemingly impressive performance  specifications achieved, such as low output impedance at high frequencies, wide bandwidth, etc, etc, but without any real idea of how much they have compromised stability into reactive loads.
Title: Re: General Purpose Power Supply Design
Post by: amspire on June 19, 2012, 03:23:21 am
Just to be clear my comments were made with no intention to imply anything disparaging about your design; they were just general. Most are aware that capacitive loads can cause problems and it is a common mistake to therefore assume that a very large capacitive load makes for an ultimate stability test in general. It’s not always that simple.
I think when I was making the comment originally about the large capacitance, it was because I wanted to make the point that capacitive loads in general push a supply towards its limits for stability.

Thinking back to when I started electronics, I am sure that if I wanted to make a supply more stable, I would assume that adding a big capacitor is the solution. I wasn't thinking at all about phase shifts in control loops, and I had no idea that the difference between a stable supply and an oscillator often only comes down to about 10 to 30 degrees of phase shift. I probably would have assumed that a capacitor is an easier load then a resistor as the capacitor resists changes to the output voltage while a resistor does not.

Again, I think many people would think that the ESR of a big cap is so low that it can be ignored. I don't think it is intuitive at all to realize that the zero caused by the ESR of a load electro can greatly improve the stability margin. And to this you have to add the extra series resistance of the supply wiring and track resistances that mean that even if you had an ideal zero ESR capacitor, there will some effective series resistance to a supply load.

Richard.

Title: Re: General Purpose Power Supply Design
Post by: fmaimon on June 22, 2012, 09:04:19 pm
Richard , I know you want a cheap reference for the power supply, but check out eBay item 110887906326 . It is a new LM399A for only $10   plus shipping. Yesterday, when I bought 4 of them was $6. At this price is a little below digikey's single unit price.

There are even some LTZ1000A on eBay, but those are expensive (about $40 each).

Now i just have to buy some metal foil resistors ($5 each on eBay, although there is a seller that sells 10 for $15   $10 shipping, all of them used)
Title: Re: General Purpose Power Supply Design
Post by: sorin on June 22, 2012, 11:20:15 pm
Richard , I know you want a cheap reference for the power supply, but check out eBay item 110887906326 . It is a new LM399A for only $10   plus shipping. Yesterday, when I bought 4 of them was $6. At this price is a little below digikey's single unit price.

There are even some LTZ1000A on eBay, but those are expensive (about $40 each).

Now i just have to buy some metal foil resistors ($5 each on eBay, although there is a seller that sells 10 for $15   $10 shipping, all of them used)
REF5050 has better performance and is cheaper
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on June 22, 2012, 11:56:45 pm
REF5050 is 3 ppm/C in it's better option and the LM399A is a 0.5 ppm/C. The 5050 can drift up to 60ppm after 1000hr and the 399 will drift only 8 ppm. So I doubt you will find better than that at that price.

Initial accuracy doesn't mean anything in this or any other application that requires stability. That's why the LTZ1000A costs $40 bucks even with 4% initial accuracy.
Title: Re: General Purpose Power Supply Design
Post by: sorin on June 23, 2012, 01:01:56 am
The most important thing is the long term stability.
maybe you are confused because the LM399A have 20ppm for 1000h (typical value, not maximum)
0.5mmp is for the LTZ1000A
the 5050 for the second 1000hr have only 5ppm drift so I think that is beter
the maximum temperature drift for the LM399A is 1ppm and not 0.5ppm
Title: Re: General Purpose Power Supply Design
Post by: amspire on June 23, 2012, 01:54:19 am
I would probably stick to something very cheap for the supply - something with decent short term stability is all I would look for.

However, I am seriously thinking about taking my PWM DAC idea and making a precision programmable reference voltage source. That will need autozero mosfet input opamps, decent resistors, and a really stable voltage source reference. I didn't know that the LM399A's were as cheap as $5 - that is encouraging. The LTZ1000A could be an option for anyone prepared to pay $40. I would probably trust the long term stability of the buried zener ICs over the reference ICs as there are fewer circuit elements to cause long term drift. The LM339A is a known quantity, and it does settle down to be exceptionally stable after the first year or so.

For the ultimate in stability, ideally the whole reference circuit is in a temp controller oven, rather then just having a temp stabilized reference IC. If parts are exposed to less then 1 degree maximum temperature variation, it is easy to get some great temperature stability figures.

It would be at a big cost though. The reference box would use a heap of current on startup, and it would take up to half an hour to fully stabilize.

I am also still stuck on a a good voltage control interface for the supply and the voltage reference. I love a knob that in a single turn can take you from zero volts to maximum volts, but I also need a way to be able to step up the sensitivity to the point where a single turn easily controls down to the millivolt level in the case of the reference. I want it so it is easy to do fine adjustments, while looking at meters rather then the reference so it needs to be easy to control just by touch.

I am definitely open to suggestions. I cannot really finalize a control panel design till I feel I have a good idea.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on June 23, 2012, 02:24:50 am
The most important thing is the long term stability.

That's what I said.

Quote from: sorin
maybe you are confused because the LM399A have 20ppm for 1000h (typical value, not maximum)
0.5mmp is for the LTZ1000A

Ok. The features of the first page of the LM399A datasheet (http://cds.linear.com/docs/Datasheet/LM199399fb.pdf (http://cds.linear.com/docs/Datasheet/LM199399fb.pdf) ) is misleading, citing 0.5 ppm/ºC, but I don't see this 20 ppm/kH. There is a typical of 8 ppm/kH and a figure with a year long 3 sigma drift of 10 ppm (kind of misleading too, as it doesn't show the first 2 month drift).

The LTZ1000A has 0.05 ppm/C and better than 0.3 ppm / kH.

Quote from: sorin
the 5050 for the second 1000hr have only 5ppm drift so I think that is beter
the maximum temperature drift for the LM399A is 1ppm and not 0.5ppm

If I'm reading the datasheet correctly, 5 ppm is the mean value for MSOP-8 package (the best one). It can be between about -8 and 25 ppm. The LM399A will have a mean drift of less than 4 ppm in 10 months (7200 hrs) with a 2 month initial aging and 99.7% (3 sigma) of all devices will be below 10 ppm.

Again, besides initial accuracy, I don't see how a REF5050 is better than the LM399A
Title: Re: General Purpose Power Supply Design
Post by: sorin on June 23, 2012, 10:15:09 am
However, I am seriously thinking about taking my PWM DAC idea and making a precision programmable reference voltage source.
I'm dont think that a precision PWM will work, unless you calculate the ton and the toff of the mosfet, and other things ...



The most important thing is the long term stability.

That's what I said.

Quote from: sorin
maybe you are confused because the LM399A have 20ppm for 1000h (typical value, not maximum)
0.5mmp is for the LTZ1000A

Ok. The features of the first page of the LM399A datasheet (http://cds.linear.com/docs/Datasheet/LM199399fb.pdf (http://cds.linear.com/docs/Datasheet/LM199399fb.pdf) ) is misleading, citing 0.5 ppm/ºC, but I don't see this 20 ppm/kH. There is a typical of 8 ppm/kH and a figure with a year long 3 sigma drift of 10 ppm (kind of misleading too, as it doesn't show the first 2 month drift).

The LTZ1000A has 0.05 ppm/C and better than 0.3 ppm / kH.

Quote from: sorin
the 5050 for the second 1000hr have only 5ppm drift so I think that is beter
the maximum temperature drift for the LM399A is 1ppm and not 0.5ppm

If I'm reading the datasheet correctly, 5 ppm is the mean value for MSOP-8 package (the best one). It can be between about -8 and 25 ppm. The LM399A will have a mean drift of less than 4 ppm in 10 months (7200 hrs) with a 2 month initial aging and 99.7% (3 sigma) of all devices will be below 10 ppm.

Again, besides initial accuracy, I don't see how a REF5050 is better than the LM399A

I refer to: http://www.ti.com/lit/gpn/lm399 (http://www.ti.com/lit/gpn/lm399)
what is "3 sigma" ? (I see it in the LT datasheet, but i dont understand)
ppm/KH is for working hour or for hour from the production date??
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on June 23, 2012, 12:32:00 pm
I refer to: http://www.ti.com/lit/gpn/lm399 (http://www.ti.com/lit/gpn/lm399)
what is "3 sigma" ? (I see it in the LT datasheet, but i dont understand)

See http://en.wikipedia.org/wiki/68-95-99.7_rule (http://en.wikipedia.org/wiki/68-95-99.7_rule)

It basically says that you have 99.7% confidence that all devices will be within that value or, in other terms, 1 device in 370 will be outside that spec.

Quote from: sorin
ppm/KH is for working hour or for hour from the production date??

As I understand, kH is 1000 working hours. That makes sense for me, as such device usually is not powered off.
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on June 24, 2012, 05:05:24 pm
Richard,

Did you think about using a mosfet driver with cmos outputs like the microchip's TC1427 instead of using a logic gate. The rise and fall times looks similar and it has a higher output drive, but the propagation delay is higher. Other advantage is that you can use higher reference voltages.
Title: Re: General Purpose Power Supply Design
Post by: amspire on June 25, 2012, 12:26:13 am
Richard,

Did you think about using a mosfet driver with cmos outputs like the microchip's TC1427 instead of using a logic gate. The rise and fall times looks similar and it has a higher output drive, but the propagation delay is higher. Other advantage is that you can use higher reference voltages.
It could be good, but I suspect that as a high current driver, the quiescent current +switching current and transients will be too much for the voltage reference to supply without issues. It is also manufacturer specific - which I would like to avoid if possible.

Ultimately, you have to test a cmos buffer chip and see how it performs - you will not find any details of high precision stability for any cmos buffer IC.

Why not just use a modestly priced DAC, and measure the output terminal voltage with a precision ADC and do correction in software. You definitely want a precision ADC for panel instrumentation but you should actually be able to get away with a cheap serial or even on board uc DAC.
This has been discussed endlessly before. Except for speed, the PWM has far more resolution, possibly more accuracy, definitely cheaper and uses all common cheap components from multiple manufacturers. A no-brainer really.

Adding an extra software controlled output regulation loop is a bad idea. You would end up with two control loops, both of which need to be stabilized. Things get really complex when you have loads that may be dragging the output down - perhaps a load with pulses of current above the current limit. You do not want the supply increasing the output voltage to compensate - that would be faulty operation and dangerous for the load.

Getting into $40.00 refrence’s and thermal control is getting a bit ridiculous. Calibration and such, everything in the loop would have to be of equal precsion and stability to be able to take advantage of it.
[/quote]
My supply is made of cheap parts, and the reference I use will be cheap and common to match. It will not be some unique device from one manufacturer.

However, as I mentioned recently, I want to make a precision programmable voltage reference from the PWM concept. Unlike the power supply design, this can use hand picked precision parts, as long as the cost is still affordable.  A $10 or $40 reference makes a lot of sense. Such a reference would include tools to calibrate the reference off another DC voltage reference, such as one of the affordable calibrated voltage reference boards that as available.

The PWM calibration is fully software calibrated, which is nice as I can calibrate off any available reference voltage. I would not need a particular voltage such as 5V or 10V. A 7.2V buried zener reference with a accurately known output voltage would be fine for the PWM calibration.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on July 01, 2012, 02:31:54 pm
I just did some tests using a tiny2313 @ 20 MHz generating an inverted pwm (Setting the output on compare match and clearing on overflow) going to a TC1426 (http://ww1.microchip.com/downloads/en/devicedoc/21393c.pdf) mosfet driver. As the TC1426 in an inverter, the output PWM is correct. The driver supply is a Burr Brown REF01A (http://www.datasheetcatalog.org/datasheet/BurrBrown/mXqxxrw.pdf). I just tweaked the pwm value to get correct output.

The output is on the Agilent 34410A (top one - reading with 10 NPLC) and the reference output is on the Fluke 8840A (bottom one - slow speed). Somehow I forgot to take a picture of the 4V output.

In the 1 V output, the last digit was not stable and changed quite a bit, but allways within 5 counts.
(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=26388;image)

In the maximum output value, the output is close enough from the reference.
(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=26404;image)

Now both meters measuring the reference output.
(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=26406;image)


The last 2 pictures were the whole setup. The rise and fall times of the driver were all within 7 ns. If it were on a PCB and using a proper ground connection for the oscilloscope probe, it would be better than that.
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on July 01, 2012, 03:39:59 pm
A little update. I did a spreadsheet to calculate the PWM value for each voltage, then I manually set this value to the tiny2313 and recorded the output value. I've used the 1V and 9V output values to calibrate the sheet and recorded the output value read on my 34410A (10V range, 10 NPLC). The results are pretty good!

 
Voltage setting34410A
VoltagePWM valueOutput
0,5807.1380,49998
1,01.657.8071,00002
2,03.359.1442,00001
3,05.060.4813,00002
4,06.761.8183,99999
5,08.463.1564,99999
6,010.164.4936,00000
7,011.865.8307,00002
8,013.567.1678,00003
9,015.268.5049,00003
9,516.119.1739,49872
Title: Re: General Purpose Power Supply Design
Post by: BravoV on July 01, 2012, 04:56:34 pm
fmaimon, thanks for the update, thats even good enough for me to build that module alone as an adjustable reference  :), any chance you could post the overall circuit and code, please ?
Title: Re: General Purpose Power Supply Design
Post by: eevblogfan on July 01, 2012, 05:16:33 pm
hey

WoW , nice results ! , good job !!

Title: Re: General Purpose Power Supply Design
Post by: fmaimon on July 01, 2012, 06:31:25 pm
The source code is attached. It's pretty much Richard's (amspire) code with a little bit of crude uart control.

I haven't really drawn any schematic but the circuit is pretty straightforward. The only thing I didn't say in the other post is that I've used a 3 stage 47k/220nF filter.
Title: Re: General Purpose Power Supply Design
Post by: amspire on July 02, 2012, 12:15:06 am
Felipe,

Great results - matched my experience. Did your development board use a crystal or ceramic resonator for the 20Mhz clock? Also does the Tiny2313 have a low power and full swing clock oscillator mode (like the atmega's) or just a single power clock mode?

The reason I ask is that I found I had to use the full swing clock mode on the Atmega328P. In the low power clock mode, the jitter on the clock edges was enough to cause a noticeable instability on the output. In the full swing mode, the jitter was less then 1nS, and the PWM results were fabulous. It appeared that in the low power mode, the XTAL1 input was sensitive enough to be modulated by switching noise from the micro outputs.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on July 02, 2012, 01:20:33 am
Felipe,

Great results - matched my experience. Did your development board use a crystal or ceramic resonator for the 20Mhz clock? Also does the Tiny2313 have a low power and full swing clock oscillator mode (like the atmega's) or just a single power clock mode?

The reason I ask is that I found I had to use the full swing clock mode on the Atmega328P. In the low power clock mode, the jitter on the clock edges was enough to cause a noticeable instability on the output. In the full swing mode, the jitter was less then 1nS, and the PWM results were fabulous. It appeared that in the low power mode, the XTAL1 input was sensitive enough to be modulated by switching noise from the micro outputs.

Richard.

Richard,

Actually it was a bit better. I was using the 10M input of my 34410A so, together with the 3 47k resistors, it had a little voltage drop. Once I've put the input in Hi-Z mode, there were no measurable diference between the reference and the output in the highest output value. It's incredible that even with this "voltage divider" it could maintain a great linearity.

I've used a crystal connected to the STK500's crystal oscillator. It is an external clock signal. I've selected the clock-out fuse of the t2313 and the clock seems stable, but I really don't know how to check the jitter. How do you do that?
(http://support.atmel.no/knowledgebase/avrstudiohelp/mergedProjects/STK500/Html/figures/Figure3-29.gif)
(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=26424;image)


Reading the datasheet, looks like it doesn't have a specific full swing mode for the crystal oscillator. I can check later.
Title: Re: General Purpose Power Supply Design
Post by: amspire on July 02, 2012, 02:27:44 am
I've used a crystal connected to the STK500's crystal oscillator. It is an external clock signal. I've selected the clock-out fuse of the t2313 and the clock seems stable, but I really don't know how to check the jitter. How do you do that?
An external clock oscillator is probably an optimum solution.

You measure jitter with an oscilloscope.

Look at the triggered edge first - is the edge very narrow with no jitter evident at the fastest timebase speed? Look at the thickness of the edge and estimate how much jitter you would be able to see. If the scope can do 2nS/div, and the edge variations are less then 0.1 divisions wide, then you can hopefully see jitter down to 0.2nS. For a digital scope, you probably want to use equivalent sampling to increase the sampling rate above the A/D converter's sampling speed.

To see the jitter, connect the scope to the PWM output. Lets say the PWM output goes high at zero count, and low when the count is reached. Trigger the scope off the positive edge and use delayed sweep, or a big sampling buffer so you can look at the next positive PWM edge at the scopes fastest sweep rate. You want to see the variations in the edge timing. For an analog scope, turn the brightness right up, and look at the thickness of the positive edge. The more jitter, the thicker it will be.

For a digital or storage scope, get the scope to accumulate all the edges, and look at the variations. you might leave it running for several minutes to see if there are any spurious edge errors. You may have to juggle a bit to get the best out of a cheap digital scope - they often do not have a genuine delayed trigger.

If you have a stable squarewave oscillator, you can use it to check the validity of the jitter results.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on July 04, 2012, 02:03:51 am
You measure jitter with an oscilloscope.

LOL.  ;D
I knew that one...  ;)

Quote from: amspire
Look at the triggered edge first - is the edge very narrow with no jitter evident at the fastest timebase speed? Look at the thickness of the edge and estimate how much jitter you would be able to see. If the scope can do 2nS/div, and the edge variations are less then 0.1 divisions wide, then you can hopefully see jitter down to 0.2nS. For a digital scope, you probably want to use equivalent sampling to increase the sampling rate above the A/D converter's sampling speed.

To see the jitter, connect the scope to the PWM output. Lets say the PWM output goes high at zero count, and low when the count is reached. Trigger the scope off the positive edge and use delayed sweep, or a big sampling buffer so you can look at the next positive PWM edge at the scopes fastest sweep rate. You want to see the variations in the edge timing. For an analog scope, turn the brightness right up, and look at the thickness of the positive edge. The more jitter, the thicker it will be.

For a digital or storage scope, get the scope to accumulate all the edges, and look at the variations. you might leave it running for several minutes to see if there are any spurious edge errors. You may have to juggle a bit to get the best out of a cheap digital scope - they often do not have a genuine delayed trigger.

If you have a stable squarewave oscillator, you can use it to check the validity of the jitter results.

Using the STK500 external oscillator, I seem to be seeing about 1 ns jitter. I have a TDS2014B and I'm moving the horizontal position 500n - 1us to the left of the screen, so I should be seeing the waveform this far from the trigger. It doesn't have a big buffer, so it was the only way I could think of. I also used infinite persistence.

This weekend I'll etch a board to try the RC oscillator of a tiny45, to try it's PLL and it's crystal oscillator. I'll check the jitter.

As I'm thinking of using the t45 and it's PLL, I did optimise the interrupt code (pretty much took the compiler output code and tweaked it), and came out with this:

Code: [Select]
#include <avr/io.h>

.extern Out_Val
.extern pwm_accum

/*
    Interrupt routine for timer 0
    Its the 24 bit delta sigma converter,
    generating the PWM output.
*/
.global TIMER0_OVF_vect
TIMER0_OVF_vect:
    push r20
    in     r20, _SFR_IO_ADDR(SREG)
    push r20
    push r21

    // loads third byte from pwm_accum and stores on OCR0A
    lds  r21, pwm_accum + 2
    out     _SFR_IO_ADDR(OCR0A), r21

    // Add the original intended value to the error in the accumulator for the next PWM cycle
    lds  r21, pwm_accum + 0
    lds  r20, Out_Val + 0
    add  r21, r20
    sts  pwm_accum + 0, r21
   
    lds  r21, pwm_accum + 1
    lds  r20, Out_Val + 1
    adc  r21, r20
    sts  pwm_accum + 1, r21
   
    // Clears the top byte of pwm_accum and add the original value
    andi r21, 0
    lds  r20, Out_Val + 2
    adc  r21, r20
    sts  pwm_accum + 2, r21

    pop  r21
    pop  r20
    out  _SFR_IO_ADDR(SREG), r20
    pop  r20
    reti

Just save this code as "isr.S" or similar and add to you project on AVR Studio. Beware of the uppercase "S". Without it, it won't "compile". It's 42 cycles long so, even with a 64 MHz timer clock and a 16 MHz main clock, it still have 22 cycles to spare. I've tried this code and it seems to work.

As I'm not an assembler guru, someone may still think on a way of making it smaller and faster.

Felipe
Title: Re: General Purpose Power Supply Design
Post by: amspire on July 04, 2012, 03:24:09 am

This weekend I'll etch a board to try the RC oscillator of a tiny45, to try it's PLL and it's crystal oscillator. I'll check the jitter.
Random Jitter is probably not a huge concern. Modulation caused by the changing micro supply current, and switching outputs is a big concern. Say that every time a particular output pin goes high, there is an extra 0.01V supply drop on the micro chip, and this causes the on-board oscillator to run at a slightly different speed. That will wreck the accuracy. Crystal oscillators and ceramic resonators will be far less susceptible to this problem then an on-board RC oscillator.

Also the on-board RC oscillator is not really accurate enough for reliable RS232 type serial protocol which is a big pain. Not sure it is worth it.
Quote
As I'm thinking of using the t45 and it's PLL, I did optimize the interrupt code (pretty much took the compiler output code and tweaked it), and came out with this:
I am dubious about the benefits. If the PLL is not extremely stable, then it will make it even worse then no PLL at all. It is worth a test. The thing I liked about the PLL running at the crystal clock speed is that the interrupt period can easily cope with managing 2 PWM DACs, plus leave a fair margin for other interrupts - as long as all other interrupts re-enable the PLL interrupts on entry. When you start using the tiny45 PLL for the PWM clock, the processing time for the interrupt gets extremely tight as you cannot afford to miss even one interrupt if you want accuracy. It can work if the tiny is dedicated to the PWM task, and it doesn't have to do much else.

Richard.

Edit:  I am talking about errors that will probably be in the 4th or 5th decimal place. For a system that needs at best a 0.1% error, then there is a good chance an internal RC oscillator, and the tiny45's PLL will probably be fine. So the tests are definitely worth while, even if it just to learn how good the internal RC oscillator is, and how good the PLL is. I am very interested to find this out.
Title: Re: General Purpose Power Supply Design
Post by: ali_asadzadeh on July 07, 2012, 02:15:57 pm
Dear Richard
Thanks for sharing all the good stuff.
The good news is that Cortex-m0 parts with 16bit ADC and low price(bellow 1USD) are on the way. (freescale kinetis L0 MCU's)

I think they sound like good candidates for digital power supplies, and I think TL431 is a good candidate for reference part.
Can we achieve 16bit accuracy and stability with a low cost reference such as TL431?
How can we go to 40v 10A region with lowest cost?
As I see one of your main concerns is cost, I think it should be your main concern!
Again Thanks for all your great work.
Title: Re: General Purpose Power Supply Design
Post by: amspire on July 08, 2012, 01:45:01 am
Dear Richard
Thanks for sharing all the good stuff.
The good news is that Cortex-m0 parts with 16bit ADC and low price(bellow 1USD) are on the way. (freescale kinetis L0 MCU's)

I think they sound like good candidates for digital power supplies, and I think TL431 is a good candidate for reference part.
Can we achieve 16bit accuracy and stability with a low cost reference such as TL431?
No but I am considering the TL431 for the power supply as it is a great reference for price, multiple sources and for a low supply voltage. The 431 means I can, say, have the micro running at 3.3V from a low dropout regulator, and have a TL431 reference running at 3.0V powered from the micro's 3.3V supply. This means I can let the input voltage for the general purpose supply go from about 3.5V to 30V.

I never tried to make the general purpose supply precision, but I did want it to have much better then 1mV adjustability. If you need an accurate output, you can always let the supply stabilize thermally, and then adjust the output with an external DVM, as long as the supply has the resolution to let you adjust it. I do not see any huge need for a supply to have better then about a 0.25% accuracy, as long as you have an accurate DVM for the few times you need a precision output.

For a precision reference, you have to start looking at the references with the temp coefficients in the low ppm, higher regulated supplies for the reference supply, and precision  opamps and precision resistors/voltage dividers if you need to amplify or attenuate the reference output.
How can we go to 40v 10A region with lowest cost?
Quote
As I see one of your main concerns is cost, I think it should be your main concern!
Again Thanks for all your great work.
The ideal has always been a basic 1A supply module that could cost less then $10. I do have a plan for extending the supply to any voltage you like (up to hundreds of volts), and the plan for more then 1A has always been to parallel the basic module - all under the control of a central display/control board.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on July 08, 2012, 04:03:45 am
Here is the schematic I'm planning to build as a test bench. What do you think?
Title: Re: General Purpose Power Supply Design
Post by: amspire on July 08, 2012, 05:05:02 am
Here is the schematic I'm planning to build as a test bench. What do you think?
It depends what you want. The LT1013 is not a suitable replacement for the LM324 at all for the power supply itself - it cannot handle the 32V on the inputs that the LM324 can handle, so in spite any claims from Linear Technology, it is not fully compatible.

If you are making just the reference, there are a few changes I would do. I would probably go for autozero opamps, and definitely a very low bias current MOSFET or JFET opamp. there are great cheap 5.5V auto zero opamps, but there are less available when you look at 30V opamps.

The main change I can suggest is to change the output amp to something like this:

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=26905)

It allows you to do a few things. It means the output can go above 10V, and you can also set the zero volts out (particularly if you can let the opamp have a 0.5V negative supply). It is always great if a reference can go from slightly below zero on the output to about 10% over-voltage. It means you can see what reference voltage output will get a meter reading 10.00000V. You will find if you can go 10% over voltage, you will use the feature regularly.

If you have set the 10V REF01 to be accurate from a Geller reference (or equivalent), then you can use software calibration to set the 10V output of the programmable reference (you just fine what voltage number gives zero difference between the 10V ref out and the programmable ref out), and you find out what voltage number gives 0V out. Once you have these two calibration numbers, you can calculate the number for all other voltages.

Also, to get the best accuracy from the reference, you want to pre-regulate the 15V that supplies the REF01. Also, you want it battery powered. Possible a pair of rechargeable 9V batteries will do the job. Eliminating AC supplies/power packs from a reference eliminates some of the potential error sources.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on July 08, 2012, 06:57:29 am
It depends what you want. The LT1013 is not a suitable replacement for the LM324 at all for the power supply itself - it cannot handle the 32V on the inputs that the LM324 can handle, so in spite any claims from Linear Technology, it is not fully compatible.

I'm no replacing the LM324. I'm just using a precision opamp (low offset drift) to buffer the output. As the

Quote
If you are making just the reference, there are a few changes I would do. I would probably go for autozero opamps, and definitely a very low bias current MOSFET or JFET opamp. there are great cheap 5.5V auto zero opamps, but there are less available when you look at 30V opamps.

I didn't use autozero opamps in this design as I don't have any right now. I'm just design with what I have at hand.

Quote
The main change I can suggest is to change the output amp to something like this:

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=26905)

I'm assuming that the opamps input in this circuit are inverted and the bottom of the 91K resistor is ground, right? What is the 10M resistor doing?

Quote
It allows you to do a few things. It means the output can go above 10V, and you can also set the zero volts out (particularly if you can let the opamp have a 0.5V negative supply). It is always great if a reference can go from slightly below zero on the output to about 10% over-voltage. It means you can see what reference voltage output will get a meter reading 10.00000V. You will find if you can go 10% over voltage, you will use the feature regularly.

Right now I don't want to put things that have tempco. Right now it is just the REF01 and the offset drift of the LT1013. One solution is using two resistors in the same package. This one  (http://www.digikey.com/product-detail/en/RM3216A-103%2F903-PBVW10/RM32A10K%2F90KPCT-ND/1143168)seems a good option, with 5 ppm/C tracking between the resistors and is cheap, although I never heard of this manufacturer. Here is the datasheet: http://datasheet.octopart.com/RM3216A-103/903-PBVW10-Susumu-datasheet-119922.pdf (http://datasheet.octopart.com/RM3216A-103/903-PBVW10-Susumu-datasheet-119922.pdf)

Quote
If you have set the 10V REF01 to be accurate from a Geller reference (or equivalent), then you can use software calibration to set the 10V output of the programmable reference (you just fine what voltage number gives zero difference between the 10V ref out and the programmable ref out), and you find out what voltage number gives 0V out. Once you have these two calibration numbers, you can calculate the number for all other voltages.

That is the idea. Instead of a Geller reference, I'll just use my pair of trusty meters, an Agilent 34410A, about 1 year old, and a Fluke 8840A, lots of years old and calibrated this january. Although the 8840A is only a 5 1/2 meter, the readings on both are pretty much the same.

Quote
Also, to get the best accuracy from the reference, you want to pre-regulate the 15V that supplies the REF01. Also, you want it battery powered. Possible a pair of rechargeable 9V batteries will do the job. Eliminating AC supplies/power packs from a reference eliminates some of the potential error sources.

Right now I'm just keeping it simple, as this is the first prototype. The power from the circuit will be my bench power supply. Later, when integrating everything together with your power supply design, I'll do it properly.
Title: Re: General Purpose Power Supply Design
Post by: amspire on July 08, 2012, 07:10:54 am


I'm assuming that the opamps input in this circuit are inverted and the bottom of the 91K resistor is ground, right? What is the 10M resistor doing?
Yes, I got the opamp connections the wrong way round. I meant to have the -ve input to the feedback resistors.
The 10M resistor is offsetting the 0V point, but it can be much higher (to reduce temp coeff. issues). This allows you to actually calibrate the 0V point.
Quote

Quote
It allows you to do a few things. It means the output can go above 10V, and you can also set the zero volts out (particularly if you can let the opamp have a 0.5V negative supply). It is always great if a reference can go from slightly below zero on the output to about 10% over-voltage. It means you can see what reference voltage output will get a meter reading 10.00000V. You will find if you can go 10% over voltage, you will use the feature regularly.

Right now I don't want to put things that have tempco. Right now it is just the REF01 and the offset drift of the LT1013. One solution is using two resistors in the same package. This one  (http://www.digikey.com/product-detail/en/RM3216A-103%2F903-PBVW10/RM32A10K%2F90KPCT-ND/1143168)seems a good option, with 5 ppm/C tracking between the resistors and is cheap, although I never heard of this manufacturer. Here is the datasheet: http://datasheet.octopart.com/RM3216A-103/903-PBVW10-Susumu-datasheet-119922.pdf (http://datasheet.octopart.com/RM3216A-103/903-PBVW10-Susumu-datasheet-119922.pdf)
The divider solution I like is the Linear Technology ones. The ratio tracks to 0.2ppm/C, and the price is reasonable.
http://parametric.linear.com/precision_resistor_network (http://parametric.linear.com/precision_resistor_network)
Title: Re: General Purpose Power Supply Design
Post by: HackedFridgeMagnet on July 08, 2012, 07:33:05 am
Hi fmaimon
Quote
Here is the schematic I'm planning to build as a test bench. What do you think?
One thing to check, don't you want to tie "not reset" high via a resistor? For when the isp is not connected.
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on July 08, 2012, 02:48:40 pm
Hi fmaimon
Quote
Here is the schematic I'm planning to build as a test bench. What do you think?
One thing to check, don't you want to tie "not reset" high via a resistor? For when the isp is not connected.

All AVRs have an internal pull-up resistor on reset. Usually, it's only really necessary to put another lower value resistor in high noise enviroments. This is not the case here.
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on July 08, 2012, 05:21:30 pm
Yes, I got the opamp connections the wrong way round. I meant to have the -ve input to the feedback resistors.
The 10M resistor is offsetting the 0V point, but it can be much higher (to reduce temp coeff. issues). This allows you to actually calibrate the 0V point.

...

The divider solution I like is the Linear Technology ones. The ratio tracks to 0.2ppm/C, and the price is reasonable.
http://parametric.linear.com/precision_resistor_network (http://parametric.linear.com/precision_resistor_network)

Nice resistors! Digikey's search don't have a track ratio option, so I've missed it. As the LT5400-3 has 4 resistors (2x 10k and 2x 100k), I've changed your opamp design a little bit.

(https://www.eevblog.com/forum/projects-designs-and-technical-stuff/general-purpose-power-supply-design-7488/?action=dlattach;attach=26930;image)

The LT5400-3 are R1, R2, R3 and R5. R4 is just an output load.

Now I don't have to worry about the offset resistor tempco and the output can go from -1V to 11V, making possible to calibrate 0V and 10V points.

Felipe
Title: Re: General Purpose Power Supply Design
Post by: fmaimon on July 08, 2012, 09:17:27 pm
One more thing, regarding the opamp. Is there any problems in using one like the AD8638 (http://www.analog.com/static/imported-files/data_sheets/AD8638_8639.pdf)? It has a higher offset, but as the output voltage will be calibrated, it shouldn't make a difference.

In quantities of 25, the SMD version of the LTC1050 is $3.60 and the AD8638 is $2,49. The LTC1050 have a cheaper dip option at $2,87.
Title: Re: General Purpose Power Supply Design
Post by: ali_asadzadeh on July 13, 2012, 09:42:01 am
Dear Richard
Does OP07 considered a good choice for 40V version? and I want to use ADR421 for reference, which resistors do you suggest for dividing the output voltage down to 2.5V?
Title: Re: General Purpose Power Supply Design
Post by: amspire on July 14, 2012, 12:15:51 am
Dear Richard
Does OP07 considered a good choice for 40V version? and I want to use ADR421 for reference, which resistors do you suggest for dividing the output voltage down to 2.5V?
Is this for the supply, or a precision reference?

The OP07 and its close relatives are good, but I would probably go in a different direction the reference if you are chasing precision. I would probably use something like a Microchip MCP6V27 dual auto zero opamp with microvolt offset and extremely low input current. I would use a NPN transistor or N channel mosfet on the output with a collector/drain resistor to the positive supply to boost the voltage level to 40V or more.

I did discuss something similar in

https://www.eevblog.com/forum/projects-designs-and-technical-stuff/100vdc-reference-circuit/ (https://www.eevblog.com/forum/projects-designs-and-technical-stuff/100vdc-reference-circuit/)
https://www.eevblog.com/forum/general-chat/ltc1052-fifth-i-have-destroyed-whilst-prototyping-any-idea-why-they-are-dying/ (https://www.eevblog.com/forum/general-chat/ltc1052-fifth-i-have-destroyed-whilst-prototyping-any-idea-why-they-are-dying/)

The thing to watch out for in this configuration is that it is easy for the divider from the output to drive the inverting input above the opamp's supply rail causing the opamp to latch up. Some kind of protection is needed, particularly on startup.

For the divider, I would stick with the Linear Technology dividers that I mentioned before. A package with 2x10K and 2x100K can easily be used for a very stable 2.5, 5, 10, 20 or 40  times divider. If you only need around 0.1% accuracy, then 25ppm/C metal film resistors are fine, and a lot cheaper.

I do have plans to redesign my supply with a floating regulator that can regulate way beyond the 30/40V limits of common opamps - it would let the regulator go to 100's of volts - and that would mean a different arrangement for the reference output. It would be in the form of a current source, with a resistor to ground to generate the required voltage.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: ali_asadzadeh on July 14, 2012, 08:24:36 am
Thanks for your reply.
I want to use a low voltage reference so that I could use that for Kinetis MCU reference, It has 16bit ADC, in that way I can read back the output voltage. And the OP07 is regulating the 40v output.
Do you think it's a good idea? Is there a better way?
Also I have another question,
Suppose that I want to have dual output voltages, is there a kind of isolated voltage references, I mean is there a cheap way of using voltage of the reference IC for other parts of the circuits, I mean something like opto couplers, or something like Analog devices  RS485 transceivers (ADM2682E)  that they generate an isolated supply voltage on the chip, is there any option for using the reference output  with isolation? Or I should use another Reference chip?
Title: Re: General Purpose Power Supply Design
Post by: ali_asadzadeh on July 23, 2012, 12:35:13 pm
There is one more question.
You have used a 3 stage RC filter after the PWM, so what happens to capacitor and resistors temperature coefficient in there? I mean there is no feedback there, and you have used normal R and C for there. As you know if temperature changes the Q factor of filters will change and will change filter response, does this affect performance?
Title: Re: General Purpose Power Supply Design
Post by: amspire on July 23, 2012, 12:59:47 pm
There is one more question.
You have used a 3 stage RC filter after the PWM, so what happens to capacitor and resistors temperature coefficient in there? I mean there is no feedback there, and you have used normal R and C for there. As you know if temperature changes the Q factor of filters will change and will change filter response, does this affect performance?
The temperature coefficient  and drift of the resistors has zero effect on accuracy - you could use carbon film resistors and the result would be just as stable.

As long as the temperatures of capacitors are allowed to stabilize, the coefficient has zero effect. If a capacitor was in the process of warming and the capacitor has a significant temperature coefficient, it could vary the voltage slightly. The capacitors will generate no internal heat, but it would be a good idea not to place any of the capacitors near a hot component.

The source of the error would be this. If the last capacitor was increasing temperature by 10 degrees per second, and it had a positive temp coefficient of 1000ppm/C, then in 1/10th of a second, it could increase in value by 100ppm. This could cause the output voltage to be low by perhaps 10 to 20ppm for the period the capacitor is changing temperature. Not a big error but an error. The most important factor in choosing a capacitor is extremely low leakage, but second would be to pick the lowest convenient temp coefficient.  With all precision test gear, if you want the most accurate performance, you let the equipment warm up for perhaps 30 minutes, and if you do, then the temperature coefficient does not matter.

Long term stability of the capacitor does not affect the accuracy at all.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: amspire on July 23, 2012, 01:42:29 pm
Thanks for your reply.
I want to use a low voltage reference so that I could use that for Kinetis MCU reference, It has 16bit ADC, in that way I can read back the output voltage. And the OP07 is regulating the 40v output.
Do you think it's a good idea? Is there a better way?
If you are going to change to a different family of processors, you will have to test the PWM performance of the new processor. The Atmega's are great as they are able to get the jitter on the PWM edges down below 1nS. That is the secret of the linearity and stability. The Kinetis may be great too - I would not know. I also do not know if the PWM of the Kinetis chip has the right options to implement the PWM properly.

I posted my view a short while ago on how I would handle high voltage reference outputs. I prefer something like a MCP6V27 and a transistor on the output to get to 40V or more.

My GP supply needs the LM324 as the supply regulator IC. No substitutions possible.
Quote
Also I have another question,
Suppose that I want to have dual output voltages, is there a kind of isolated voltage references, I mean is there a cheap way of using voltage of the reference IC for other parts of the circuits, I mean something like opto couplers, or something like Analog devices  RS485 transceivers (ADM2682E)  that they generate an isolated supply voltage on the chip, is there any option for using the reference output  with isolation? Or I should use another Reference chip?
I would use a separate micro, ADC (if you want better then the micro A/D)  and reference IC for each supply. If you then have an intelligent front panel and/or USB, use another micro again for the front panel which controls the power module IC's via optocouplers.

If you coupled the PWM via an optocoupler to a floating supply, it would work, but the accuracy and stability would decrease. You may get down to 0.1% accuracy, but you may have to settle for 1% accuracy. Still OK for a basic supply. I found that when I used a 4000 series cmos IC as the PWM output, the results were disappointing due to the slow edge speed, and the Optocoupler speed would have a similar effect.

Richard
Title: Re: General Purpose Power Supply Design
Post by: NewBeginner on September 04, 2012, 06:14:51 pm
Bingo, I'm not as silly as I look  :P

BTW, I'm not sure why everyone thinks my supply is locked into using the "exotic" LT3080. You can substitute for an LM317, but then it only goes down to 1.2V which is not a big deal in most cases. Just have to offset the drive voltage by 1.2V. And that aspect can be fixed if you really want.

Dave.

Dave, I know this is an old post but I have one question:
if, in your design, you would replace the LT3080 with an LM317 wouldn't that affect the current limiting feature (especially at low set voltages / low set currents) of your design? Since even if you bring the ADJ pin of the LM317 to ground the output will still be around 1.25V.

I'm a beginner so I may be wrong :) (please don't throw rocks at me  ;D ).


Thank you :)
Title: Re: General Purpose Power Supply Design
Post by: Kevin.D on September 04, 2012, 06:43:44 pm
 Well spotted bug ,your right I wreckon . Short that out , and it will  just supply the max current until it folds back .
Title: Re: General Purpose Power Supply Design
Post by: Kevin.D on September 04, 2012, 07:16:48 pm
Yes I just tried it ,thats exactly what happens . Thats a severe limitiation of using this current control method then (i.e it doesnt work .) with 3 terminal regulators that dont go down to 0 V .
Title: Re: General Purpose Power Supply Design
Post by: NewBeginner on September 05, 2012, 06:26:40 am
Thank you for testing this. It is good to know :).
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on April 02, 2013, 03:55:58 pm
I suppose I should wake up this thread again since this is a really interesting design.  ;)

I've been playing around in LT Spice with a design using BC337, MJE2955 transistors and 1N5819 Schottky diodes (as I have these parts) based on the Mark 3 design with the overshoot protection.

As I can see the circuit is quite sensitive to the parts used, this causes a lot of oscillation when the load (I put in a 500mA load) and the current reference is set at the same value.

When the current reference is set to 750mA I get the same result as with the original design, and at 250mA LT Spice claims that the output is -1.7V.

I must say that neither LT Spice or PSU design is my strongest points, so I really struggle to see what's actually going on here.  |O

I've put together the circuit on a pref-board, and I can confirm the analysis in LT Spice.

Disregarding the current limiting issue, the regulating is just perfect, with the input at 12.11V I can regulate from 0V to 11.99V.
I didn't spend that much time testing this, but it seems like the circuit should be able to regulate up to 1A with these parts without getting too hot (assuming a pre-regulator supplying 2V above the output voltage).

Attached the .asc file if anyone wants to play with it.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 02, 2013, 06:24:35 pm
The high gain and high speed of the 2N2222A transistors is pretty vital. The  2955 is slow and low gain. It will wreck the phase margin and it will need a higher current driver - which causes a host of other design issues.

The current transistors add negligible phase shift till over 100khz which is well past the 0dB loop gain frequency. The 2955 will be adding phase shift right at the wrong point causing instability and ringing on transient load changes.


Richard.
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on April 02, 2013, 06:44:31 pm
I expected you'd say something like that, you mentioned that the speed of the 2N2222 was important in a earlier post.

Regardless, I decided to put it together with the parts I had laying around anyway. I need to play with these tings to get a grip on it, and it's not like it's expensive (less than USD 3 for what I put together).

I think I'll order some 2N2222's next time, need to check the power dissipation and such with those.
I really want to pursue this design as I have a nice bunch of toroid transformers that I want to use.

BTW: Is TO-18 or TO-92 best suited to this design?
Title: Re: General Purpose Power Supply Design
Post by: SeanB on April 02, 2013, 07:08:53 pm
Buy 2N2219A's instead. Same die but in a bigger case and can dissipate more heat. As well you can get push on heatsinks to fit them, so you can do 1W of power dissipation as well.
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on April 02, 2013, 07:16:15 pm
Hm, Ideally I'd want to use TO-92.
TO-18 cost 6 times more than TO-92, and the 2N2219A is 9 times more.
A quick check on RS. I can get TO-18 from Tayda to about the same price as TO-92 from RS.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 02, 2013, 10:19:55 pm
The TO92 packages are fairly good for power and very cheap. Should be able to get a bunch at well under 10c each.

There is a really nice surface mount package - the SOT223 versions such as the PZT2222A it is rated at 1.15W but I usually divide numbers like that by 2 at least.

http://www.nxp.com/documents/data_sheet/PZT2222A.pdf (http://www.nxp.com/documents/data_sheet/PZT2222A.pdf)
Title: Re: General Purpose Power Supply Design
Post by: c4757p on April 02, 2013, 10:23:12 pm
the SOT223 versions such as the PZT2222A it is rated at 1.15W but I usually divide numbers like that by 2 at least.

Yeah, I'd be pretty hesitant to dissipate 1W in a SOT-223.
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on April 02, 2013, 10:41:42 pm
Think I need to consider using SMD parts for this design, but I generally only have through-hole parts here. So for testing the regulator I'll go with that.
I haven't really looked much at the pre-regulator, and it hasn't been discussed here either. But I noticed that Dave used a LT1935 in one of his simulations, this can only be found as SMD. Yet another reason for going SMD.

The PZT2222A is about 50% more expensive than the TO92, not that it matters, the BOM for this is really low cost.

Btw, the PZT2222AT1G from ON Semi is rated at 1.5W.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 03, 2013, 12:19:24 am
Btw, the PZT2222AT1G from ON Semi is rated at 1.5W.

They achieve this power by using 1.6 x 1.6 inches of copper on a PCB at 25 degC ambient. That is a lot of space. I think a 20mm x 20mm board heatsink at 60 degC ambient is more realistic for a working design, and I would not go beyond 0.7W and 200mA per transistor. Above 200mA, the transistor gain drops off quickly.

Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on April 03, 2013, 12:38:13 am
I see. Even for 20*20mm it's a lot of space, this is multiplied by the number of transistors also.
Which in turn increases the board cost, many things to take into consideration.

I was hoping to get 1A out of this design, that would mean 125mA for each transistor if using 8. The voltage drop is another issue, you said 2V above the output this gives 0,25W for each transistor (correct?).
Title: Re: General Purpose Power Supply Design
Post by: gxti on April 03, 2013, 12:49:16 am
Thanks so much for bumping this thread, I'd totally missed it. I've been tinkering with my own 5A lab supply concept, first with a dual LT3083 and now exploring a discrete configuration. The problem is I have only a very small, foggy clue about compensation and stability -- the big downside to getting into electronics with no education. Ironically this thread seems to have convinced me that I need to kick the whole thing in the ass and go back to a simpler, feed-forward design using the LT3083 and just driving the set pin, not worry about the voltage dropped across the (post-regulator) shunt, and lose the isolation and STM32F3 which was handling ADC/DAC duties. My original motivation was to make a moderate-current supply with fairly precise current monitoring for digital applications, and worrying about 10mV here and there is not in line with that application.

Still, I do want to make a nice lab supply board that I can stack to get multiple channels, and I may be happy with 1A for that. I'm really interested in the flyback converter in particular as it would solve the problem of needing the bulk input power to be isolated which was one of the issues I had been putting off in the first design. I've you've developed it any further I'd love to hear about it.
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on April 03, 2013, 01:57:14 am
This design is made to be scalable by adding more regulator boards. In my case I'm limiting myself  to getting 1A because I have quite a few 24V/1A toroidal transformers that I want to use.

The pre-regulator hasn't been discussed here yet, so who knows how that's going to scale.

There's been some discussion on the control circuit, and so far it seems like it will be very accurate. I don't remember all the details, but it's in the thread somewhere.

I have another lab-psu I'm working on to, but that is on hold for now since I ran into some issues I need to figure out.

Anyway, can't get enough psu's. So I'm going for this one to.  :)
Title: Re: General Purpose Power Supply Design
Post by: Rerouter on April 03, 2013, 01:58:36 am
gtxi, care to keep us posted on the progress you make with a regulated isolated flyback, i was planning a similar approach myself for a 5A discrete varient, but couldn't nut out the feedback mechanism,
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 03, 2013, 02:23:08 am
I am tidying the circuit up with a pre-regulator, and with the circuitry for parallel and serial tracking operation.  Sorry for the delays - it is just a part time task and I am playing with different pre-regulators right now.

I think I will add a overtemp protection to it as well.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: IanB on April 03, 2013, 02:58:05 am
The high gain and high speed of the 2N2222A transistors is pretty vital. The  2955 is slow and low gain. It will wreck the phase margin and it will need a higher current driver - which causes a host of other design issues.

The current transistors add negligible phase shift till over 100khz which is well past the 0dB loop gain frequency. The 2955 will be adding phase shift right at the wrong point causing instability and ringing on transient load changes.

You know, it would be brilliant if someone like Shahriar could do a video tutorial on how you do these kinds of phase margin stability calculations and how you tie them in to the circuit topology and datasheet parameters of the components used (hint, hint  :) ).

I know the same basic theory applies to the stability of general feedback control systems, but it's not something I've ever had to use in my career thus far. So it's fascinating to see this stuff used to solve real engineering design problems!

(So yes, when you are introduced to stuff at university and you ask yourself, when will I ever need to use this in my job? The answer is, maybe, for some of it, you won't. But you won't know exactly what until after you have retired. So you'd better learn all of it, just in case  ;)  It could be that Bode plots are not just an academic exercise, but a lifesaver!)
Title: Re: General Purpose Power Supply Design
Post by: BravoV on April 03, 2013, 03:05:48 am
You know, it would be brilliant if someone like Shahriar could do a video tutorial on how you do these kinds of phase margin stability calculations and how you tie them in to the circuit topology and datasheet parameters of the components used (hint, hint  :) ).

+1, I've been expecting one our resident expert to bring this topic too.

What scared me off as an hobbyist is when it comes to this compensation stuff, even at some datasheets from high profile companies mentioned that they have to walk back & forth from the component bins to the prototype circuit to find the right combination  :o, yes, this is literally written at their datasheet.  :-//
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on April 03, 2013, 09:49:27 am
I am tidying the circuit up with a pre-regulator, and with the circuitry for parallel and serial tracking operation.  Sorry for the delays - it is just a part time task and I am playing with different pre-regulators right now.

I think I will add a overtemp protection to it as well.

Richard.
No worries, take your time.
It's not my intention to nag you to get this done.

Perhaps the overtemp protection is best placed together with the mcu? DS18B20 perhaps?

What about voltage references, without checking the datasheet I'd expect the internal reference in the  mcu isn't that stable. Perhaps LM336 would be suited?

And what about ADC? The internal ones in the mcu doesn't have enough bits?
I suppose one could calculate the voltage, but the amps drawn needs to be measured.
Title: Re: General Purpose Power Supply Design
Post by: gxti on April 03, 2013, 10:53:48 pm
gtxi, care to keep us posted on the progress you make with a regulated isolated flyback, i was planning a similar approach myself for a 5A discrete varient, but couldn't nut out the feedback mechanism,
I've never made an isolated converter in my life. I once tried to make a non-isolated mains converter straight out of a Power Integrations datasheet and it wouldn't start. So I'm not the guy to be making something like that right now, especially something with jellybean parts that will be around for 20 years. But I've been playing in LTspice anyway to see if I can get a better understanding of how isolated converters work.

Sorry for the delays - it is just a part time task and I am playing with different pre-regulators right now.
Me too. I'm not rushing you either, I'm just excited about the ideas that have been presented so far.
Title: Re: General Purpose Power Supply Design
Post by: HackedFridgeMagnet on April 04, 2013, 12:23:26 am
gxti: Im not 100% sure but I think a forward converter would be more appropriate for the isolated pre regulator than a flyback converter.

Would it be better done as three stages.
1. An off the shelf mains to 48vdc. Which probably would be a forward converter.
2. non isolated buck pre regulator.
3. linear regulated stage, with current limiting.

Title: Re: General Purpose Power Supply Design
Post by: gxti on April 04, 2013, 01:24:32 am
What you describe is essentially what I was originally targeting, but buying a separate power supply module for each channel would add up quickly. What piqued my interest here is the idea of having one off-the-shelf main supply (perhaps even an ATX supply) and low-voltage, low-cost isolators for each channel. You might be right about forward vs flyback, again I have no idea what I'm doing and that includes choosing a suitable topology.

The way I envision it (and here I go, overdesigning already) each channel card would have two transformers. One main with a variable output that tracks the output voltage. And one housekeeping supply to power the digital bits. Perhaps +/-5V with post-regulators so it could also provide a negative supply to the opamps. The digital portion would include an inexpensive microcontroller to act as a DAC for the voltage and current set points (as discussed in this thread), and to monitor all the unregulated converter outputs where a built-in 8 or 10 bit ADC is adequate. For precise voltage and current monitoring you could either use a popular discrete ADC or something like INA226 that can monitor a current shunt and voltage directly and very precisely, with a I2C interface. The microcontroller would then interface with the master over isolated SPI so it can easily select each channel card.

There are few interesting variations here in terms of where the parts go. For example, the housekeeping converters of all the channel cards might be clocked from a single bus by the master, since they all operate with the same voltage and current loads. The channel card microcontroller might drive its own main supply converter through the isolation barrier, one benefit of having a separate housekeeping supply. It might be a bad idea though, depends on how well inexpensive high-speed digital isolators perform in terms of jitter etc. Worst case the master micro can drive it but it wouldn't be as responsive because it would be receiving feedback through the serial interface.

Another variant is to eliminate the channel card microcontroller, use an I2C isolator to bring out the INA226 measurements, and drive both converters and the PWM DAC from the master. But you lose the housekeeping measurements and you have to deal with giving the INA226s unique addresses since they'd be on the same bus and couldn't negotiate an address automatically. Plus, as discussed here already, micromanaging one PWM channel is difficult enough. Doing it for 4 channels while also working the user interface or even Ethernet is stretching things a lot although a Cortex-M3 could probably pull it off.

So yeah, there's some wild speculation for you. Hopefully you fine folks can refine and focus it a bit.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 04, 2013, 01:55:57 am
Last time I worked on the supply last year, I was trying to make a switching isolated converter - the idea being it was easy to have, say, one earthed ATX supply powering multiple isolated supplies. It would have been fantastic if successful as it would make it really easy to use almost any kind of power source to power an isolated supply. It would have also made it really easy to have multiple tracking supplies in series to make dual supplies and higher voltage supplies.

I was working on something like 3 to 15V input, and 4 to 30V output at 1A.

I had no problem making a small and very cheap (about $4 in parts) prototype converter with a wide input and output range and good power capability. The problem I ran into was that with cheap solutions for transformers and other components, I was getting far too much leakage inductance in the transformer leading to too much waste energy turning into noise on the output.  With a wide ranging converter, it was easy to get peak currents in the transformer of up to 20A for a 1A output supply, and so it doesn't take a big leakage inductance to generate some pretty powerful noise. I just do not want a supply that sends your scope nuts when you use it to power a circuit. I want to be able to put my DS1105E on 2mV/division and get no artifacts generated by the supply visible when monitoring a test circuit.

It is much easier making a low noise non-isolated switching converter as you eliminated the leakage inductance problem particular to transformers, but I haven't worked on any non-isolated converter designs.

For now, I will stick to a linear pre-regulator first so I get a very low noise output.

I am still very interested in any successes anyone else has with a switching regulator. It would be great to eliminate the heat and inefficiency of a linear regulator.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: gxti on April 04, 2013, 02:06:26 am
That's very helpful to know. Would constraining the input voltage help at all? I think most people would be satisfied with a fixed 12V input, but I suspect it's the variable output voltage causing problems as well.

And I suppose it would be farcical to have 3 switchers and a linear regulator in one design -- one main, one fixed-voltage isolator, and one buck converter to get the variable output. Much easier to design though, and it could use pre-baked designs without any of the issues with getting variable control through an isolation barrier.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 04, 2013, 03:23:20 am
That's very helpful to know. Would constraining the input voltage help at all? I think most people would be satisfied with a fixed 12V input, but I suspect it's the variable output voltage causing problems as well.

And I suppose it would be farcical to have 3 switchers and a linear regulator in one design -- one main, one fixed-voltage isolator, and one buck converter to get the variable output. Much easier to design though, and it could use pre-baked designs without any of the issues with getting variable control through an isolation barrier.
The big problem with isolated converters is coming up with a cheap transformer. It was hard to find anything suitable that was also a reasonable price, and the supply of magnetics for a DIY transformer is pretty bad. My tests were with transformer cores wound on readily available and cheap toroid cores, but I found a sizable leakage inductance, particularly if insulation was added primary to secondary. The only way to make an almost decent switching transformer on a small toroidal core with good isolation is probably to use the triple and quadruple enamel and Teflon coated winding wire (1500V+ rating) - which unfortunately is surprisingly expensive.

I wanted something under 13mm thick if possible. There are beautiful low profile ferrite transformer cores from companies like TDK, but they are very hard to get in low quantity and at a reasonable price. I just wish ferrites were as easy to get as semiconductors. I had been attempting to use only extremely common and easy to get parts, and the transformer does not fit at all into this model.

I might revisit this once I have come up with a good package for the regulator, and a controller. It is probably the case that the best way to get a decent transformer is if someone takes the step to get custom transformers made in bulk in China, and then to resell them either separately, or as part of an assembled module.

I will probably do a seperate microcontroller-based controller board, since it is not needed if a simple potentiometer and meter supply is build. It would be nice if a microcontroller-based controller board was opto-isolated (or ethernet transformer isolated) and could control one or multiple regulator boards.

Richard.
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on April 04, 2013, 10:25:38 am
I understand that the transformers is among the most expensive parts (they usually are expensive for any application).
But what is the specs for something like this? I don't have any clue about these things.
Don't even know where to start looking for one.  :P

Anyway, a quick search at RS for "flyback transformer" comes up with several to about $10.
Is it these we are looking at?
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 04, 2013, 10:43:17 am
I understand that the transformers is among the most expensive parts (they usually are expensive for any application).
But what is the specs for something like this? I don't have any clue about these things.
Don't even know where to start looking for one.  :P

Anyway, a quick search at RS for "flyback transformer" comes up with several to about $10.
Is it these we are looking at?
It is hard to pinpoint specific specs as there are different frequencies and different inductance that can be made to work. But in general, it is really hard to find a compact transformer that can handle sufficient power, and usually the ratios are just not right. It is pretty common to need a custom transformer.

Last time I looked, I don't think Coilcraft had anything even close.
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on April 04, 2013, 11:03:13 am
That's a real showstopper.

A switching pre-regulator would be most suited considering the design of the regulator and the heat generated by the circuit.
Having one manufactured is a option, but that would probably be to expensive as one needs to order a lot for it to be economical.
Hopefully someone can come up with something that uses off the shelf transformer.

By using a linear pre-regulator one would only move the heat generating circuit to another part of the design?
That doesn't matter much if the benefits of the design (accuracy, stability, etc.) ways up for this.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 04, 2013, 11:21:40 am
That's a real showstopper.

A switching pre-regulator would be most suited considering the design of the regulator and the heat generated by the circuit.
Having one manufactured is a option, but that would probably be to expensive as one needs to order a lot for it to be economical.
Hopefully someone can come up with something that uses off the shelf transformer.

By using a linear pre-regulator one would only move the heat generating circuit to another part of the design?
That doesn't matter much if the benefits of the design (accuracy, stability, etc.) ways up for this.
The thing is the pre-regulator can be a simple design that is easy to scale.

Linear power supplies designs do not scale at all. Typically, every time you change current or voltage of the actual regulator circuit, you have to make changes to the control loop and other aspects of the design. The idea was to have a standard module that is cheap, performs well, and can easily be adapted to different voltage ranges and currents.

It may be I can run my supply in a floating mode which means that with an appropriate pre-regulator, you could make a supply that regulates well to 1000V.

Richard.

Think of a cheap board as the equivalent of an easy to use IC that needs some easy to design auxiliary components.
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on April 04, 2013, 11:53:12 am
I see.
I doesn't understand enough about these circuit to see these things without explanation.  :-//

The thing is the pre-regulator can be a simple design that is easy to scale.

Linear power supplies designs do not scale at all. Typically, every time you change current or voltage of the actual regulator circuit, you have to make changes to the control loop and other aspects of the design. The idea was to have a standard module that is cheap, performs well, and can easily be adapted to different voltage ranges and currents.
Hm, I need to study this more I understand.
Not going to bother you with this though.  ;)
It may be I can run my supply in a floating mode which means that with an appropriate pre-regulator, you could make a supply that regulates well to 1000V.

Richard.

Think of a cheap board as the equivalent of an easy to use IC that needs some easy to design auxiliary components.
This part I understand very well. But I'm never going anywhere near 1000V .  ;)
Title: Re: General Purpose Power Supply Design
Post by: TheRevva on April 19, 2013, 02:33:16 pm
Hi all,
I'm a SOFTWARE guy rather than a HARDWARE guy, so I should probably apologise in advance?

I've just been playing with LTSpice and Richards (amspire) Mk3 circuit and I came across some anomalies so I'm wondering if I've done something wrong?
(I already dropped R9 to 330 and installed the recommended 470 ohm from U2 output to ground in case anyone is wondering).
NB: I used the spice files from Bravo-V so that's the component designators I am using here.

The two issues I'm seeing are:
1: Some ugly instabilities (oscillating at around 440kHz under certain conditions)
2: Inability to set low current limits.

The first one was a comparatively easy 'fix'.  I included 10pF caps in parallel with R16 & R18 (the feedback resistors of the current sense amp) and this seems to help a LOT!  It's my 'suspicion' that my LTSpice model of the LM324 is not the same model others are using?
I don't yet know enough about phase margin etc (but I'm learning quick).  Perhaps these additional caps have destroyed that?

The second issue is a little tougher to deal with and here's my $0.02 worth of thoughts on it:
In my spice runs, I left in the 1 ohm LOAD resistor that Bravo-V inserted.
The supply performs current limiting by effectively 'sinking' away the drive to the NPN transistor (via D2 - 1N4148).
In order to do this, it needs to determine how much current is being drawn through the current sense resistor, R22 (1 ohm) using U3.
From what I can see, U3 has 'issues' with criteria that SHOULD be fine. (Eg: Supply=10V, VRef=5V).
Trying to achieve a 100mA current limit in that condition (Current_Ref=100mV) gives about 271mA output (into LOAD of 1 ohm).
Replacing D2 (1N4148) with any Schottky helps things quite a lot although it's still rather messy.
What REALLY seems to help most is to run the two current control op amps (U2 & U3) from a split supply.

Luckily for me, it's my intention to use a PC power supply to drive it (as a 'pre-regulator'), so I will have a nice 'split supply' available.
I'm going to 'butcher' the PC PSU by disabling the OVP/UVP crap, snip into the voltage feedback, and recap it with higher WV output caps so I can drive it a decent chunk over the +12V standard.
Considering a 300W PC PSU is now about NZ$25, I'd be mad not to use it as a pre-regulator.

Anyway, I'm off to read more about phase margins etc...  Take care all.
Title: Re: General Purpose Power Supply Design
Post by: amspire on April 20, 2013, 01:09:44 am
I am working on an update, and I hope to finally be able to build a prototype this weekend. Currently I have a lot of my parts in storage boxes, so I just have to sort that out first. There are some changes needed, and you are right, at very least you have to change the 1N4148 for a schottky. There is also a change needed to th reference input circuit  - A 1N4148 has to be added to a cap on the voltage reference input to the output to drag the reference down when the output voltage is low.

Several other changes, but I will build up some actual hardware first before putting up new circuits.
Title: Re: General Purpose Power Supply Design
Post by: ivan747 on April 21, 2013, 05:28:05 pm
I will be following closely -I finally got a proper 2ch. oscilloscope, the DS1102E

I have about 500g worth of generic NPN transistors in a TO-92 package, will these work? I don't have a big variety of transistors or semiconductors in the lab.

And I also have a relatively high resolution multimeter, 5 1/2 digit, to test your PWM DAC concept.
Title: Re: General Purpose Power Supply Design
Post by: TheRevva on April 22, 2013, 11:22:17 am
OK, I have somewhere over 40 years of hands-on commercial experience...
Unfortunately, it's not with electronics as that's only been a 'hobby'...  :-DD

Nevertheless, here's a few more 'open comments' (please don't take them the wrong way?):
1:
I ADORE LTSpice!!!
As a program, it truly ROCKS!
(Although it's managed to crash VirtualBox under Slackware a few times now... LOL)
2:
I'm treating this whole project primarily as a 'learning exercise', and I'll no doubt make a MILLION mistakes along the way.
(In fact I actually WANT to make those mistakes so that I can learn from them!)
3:
I'm actually intending building my own 'lab power supply', but I'm betting it will be somewhat different as I have different 'criteria'.
I want more current and more voltage than this puppy is currently designed for.
It's my 'intention' to butcher a PC SMPS into becoming a microcontroller adjusted pre-regulator.
(I will probably build two 'identical' systems so that I can have a 'dual tracking' system - PC SPMS are dirt cheap anyway).
I know it's easy enough to get almost 30V from a PC SMPS after replacing all the output caps - I'm hoping to end up with about 25VDC at a reasonable current at the output of the linear reg.
4:
The current limiter in the design seems rather s-l-o-w to operate.
It's quite easy for me to simulate 10% or more 'current overshoots' during power up.
As far as I can tell, this is because the op amp in question is allowed to be driven to the rail (saturated to clipping) and it takes a finite time to 'recover'.
I'm still thinking how to address that aspect...
5:
As mentioned previously, I have already placed some small caps across the current sense amplifier feedback resistors.
Initially 10pF, I've since changed these for 100pF.
I also changed the 1N4148 diode for a Shottky (it was WELL worth the effort... LOL)
6:
Since I am aiming at extra amps, I've elected to drop the current sense resistor from 1 ohm to 0.1 ohm.
In order to keep the current reference input at 1V = 1A, I dropped the series 100k resistors feeding the current sense amp to 10k giving it a gain of 10 (thereby producing the same 1V per Amp output on this op-amp).
I am guessing the down side to this is that it also amplifies any input offset of the sense amp.
I can 'calibrate out' any such discrepancies in the microcontroller (and at present, it's a fairly linear 21.772mV of 'offset' across the full current range)
7:
Upon power up, the voltage manages to 'overshoot' by quite a decent margin (which I'm led to understand is common on LDO regulators)
I'll be able to address that by simply 'ramping up' the voltage reference from the microcontroller.
(More than likely, I'll be using a poor-mans DAC (PWM-DAC) for this anyway which will implicitly create the ramp up - I may not NEED to slow it down.
8:
Now that I am _beginning_ to understand the concepts of phase margin, I have a LOT more 'tuning' to do.

Summary:
I don't know if I should be THANKING Amspire, Dave et al for getting me started on this, or perhaps CURSING you all...
Only time will tell...  |O
Title: Re: General Purpose Power Supply Design
Post by: c4757p on April 22, 2013, 11:32:02 am
I ADORE LTSpice!!!
As a program, it truly ROCKS!
(Although it's managed to crash VirtualBox under Slackware a few times now... LOL)

It runs admirably under WINE.
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on May 06, 2013, 09:45:13 pm
Good to see that there's still things going on in this thread.  ;)

I finally had some time to play with LTspice again.

Replacing the 1N4148 (D5) with a Shottky diode removed the oscillation when the current setting was set to the same as the load.

I still need to figure out why it won't current limit at low current settings.

The circuit is also built on a pref-board, so I'll change a few parts and experiment a bit after I get it functional in LTspice.

Ivan747: I use MJE2955 and BC337-16 transistors in this as I have a few, try what you have in LTspice. ;)

I realize that using other transistors than Amspire designed in can introduce a few issues, but it's worth a try if the parts is already "in-house".
Title: Re: General Purpose Power Supply Design
Post by: TheRevva on May 08, 2013, 10:51:35 am
Replacing the 1N4148 (D5) with a Shottky diode removed the oscillation when the current setting was set to the same as the load.
I still need to figure out why it won't current limit at low current settings.
Yep, making that diode into a Schottky cures that aspect!!!
As for your reported problem of current limiting to low values, I'd suggest that you MIGHT find that the current limit op amp is getting too close to it's negative rail voltage.
That's why I'm supplying a genuine negative supply to the op amps which is around 5V more negative than the negative output pin.
Many of the schematics I've seen of 'decent' commercial lab supplies seem to use a isolated, split positive and negative supply on their op amps with the 'common' of the om-amp supply being connected to the main positive output rail.

Since my design is using a (heavily modified) SMPS PC PSU as a microcontrolled pre-regulator, adding an isolated op-amp supply wasn't so easy.  Therefore, I simply added diode, capacitor and 7905L linear regulator to the 5volt standby circuit to provide a fairly 'clean' -5V.  (I didn't want to derive the op-amp negative supply from the normal -12V output because it's no longer a constant voltage.  I'm going to be removing all the SMPS output components from the +3v3, +5v, -12v rails and also replacing all the caps on the +12v rail with 50V rated parts.  The SMPS will end up delivering -5v, ground and a final microcontoller adjusted preregulator output of +5 to +25v at several amps!  (While the SMPS _can_ deliver more volts, it would exceed the max supply rails of my LM324 in the linear regulator section)
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on May 08, 2013, 01:32:29 pm
I've tried to supply the OpAmp with -5V and +20V in LTspice, I still have some issues.
It might be that I don't know enough about LTspice, so I'm going to play with it for a while.
Title: Re: General Purpose Power Supply Design
Post by: TheRevva on May 09, 2013, 03:00:59 am
Without knowing exactly what mods YOU made to the fine design from Amspire, it's hard to guess exactly why you're having issues limiting low currents.

Here's how I 'interpret' the schematic (which is WAY back on page 15 of this thread).
Primary regulation of output voltage comes by way of U3B.  If the output voltage fed back into the inverting input falls below the variable 'reference' voltage on the non-inverting input, it causes the 2N2222A to be switched on harder thereby supplying more base 'drive' to the array of series pass regulator transistors.  Pretty straightforward really.
The current control aspect senses the voltage drop across the current sense resistor (R23) using U3C and then 'compares' this to an incoming 'current reference' voltage using U3A.  If the current being consumed exceeds the 'limit' set by the input, then U3A will begin to 'sink' the base drive power from the 2N2222A (via the Schottky we've installed) thereby lowering the 'drive' available to to the series pass transistors and this will restrict output current.

Soooo... What can go wrong?
1: The current sense amplifier (U3C) is working with both it's inputs fairly close to the positive supply rail of the op-amp.  Specifically, the Vce(saturated) of the series pass array along with the corresponding 0.2ohm emitter load sharing resistors create the only voltage 'drop'.  Therefore, at low current outputs, the two U3C inputs can get rather close to the op-amp rail voltages.
2: Also at low currents, the actual voltage drop across the current sense resistor becomes rather small. - eg: 1mA through 0.1ohm will only cause a 100uV drop over the sense resistor.  I doubt this is causing you any issues though.
3: When the current reference amplifier (U3A) is instructed to limit the current to very small levels (eg: 1mA), the two op-amp inputs will be VERY close to the op-amp negative supply rail (aka ground) and this can become troublesome.  (This is why I've elected to supply the op-amp with a true negative rail that is more negative than the output ground).
4: Finally we have the input offset voltage and current of the op-amps to contend with.  The input offset current is less worrisome than the input offset voltage (comparing nano-amps with millivolts is the clue).  In my case, the inputs to the linear regulator are 'driven' by microcontroller based DAC outputs, and therefore, I can 'calibrate' these to compensate for these offsets.  Eg: To set a current limit of 1mA (which you would _expect_ to require a 1mV input to U3A) will probably end up requiring closer to 3mV due to input offset voltage of U3A.  My LTSpice simulations seem to show this 'offset' is quite consistent across the whole range, so calibrating it accurately at a 1mA limit will be 'close-enough' across the whole range.

In my case, I'm not concerned in the slightest about the drop-out voltage across the linear regulator, so it's more likely I'll be using NPN series pass rather than PNP.  (Do a google search on LDO, quasi LDO and Standard linear regulators to compare the differences).
Also, I'm after quite a lot more current than this design can produce with 8*2N2907 series pass transistors.  At the moment, I'm playing toying with using a darlington NPN such as MJ11032 or some TIP142s.  (With suitable heatsinking, I _might_ get by with a single MJ11032 as these are rated to 300W!!!)
Since the overall dissipation in the series pass transistors is proportional to (Vin-Vout)*Current, I intend using the microcontroller to adjust the pre-regulator supply voltage to keep this to a minimum.  (And that explains the extensive mods to the SMPS PC PSU!).  Something 'm uncertain of at the moment is how much of the 40kHz switching noise from the SMPS is going to permeate through the linear section.  Obviously, I'll be decoupling the pre-regulator output with all manner of filtering to keep it to a minimum, but it's inevitable that SOME will still get through!  Only time will tell.

It's going to be quite a while before I put most of this into practice.  I've decided to pursue a 'higher priority' project first...  A 3D printer (RepRap).  Should be LOTS of fun!
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on May 09, 2013, 08:57:28 am
I've only changed a few things on Amspires Mk.3 design, most importantly the transistors as mentioned here (https://www.eevblog.com/forum/projects/general-purpose-power-supply-design-7488/msg211621/#msg211621).

After that post there was a few modifications to the design posted here (https://www.eevblog.com/forum/projects/general-purpose-power-supply-design-7488/msg111924/#msg111924), which I have updated my circuit with.

Otherwise, the diodes I use is 1N5819 and 1N5822 as I have these laying around.

See the attatched spice file, there's comments on the devices I've changed.
Title: Re: General Purpose Power Supply Design
Post by: TheRevva on May 12, 2013, 03:41:40 am
NB: During typing all this I inadvertently POSTED the darned thing before I was done.  I hope the 'remove' button works correctly, as I'm doing it all again.

Hi Thor-Arne,
Firstly, it's important to inform you that almost ANYONE in this forum has a lot more knowledge / skill / experience than ME, so I suggest you verify EVERYTHING that I type for yourself.  (OK, that's my 'legal disclaimer' out of the way... LOL)
I just loaded up your LTSpice.  I quickly noticed how you've added an RC network and discharge to the voltage ref input with R23, C5 and D6.
(Intriguingly, I've done something pretty similar albeit perhaps for other reasons than you?.  I might cover that in some other post).
In your case, the chosen RC time constant is a lot larger than what I'd played with, but that's not hugely significant.

You've mentioned you're experiencing 'issues' with current limiting if you attempt to set a fairly low current limit.  I came to the same conclusion and that's why I started 'playing' with LTSpice in the first place...  Let's use your LTSpice '.asy' as our reference circuit.
In the circuit, you're feeding in 15mV as your Current_Ref (and thus you're 'expecting' current to be limited to 15mA).  Your Voltage_Ref input is 10V so you've set the desired CV output to 10V.  You've placed a 1ma load (I1) on the output, and, as it is, the circuit happily tries to push 10v @ 1ma through your output load. However.... There's still some 'gotchas' in there.  And here's my 'findings' in no specific order.
1: With your simulation set to run for 100mS (.tran 100ms startup), the voltage reference input to U1 is not quite 10V yet.  (C5 is still charging up a tiny last bit).  Instead of the expected 10V reference, you've effectively got a 9.9981157V reference after 100mS).  I'm first to admit this is 'bugger all', but I still thought I should mention it.  After initially adding a similar RC circuit on my version, I ripped it out again on future simulation runs to avoid adding in 'creeping errors'.  (It's quite probable that the RC circuit WILL be in my final design as a 'poor mans DAC', but I wanted to eliminate it in the design stage so I can aim for accuracy in the rest of the circuit).
2: Take a look at R24 (1k).  This resistor places a permanent 'load' on the output.  The current flowing through this 'load' is directly proportional to the output voltage.  (Basic Ohms law).  Since you're simulation is aiming at a 10V  output, this 1k load is effectively drawing 10mA from the supply.  That's not a huge problem other than one small detail.  This 10mA load is ALSO flowing through the 'current sense' resistor (R22).  You have also added the fixed 1mA load on the output (I1).  Therefore, between R24 and I1 we're drawing 11mA through our 'load sense' resistor.  That's gonna hurt accuracy in a HUGE way at low currents!  Luckily, there's quite a simple 'cure'.  Simply place the load sense resistor (R22) AFTER R24 in the circuit.
EDIT:  I just looked closer and noticed that the original preload resistor is still present at the right place - R21!  Why is R24 there at all in your circuit?
Also, it's important to realise that your R23 will inevitably form 1 leg of a resistive voltage divider with any other 'load'.  In your case, this would be through D6 and the output load (R24 + I1).  In order to minimise these errors, I'd use a MUCH smaller value for R23!  I'm guessing that your reason for including D6 is to speed up the discharge of C5 when you decrease the 'set' voltage.  Without D6 in circuit, C5 can only 'discharge' through the near infinite input impedance of U1 (truly negligible), or through R23.  I'd seriously consider dropping D6 altogether and lowering both R23 and C5.
For the rest of this post, I'm going to remove R23, C5 and D6 entirely and feed the voltage reference directly into U1 non inverting input. (Just trust me on this one for now).
3: Several posts back, I mentioned the need to replace a 1N4148 diode with a Schottky.  In your simulation, D2 is still the original 1N4148!  This REALLY needs to be swapped to a Schottky!  Change it to something like a BAT54 in LTSpice.  You'll be amazed!  (I think I ended up throwing in a 1N5819).
PLEASE make this change too as I'm using this 'mod' as an assumption in the rest of this post.
4: In my case, I wanted to drag out more AMPS than the original design intended.  However, the higher the output current, the higher the effective voltage drop across the 1 ohm current sense resistor (R22) and this equates to more 'losses' within the regulator.  Therefore, I dropped R22 from 1 ohm to 0.1 ohm but in doing this, I had effectively decreased my current set resolution.  Previously, using Current_Ref=1V would set a 1A current limit, but lowering R22 to 0.1 ohm meant that a 1V input would now set a 10A current limit.  That would have made things rather 'difficult' if I ever wanted to attempt setting current limit to mere mA!  But wait...  We already have U3 in there as a current sense anplifier set to unity gain in the circuit. By simply replacing R17 and R19 with 10k resistors, we can bump up the gain from 1 to 10 thereby restoring our 1V = 1A reference.  (After a LOT of simulation runs, I came to the conclusion that 10005 ohm is the 'ideal' value for these two resistors.  This is within 0.05% of 10k, so I'm not going to be TOO anal about it.  I think the additional 5 ohms would simply help to overcome the input offset voltage of U3).
5: I see in your simulation, you've set the current reference to 15mV (and therefore, an intended current limit of 15mA).  If you look at the current going through the sense resistor (R22), you'll see that it's below this threshold, and therefore, the regulator is in 'constant voltage mode'.  However, if I change the Current_Ref input down to 5mv (i.e. 5mA current limit), things become a little messy.  The voltage across the 1 ohm sense resistor (R22) only reaches 1.5863mV instead of our expected 5mV!  Weird huh?  However, the OUTPUT of the U3 current sense amplifier manages to reach 6.2709mv!!!  "Houston, we have a problem!".  If we feed X volts into a 'unity gain' amplifier, we _EXPECT_ to get X volts out of it right?  Well, kinda...  U3 is NOT 'ideal'.  It's got an input impedance, an output impedance, an input offset voltage and an input offset current.  All such things conspire against us, and they really become 'visible' once we start reaching the limits of our chosen devices.  Soooo... What can we do about this 'issue'?  In this case, neither the input / output impedance of the op-amp nor the input offset current (which is a few nano amps) define the limit we've hit.  It's almost exclusively the input offset voltage causing us grief!.  Since it's always been my intention to 'program' my supply with a microcontroller as opposed to simple pots, it's not difficult to 'calibrate out' such discrepancies.  As far as I know, the input offset voltage of an op amp is fairly consistent across the entire input range (perhaps not so much when it's close to either output rail though... LOL).  In your circuit, 1.58632mA through the current sense resistor is creating a U3 output of 6.27168mV when we EXPECTED it to produce 1.58632mV!  If we simply feed in those few extra mV into the current reference amplifier (U2), we can 'null out' the discrepancy.  If we then take a look at the opposite end of the scale (i.e. at the higher output current limits), we find that a similar absolute 'offset' in our Current_Ref input brings improved accuracy.  In my design, I've increased the gain of the current sense amplifier from 1 to 10 (along with making the current sense resistor 1/10 the value) and I think this causes a corresponding gain of the input offset voltage.error on the U3 output.  The corresponding microcontroller 'calibration' of the Current_Ref input dramatically improves the accuracy at low current limits.  IIRC, I needed somewhere around 19mV of Current_Ref 'bias' to be added by the microcontroller).
6: There's a few components in the original design that have me mildly perplexed.
6a: D1 is an LED and as far as I know, an LED needs a few volts before it begins to emit (circa 2.1V for a normal red LED).  Given the load of base-emitter junction of Q9 in conjunction with 68 ohm R10, I cannot see how this would EVER illuminate.  Why bother having it there at all?
6b: I'm sure there's a reason for R30 (470ohm) and R11 (4k7), but I cannot determine it.  I don't have them on my design and it seems to be reasonable in LTSpice.
6c: I note that you're using a 1N5822 for D3.  I moved this diode to the OTHER side of the current sense resistor, and used a MBR20100CT instead.  (The 'other' diode in the pack serves to 'protect' the supply from a 'car-battery-in-reverse' connected to the output.  The voltage sense pickup is, of course, placed AFTER the diode to keep it accurate.  (I really should throw an output fuse in there too... LOL)
6d: Perhaps the most significant change I made was to move away from an LDO regulator design to a STANDARD regulator (NPN as the series pass transistor - a darlington pair to be accurate).  Something like a TIP142 or MJ11032 (I think that's the correct parts?) were installed instead of R9, R10, Q9 and Q8).  The MJ11032 in a TO3 is 'rated' for 300W Pd (which is WAY more than I'd ever need).  The downside of a standard regulator is an increased 'dropout' voltage.  Instead of Vce(sat) of the PNP series pass transistor in the LDO design, it increases be 2 * Vbe volt drops to become 2*Vbe+Vce(sat).  This is NOT a concern for me as I'm not running it from batteries!
6e: The next issue faced on ANY linear supply is that the series pass transistor must 'dissipate' quite a lot of power.  With an input voltage of V(in), an output voltage of V(out) at a current of I(out), our series pass transistor is forced to dissipate (V(in)-V(out))*I(out) as heat.  It's quite common on lab supplies to use several transformer output taps to keep this heat dissipation within the SOA of the transistor.  In my design, the source voltage comes from a modified SMPS PC PSU and the microcontroller can instruct the PSU to supply a nominated voltage as input.  Therefore, this will keep the dissipation to a minimum and thus my heatsinking requirements.

I cannot think of much more at the moment.  When I get back to working on my version, I'll post up the specifics here.  (I have a different 'project' that has 'jumped the project queue'.  I want to go and melt some plastic! (i.e. A 3d printer).
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on May 12, 2013, 10:00:02 am
First, my motivation for modifying the original design to use a single transistor was that I had all these parts available, and I could get away without the balancing resistors (R1 to R8). I then could build the circuit on a pref board to verify my findings in LTspice (I started using LTspice with this design).
Also, since the design is based on being hooked up to a tracking pre-regulator, the drop in the transistor will be only 2-3 volts and the dissipated heat is no problem.

Second, my knowledge of these designs is more or less none existent. But I've learned a lot during this so far, and I probably learn a lot more before this is finished.  :P

I find this design very interesting since is supposed to be very low cost and expandable by adding more boards if one needs more current, also the use of PNP transistors is interesting. I think this is the first design I've seen with PNP pass transistors.

The RC network (R23, C5 & D6) was added by Amspire to compensate for a overshoot in the first Mark-III design, I based my variant on that one. For some reason I can't find that post anymore, have we lost some post in this thread perhaps?

I have been tweaking the values a bit from the original design since I use other parts.
Amspire commented that much of my oscillating problems comes from using slower transistors, if I can get it stable I can live with slower responses.

R24 is entirely my fault, it is in the original Mk3 design and I forgot to remove it when I put in the load.  :-[

Removing R24 and changing D2 to a 2N5819 did some wonders with the simulation, the "error" is now 5 mV which can easily be calibrated away in the mcu. Thanks for pointing those out.  :)

The LED is confusing me to.....  :-//

I think I need to play around a bit more with this in LTspice, if I discover some other issues I'll post it.  ;D
Title: Re: General Purpose Power Supply Design
Post by: vieirae on May 12, 2013, 05:17:12 pm
Dear fellow bloggers
I've looked at Dave's RevC as well as the whole design development and find the idea of a battery powered voltage source with current regulation fantastic. I'm a newbie in electronics but would have one question/idea: would it be possible to implement the additional functionality of a simple function generator (square, sine, and triangle wave) with adjustable frequency (0.1 to ??KHz) with voltage and current control?
It seems there would be some room for a smaller board above the mainboard next to the two batteries in the box. Dave was also talking about going to surface mounting which could then maybe even spare some room for this on the mainboard. This would be the ideal tool/project for a beginner and the additional circuitry doesn't seem to be too expensive (http://www.loetstelle.net/projekte/xr2206neu/xr2206neu.php (http://www.loetstelle.net/projekte/xr2206neu/xr2206neu.php) (sine) or http://electronicsclub.info/555timer.htm (http://electronicsclub.info/555timer.htm) (square)).
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on May 12, 2013, 05:31:52 pm
It's is possible to modulate the output by modulating the Voltage_Ref input, how clean output this would produce is a different matter. As far as I can see in the circuit it is intended to produce a as stable as possible output, and modulating can introduce some side effects.

I suggest you try in LTspice and see how clean output you can get, and what frequencies it can handle.
Title: Re: General Purpose Power Supply Design
Post by: TheRevva on May 13, 2013, 12:00:33 am
Incorporating a completely INDEPENDENT function generator within the same physical box _IS_ possible.
Whether it SHOULD be included in the same box is another question entirely (and it perhaps best left up to the individual).

However...
Trying to COMBINE the two devices as mentioned by Thor-Arne would be rather a BAD idea IMNSHO.
The design of the linear regulator intentionally includes some 'f'iltering' (and this circuitry helps to transition the whole design to the desired 'unconditional stability').
The RC networks surrounding the current reference op-amp (U2) and voltage reference op-amp (U1) form one aspect of this filtering.
The 10uF capacitors on the output also act to filter out almost any form of oscillation.

Unless you're wanting a function generator that's limited to maximum frequencies of perhaps a couple of Hz, I would suggest it's NOT a great idea to 'modulate' the VRef input.

Footnote:
I _have_ seen power supply designs that look remarkably similar to the design of a traditional Class-A amplifier (and have an effective 'bandwidth' that could be suitable for a low-frequency function generator).
In THIS (fringe?) case, it might be more 'practical' to consider modulation of the VRef input in order to create a genuine 'dual-use' device.
The (Amspire based) devices described in this thread are quite some distance away from a traditional Class-A amplifier and therefore, I'd recommend against 'morphing' it into a function generator.
Title: Re: General Purpose Power Supply Design
Post by: TheRevva on May 13, 2013, 01:21:16 am
Grrrr, the forum just glitched on me and in the process I 'lost' the response I'd typed... <Hehe>

Hi (again) Thor-Arne,
First off, I should point out that I am FAR from being an EE (let alone a competent one...).  I'm merely a senile 'hobbyist' so we're both playing in the same 'paddling pool'..
This design was also my own 'baptism by fire' with LTSpice (and I do like what I've seen of it thus far!)
It appears that we're both using this design as a basis to 'self-learn'.

When Amspire started making comments about 'phase margin' in an earlier post, my eyes almost glazed over, but I'm s-l-o-w-l-y getting there.  (I _did_ mention the senility didn't I? <Grins>)
You've correctly pointed out that this design was 'intended' to be used with a tracking pre-regulator, so yes, the drop across this regulator _should_ be handled 'externally' to this circuit (and thus a lot of the power dissipation issues in the series pass transistor that entails).
I never saw the post from Amspire talking about overshoot (although I definitely experienced the same 'issue' within LTSpice and came to a similar conclusion).  Basically, the voltage reference amplifier (aka error amplifier) is somewhat s-l-o-w to respond (limited bandwidth), and therefore it commands the regulator to be a little 'overactive' at switch on.  By allowing the voltage reference input to effectively 'ramp up' through a simple RC filter, it overcomes the problem, but in doing so, it makes the regulator fairly s-l-o-w to reach the set voltage.  In your LTSpice example, it's taking several tens of milliseconds to ramp up.  My preference is to increase the effective open-loop bandwidth  of the regulator allowing any such ramp-up period to be much shorter.  The additional diode in your circuit is there to assist with discharging that capacitor when the voltage reference input is dropped, but I'm not sure I approve of discharging it directly into the output load bypassing any current regulation.
I can understand Amspires comment about your use of s-l-o-w-e-r transistors, and to be honest, I'm fairly sure my darlington NPN version is probably even slower!  Something I am seriously looking into is a concept I've 'borrowed / stolen' from a different design - http://gerrysweeney.com/fully-programmable-modular-bench-power-supply/ (http://gerrysweeney.com/fully-programmable-modular-bench-power-supply/).  Gerry elected to include a limited amount of 'local feedback' around the series pass regulation and this looks promising to me.  (I also like some of the other concepts of Gerry's design too.  For example, he has included basically a 'Kelvin type output which helps to eliminate any cable resistance between the supply and whatever it's powering.  i.e. There's an additional pair of 'sense' leads at the output than can optionally be used).
Anyway, have fun and learn heaps (I know I'm sure doing both!)
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on May 13, 2013, 08:28:53 am

I _have_ seen power supply designs that look remarkably similar to the design of a traditional Class-A amplifier (and have an effective 'bandwidth' that could be suitable for a low-frequency function generator).
In THIS (fringe?) case, it might be more 'practical' to consider modulation of the VRef input in order to create a genuine 'dual-use' device.
The (Amspire based) devices described in this thread are quite some distance away from a traditional Class-A amplifier and therefore, I'd recommend against 'morphing' it into a function generator.

I have seen simple function generators using the LM386 audio amplifier chip as output stage, that's a better way to approach a function generator with a little higher output power than trying to modulate a psu. However, that belongs in another thread.
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on May 13, 2013, 08:58:20 am
I think I mentioned in an earlier post that I'm doing this psu to learn, and I have quite a long way to go.  :P
Doesn't hurt to have more psu's either. In fact I have another psu project I'm working on to, but that's a bit stalled since I'm trying to figure out all the modifications done to that circuit.  |O

I still haven't grasped the phase margin, but I'm slowly getting there.
The basic operation of this design is quite easy to follow, the parts used is a completely different matter. I suppose the need for "fast" transistors comes from the use of PNP pass-transistor, the reason why I shouldn't use something slow as a MJE2955 is a bit unclear at this point. To my (lacking) knowledge a slower transistor should be usable if the other parts is changed accordingly, which is another reason for putting together a version with other parts.
I might try some small signal transistors in a other version, but  I really wanted to get away from the 0.2 ohm balancing resistors. We'll see when I get some time to play with that.

I think some posts is missing, I'll attach LTspice files for the two versions of the Mark-3 design so you can see the differences.

I'll  take a close look at the design you linked, perhaps I'll make that one to.  ;D
Title: Re: General Purpose Power Supply Design
Post by: Teemo on May 16, 2013, 12:29:46 pm
Hello,
Here is some good reading about the stability of linear regulators: http://sva.ti.com/assets/en/appnotes/f10.pdf (http://sva.ti.com/assets/en/appnotes/f10.pdf)
Regards.
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on May 16, 2013, 01:14:43 pm
Great reading. Thanks.  :-+
Title: Re: General Purpose Power Supply Design
Post by: TheRevva on May 17, 2013, 10:25:26 pm
I definitely agree that it's a very well written text.
(My only problem is that it arrived a few days too late for me.  I finally managed to get my head around the phase margin issues a few days ago.  Murphy was an optimist!!!).

I'm now MORE certain than ever that my decision to go with an NPN regulator is the RIGHT one for me.
I want as little as possible in the way of bulk capacitance on the output, and this is almost impossible with an LDO without incurring stability issues.
When coupled with the fact that my supply will experience HUGE differences in the output load (ranging from mA to several Amps), it makes my goal of unconditional stability harder to realise (with an LDO)!
The additional input-to-output losses I'll encounter by rejecting use of an LDO design are largely insignificant to me.  I'll simply make sure the pre-regulator maintains the input supply voltage far enough beyond the desired output voltage.  The NPNseries pass control current (i.e. the current injected into the base of the series pass transistor) is dissipated by the external load rather than having to be internally dissipated.
I totally understand the logic of an LDO regulator, but in MY circumstances, the classic NPN regulator certainly appears to be a better choice.  While the PFET style LDO described later in the document alleviates _some_ of my issues with the general LDO design, I still hold that the NPN style is a 'better fit' for me.

My primary remaining obstacle is to better understand how well the incoming switching noise ('hash') from the SMPS pre-regulator will be suppressed by the linear regulator.  Obviously, I'll include HEAPS of bulk capacitance on the pre-regulator output spread across several capacitors (from several thousand uF down to mere nF), but I know there will still be SOME amount of this 40kHz hash that will still find it's way to the linear regulator input.  I've yet to determine how I should quantify the source noise rejection of the linear section.  (In other words, I have to perform some more 'LTSpice' simulations)
Title: Re: General Purpose Power Supply Design
Post by: Jebnor on June 14, 2013, 02:36:10 am
Thank you all.  This is fantastic thus far. (I'm on 22March 2012)  I'll be by with something to really contribute when I get to the end.
Title: Re: General Purpose Power Supply Design
Post by: Jebnor on June 14, 2013, 10:14:02 pm
A fantastic day of reading and researching was had by me. 

Thank you all!  :-+  :)

Has amspice posted a 'final' version yet?
Title: Re: General Purpose Power Supply Design
Post by: Kirigozo on January 22, 2014, 12:30:04 pm
Hello,
Here is some good reading about the stability of linear regulators: http://sva.ti.com/assets/en/appnotes/f10.pdf (http://sva.ti.com/assets/en/appnotes/f10.pdf)
Regards.

Hi folks,

I've tried to get the app note mentioned in the quote but that domain name is simply not responding to pings even. I've searched TI.com and had no luck either. The actual document title might help me locate it.

TIA
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on January 22, 2014, 01:09:19 pm
Here you go...

Document title is "A user's guide to compensating Low-dropout regulators".
Title: Re: General Purpose Power Supply Design
Post by: Kirigozo on January 22, 2014, 10:45:12 pm
Here you go...

Document title is "A user's guide to compensating Low-dropout regulators".

Been looking for something like that for ages!

Thank you very much.
 :-+  :-+
Title: Re: General Purpose Power Supply Design
Post by: lunemec on July 28, 2015, 02:35:21 pm
I am working on an update, and I hope to finally be able to build a prototype this weekend. Currently I have a lot of my parts in storage boxes, so I just have to sort that out first. There are some changes needed, and you are right, at very least you have to change the 1N4148 for a schottky. There is also a change needed to th reference input circuit  - A 1N4148 has to be added to a cap on the voltage reference input to the output to drag the reference down when the output voltage is low.

Several other changes, but I will build up some actual hardware first before putting up new circuits.

Hello amspire, I'm looking to build this power supply (analog version) because of problems with LT3080 (https://www.eevblog.com/forum/projects/lt3080-wierdness-dave's-power-supply-(eev224)-gone-mad/msg283556/ (https://www.eevblog.com/forum/projects/lt3080-wierdness-dave's-power-supply-(eev224)-gone-mad/msg283556/)) I'd like alternatives. Your power supply looks very promissing, but there has been no update for 2 years ...
Title: Re: General Purpose Power Supply Design
Post by: rolycat on July 28, 2015, 02:42:56 pm
Hello amspire, I'm looking to build this power supply (analog version) because of problems with LT3080 (https://www.eevblog.com/forum/projects/lt3080-wierdness-dave's-power-supply-(eev224)-gone-mad/msg283556/ (https://www.eevblog.com/forum/projects/lt3080-wierdness-dave's-power-supply-(eev224)-gone-mad/msg283556/)) I'd like alternatives. Your power supply looks very promissing, but there has been no update for 2 years ...

You are unlikely to get a reply from amspire, since regrettably he has not visited the forum for over 2 years. This may explain the lack of updates...
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on July 28, 2015, 02:54:07 pm
The regulator is basically all there, only the pre-regulator is missing, some tweaking of the feedback caps might be required on the final design.

I played around with it a little, but it stalled since I have enough psu's now.
Title: Re: General Purpose Power Supply Design
Post by: commie on July 28, 2015, 03:06:55 pm
Hello amspire, I'm looking to build this power supply (analog version) because of problems with LT3080 (https://www.eevblog.com/forum/projects/lt3080-wierdness-dave's-power-supply-(eev224)-gone-mad/msg283556/ (https://www.eevblog.com/forum/projects/lt3080-wierdness-dave's-power-supply-(eev224)-gone-mad/msg283556/)) I'd like alternatives. Your power supply looks very promissing, but there has been no update for 2 years ...

There are some things that you make for yourself and there are some which you buy. Of those you buy, it's an oscilloscope and a power supply plus other stuff. The reason for this is simply cost, performance,guarantee its going to be fully functional and ease of acquisition cannot be beaten.
Title: Re: General Purpose Power Supply Design
Post by: lunemec on July 28, 2015, 06:53:30 pm
Thank you guys for the response.

I'd like to ask if someone has LTSpice simulation of this circuit (ideally with the pre-regulator). I'm interrested if someone actually built this scheme.
I have spare 30W laptop charger (19V, 2.9A) that I'd like to use with this circuit. Kind of mini-lab psu.

Did anyone build this? Could you please attach LTspice file (maybe even board design?) :)

I'm looking for any PSU schematic, but this looked the most promising ... know of any other good ones (without LT3080 as it seems to have some issues)?
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on July 28, 2015, 07:27:25 pm
I've posted the Mk.3 spice files further up in this thread, as far as I know this is the latest ones posted.
Title: Re: General Purpose Power Supply Design
Post by: lunemec on August 02, 2015, 01:49:40 pm
Thor-ane, thank you for reponse, I tried your LTSpice schematic, and it works as expected, but I was looking for something complete - with all the subcircuits as a schematic, not just blocks like in the mk3 scheme....

I looked around the internet for some complete scheme and found this: http://www.electronics-lab.com/project/0-30-vdc-stabilized-power-supply-with-current-control-0-002-3-a/ (http://www.electronics-lab.com/project/0-30-vdc-stabilized-power-supply-with-current-control-0-002-3-a/)

I put it into LTSpice, but I'm not sure if I messed up the schematic, but there is 0.1V on the output all the time...

What do you think about this schematic, is it any good?
Any ideas about the LTSpice scheme (attached)?
Title: Re: General Purpose Power Supply Design
Post by: sorin on August 02, 2015, 02:55:57 pm
What do you think about this schematic, is it any good?

I'ts not good.
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on August 02, 2015, 03:22:09 pm
That one isn't good, it has been discussed several times.

Attached is a pre-regulator that I've tried with the Mk.3 design, works fine.
I did not finish a psu based on this, but it's a good start.
Title: Re: General Purpose Power Supply Design
Post by: AccountRemovedPerUsersRequest on August 02, 2015, 05:06:38 pm
That one isn't good, it has been discussed several times.

Attached is a pre-regulator that I've tried with the Mk.3 design, works fine.
I did not finish a psu based on this, but it's a good start.

I have one "...stabilized PSU..." built - up and running. Could you point to the discussions about it.

Axel.
Title: Re: General Purpose Power Supply Design
Post by: Thor-Arne on August 02, 2015, 05:57:09 pm
I didn't keep the bookmark for the original threads, there's at least two different versions of that design.

A search here on EEVblog should result in some results on this.
Title: Re: General Purpose Power Supply Design
Post by: lunemec on August 02, 2015, 07:33:10 pm
I'd like also some reasons why it is so bad. Sure, it is not much efficient and there are no thermal or short circuit protections, but that can be easily added.
Title: Re: General Purpose Power Supply Design
Post by: AccountRemovedPerUsersRequest on August 02, 2015, 07:56:42 pm
I didn't keep the bookmark for the original threads, there's at least two different versions of that design.

A search here on EEVblog should result in some results on this.

I found at least one thread and noticed that you have had some issues with the design.
I would not say that the design is that bad. I started to build mine using the unmodified version and fixed all the issues I came across. I found out afterwards that many of the issues are discussed in different forums. Some solutions of mine are similar - some are different.
As a result I have flat straight DC 0-30V 0-3A PSU. Works for me.

But I fully agree that the unmodified version is not recommended as is.

Axel.
Title: Re: General Purpose Power Supply Design
Post by: lunemec on August 03, 2015, 05:28:39 am
Axel, do you have any schematic of your fixed version? Could you maybe post it here?

Thank you, Lukas
Title: Re: General Purpose Power Supply Design
Post by: AccountRemovedPerUsersRequest on August 03, 2015, 06:29:35 am
Axel, do you have any schematic of your fixed version? Could you maybe post it here?

Thank you, Lukas

Hello,

It seems that there is so much discussion about the circuit already that all of the issues are covered. Since this circuit seems to be doomed I'm not too eager to publish my revision. (and there is not updated paper version anyway).

However, as a summary, comparing to the Electronics Lab version:
- transformer 180VA 38V
- Q3, U1 and U3 regulated to 26V
- U2 regulated to 35V
- U2 = OPA604
- removed R13, R14, Q1 circuit
- much bigger input and output caps
- Q4 as double 2N3773
- "adapter style" -solution in 5V reference. Used the original circuit and ISL21009 based voltage reference
- R7 to 20W
- small tweaks in component values, added few coupling caps to new power rails etc etc
- overheat protection capability (by separate control unit)
(proper heat dispatching must be taken care of - as probably mentioned everywhere)

Axel.