Author Topic: stabilize Lab PSU circuit CC mode  (Read 1971 times)

0 Members and 1 Guest are viewing this topic.

Offline nemail2Topic starter

  • Regular Contributor
  • *
  • Posts: 206
  • Country: at
stabilize Lab PSU circuit CC mode
« on: March 28, 2021, 10:49:28 pm »
Hi,

I made a Lab PSU and under certain cicumstances, the output starts to hum or oscillate, when in CC mode.
Attached some photos, the layout + schematics and a scope shot where you can see 100Hz crap which only occurs when in CC mode at higher output voltages.

The scope shot was made with two exactly identical of these PSUs, the only difference was that one had a 0.8 Ohm Shunt + MAX4080F (blue, channel 3) and the other had a 0.2 Ohm Shunt + MAX4080T (yellow, channel 1).

The output voltage was set to 13V and the current limit was set to 1A (which is the specified max. for this PSU). On the output I did connect a 12R power resistor.

The output voltage starts to flatten out at about 8V or so, where it is perfectly straight and clean, without any crap.
The moment I'm writing this, it comes to my mind that this may just be ripple due to the load??!

Opinions, ideas? Oh, almost forgot, if I zoom in, I can see some ~120kHz rubbish as well...

Thanks!
Boron rhymes with moron
 

Offline xavier60

  • Super Contributor
  • ***
  • Posts: 2823
  • Country: au
Re: stabilize Lab PSU circuit CC mode
« Reply #1 on: March 29, 2021, 12:07:30 am »
Need to fix the 120KHz oscillation first. I dont see a clear reason for it.
Try removing C5 then experimenting with the compensation starting with a 100nF capacitor, no resistor.
HP 54645A dso, Fluke 87V dmm,  Agilent U8002A psu,  FY6600 function gen,  Brymen BM857S, HAKKO FM-204, New! HAKKO FX-971.
 
The following users thanked this post: nemail2

Offline Vovk_Z

  • Super Contributor
  • ***
  • Posts: 1417
  • Country: ua
Re: stabilize Lab PSU circuit CC mode
« Reply #2 on: March 29, 2021, 03:18:25 am »
Increase C12 to 1-10 nF. Then, try to get rid of R10*C11, or R11*C13 (That's for HF stability).
And, MAX4080 is quite slow, so it seems to me it is fine for current measurement, but not for current control (not ok for fast control loop). That fact leads to a need to slow down a whole voltage and current control circuits.
« Last Edit: March 29, 2021, 03:30:26 am by Vovk_Z »
 
The following users thanked this post: nemail2

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21672
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: stabilize Lab PSU circuit CC mode
« Reply #3 on: March 29, 2021, 07:43:23 am »
You've got all the compensation components in there you should need, and in the right places more or less.  Play around with values until it's stable, and load step response is smooth.

Beware LM324 is a pretty awful op-amp, kind of marginal even for control applications like this.  You will have whole 10s of µs of integrator windup as IC3A/B come out of saturation respectively.  (This can be avoided with a limiter circuit like this, https://www.seventransistorlabs.com/Images/Limiter2.png which acts like wrapping another op-amp (the discrete stuff) around the existing one (shown; R5 is equivalent to your R8 || R9, and "Feedback Network" to your R10, C11).  Note that both paths need to be compensated ('FN' and R7, C1).

The reduced supply voltage is peculiar; you're wasting a good, what, 11V or so, less ripple peaks?  Well, maybe not that good, for that reason.  A higher voltage op-amp (and with better PSRR), or a lower voltage one (the whole control could run at 5V, eliminating the 27V supply entirely) with a level shifter, would do a fine job. :-+

There's an awful lot of precision values  -- I'd have to take a closer look at the ratios, but they all seem to be doing similar ratios.  You can probably adjust values to buy fewer types (BOM reduction).

Which, hmm... not so bad maybe?  14.7k seems to be well used, that's nice.  But, why not R8 too, as R9 is a unique value either way?  R29 doesn't seem to need to be so low either, it's... around 60mV at saturation, and resistive below there?  And all that for just 6mA?  Though it's always going to be some ratio to R31 and both need to be accurate to do it that way, so, you're kind of stuck with those two special values, unless some other method is used.

An alternative is to simply put a dumb ass resistor on the output, and since you know output voltage and its resistance (say, 1.5k 2W), just subtract that from the measurement, easy.

R20/R21 don't seem to need to be precision; they have no accurate connection to the output (2 * Vbe - D6(Vf)).  I expect ADC_CH1 is only used to detect current limit?  So great accuracy wouldn't be needed---granted, you might not have any other comparable values handy, and using an extra precision resistor or two is better than adding an extra BOM item.

An alternative might be making D6 into a current mirror of sorts; this may take more voltage headroom than is available here (i.e. IC3B might need -1V or so VEE to make this work), but the basic idea would be to turn D6 into a PNP, with the B-E junction as shown where the diode is currently.  Then, collector current is sourced into a near-GND sense resistor, and reflects the current shunted from R6.  That sense resistor can be relatively large (some kohms) so that it acts like a comparator, and it could be sensed adequately with an NPN inverter into a digital pin (or keep on sampling it with the ADC, it's just a bit more CPU work that way).

What's all the buffering for -- IC3C, D, IC9A?  ADC inputs are generally quite low current (~uA), so so the Thevenin equivalent of the dividers (R14/R15, R20/R21) is more than adequate.

Oh-- missing resistor I think, IC9A has a series resistor to its NPN buffer, but IC3C does not.  Note that both will overdrive their loads as shown, the base voltage being clamped to about 5.7V (because both B-E and B-C junctions will be forward biased).  Not that LM324/358 has all that much output source current, but it's always better to have these things well defined.  (Note that, if it does saturate, the op-amp will also integrator-windup, saturating to +V or as close as it can get while trying to drive that resistor; and it will take some time to slew back down.)

What's D2 doing, and R26 doesn't seem important either?

Lastly, grounding: there is no physical connection between P_VSS and AGND.  The poor IC2, and, pretty much everything really; who knows what kind of noise voltage might be induced there?  Oh there is an RF ground of sorts, a very thin one across IC2 -- C4 and C5, through the shunt resistors, yikes, heh.  And in the layout, not only is there a complete slot between ground pours, between power and analog sections, there's a nearly complete slot right under IC8, your precision source!

Hmm, but C21/C22 are bypassed to the analog side of AGND.  So then, really the problem is more the MCU ADC?  With, I assume AREF AVCC bypassed to the analog side, but AGND (or if it's not that as such, then simply the nearest GND, along with the rest of them) is on the digital side.  And all the ADC inputs of course are bypassed on the far side.

Yeah, really, just don't worry about it.  Join P_VSS and AGND in some reasonable way, and remove the slot in AGND.  All your digital signals are off to one side, that is all the "single point grounding" you need.  At worst, add some damping/termination resistors, say between ISP and IC9, and everything going out to PANEL.  (Maybe consider ESD diode arrays on PANEL too, or have a good way of handling ESD locally on that end, like multiple grounding points to a metal enclosure, if it's an HMI PCB sort of arrangement?)

Also guessing/assuming, that's an ATMEGA?  The ISP port certainly looks suggestive.  ATMEGA328p I would even guess, if it comes in that package?  Which then means 10 bit ADC, with pretty awful parameters really, so you may need to calibrate for best results, but also the steps are quite large so don't be worrying about esoterica like slotting grounds and AGND/DGND and ground loops and all that.  If you want to plop in a 16+ bit ADC and DAC, then you can start thinking about that, and using differential or instrumentation amps to sense V and I, and include features like 4-wire remote sensing and so on... then it will be worth it. :) For this, don't worry.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: nemail2

Offline nemail2Topic starter

  • Regular Contributor
  • *
  • Posts: 206
  • Country: at
Re: stabilize Lab PSU circuit CC mode
« Reply #4 on: March 29, 2021, 07:49:34 am »
Need to fix the 120KHz oscillation first. I dont see a clear reason for it.
Try removing C5 then experimenting with the compensation starting with a 100nF capacitor, no resistor.

Unfortunately I have absolutely now knowledge when it comes to compensating control loops. You mean 100nF instead of C5 or instead of C11/C13 and remove R10/R11?

Increase C12 to 1-10 nF. Then, try to get rid of R10*C11, or R11*C13 (That's for HF stability).
And, MAX4080 is quite slow, so it seems to me it is fine for current measurement, but not for current control (not ok for fast control loop). That fact leads to a need to slow down a whole voltage and current control circuits.

Increasing C12 is easy, I'll try that today in the evening. How would I get rid of R10/C11 or R11/C13? Some fellow forum member did this compensation and without it, the PSU just oscillates wildly. I've heard quite a few times now, that the MAX4080 is quite slow but that's ok for me, the control loop doesn't have to be too fast for me... Isn't the TIP3055/BD139 combo quite slow as well?


I have attached the mentioned "120 kHz" oscillation, which turned out to be ~172 kHz on the PSU with the 0.2 Ohms shunt + MAX4080T (channel 1) and ~127 kHz for the PSU with 0.8 Ohms shunt + MAX4080F.

Thanks!
Boron rhymes with moron
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21672
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: stabilize Lab PSU circuit CC mode
« Reply #5 on: March 29, 2021, 07:52:08 am »
Hmm, do you by any chance have some poor quality power supplies, chargers, computers, etc. nearby?

Yet another thing LM324/358 is awful at: RFI is rectified by the input transistors, introducing variable offsets into your system.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: nemail2

Offline xavier60

  • Super Contributor
  • ***
  • Posts: 2823
  • Country: au
Re: stabilize Lab PSU circuit CC mode
« Reply #6 on: March 29, 2021, 07:56:39 am »
C13 is the compensating capacitor for the CC loop. Is the 172KHz there only in CC mode?
HP 54645A dso, Fluke 87V dmm,  Agilent U8002A psu,  FY6600 function gen,  Brymen BM857S, HAKKO FM-204, New! HAKKO FX-971.
 
The following users thanked this post: nemail2

Offline nemail2Topic starter

  • Regular Contributor
  • *
  • Posts: 206
  • Country: at
Re: stabilize Lab PSU circuit CC mode
« Reply #7 on: March 29, 2021, 09:39:59 am »
@T3sl4co1l Thanks for that thorough analysis! :)

You've got all the compensation components in there you should need, and in the right places more or less.  Play around with values until it's stable, and load step response is smooth.

If I'd only had an idea on which values to start :) Some suggestions have been made here, already and I'll try them out but other than that, I'm completely lost, as someone else has done the compensation the way is currently is... :)

Beware LM324 is a pretty awful op-amp, kind of marginal even for control applications like this.  You will have whole 10s of µs of integrator windup as IC3A/B come out of saturation respectively.  (This can be avoided with a limiter circuit like this, https://www.seventransistorlabs.com/Images/Limiter2.png which acts like wrapping another op-amp (the discrete stuff) around the existing one (shown; R5 is equivalent to your R8 || R9, and "Feedback Network" to your R10, C11).  Note that both paths need to be compensated ('FN' and R7, C1).

Regarding the awful op-amp: I have heard that several times now :-) This is/was supposed to be a relatively cheap-ass PSU with okay-ish performance, so I chose to go with a cheap op-amp. Easy, cheap alternatives are welcome, as long as the necessary compensation values come with it to get at least the performance I'm having now - cause I for myself would have absolutely no clue where to start when it comes to compensating stuff :-)
Regarding the limiter circuit I have understood the R5 to R8/R9 thing but not how I would put in R10/C11 or how to compensate both (which) paths and what 'FN' means, I'm sorry, absolute cluelessness here  |O :-//
Unfortunately I want to fly a plane without knowing how to open its door...

The reduced supply voltage is peculiar; you're wasting a good, what, 11V or so, less ripple peaks?  Well, maybe not that good, for that reason.  A higher voltage op-amp (and with better PSRR), or a lower voltage one (the whole control could run at 5V, eliminating the 27V supply entirely) with a level shifter, would do a fine job. :-+
You mean reduced in terms of max. opamp supply voltage? I wanted it to be stabilized and I'm creating it from a 24VAC transformator which also does the voltage for the PSU output, so 27V seemed reasonable. I'm not aware of what wasting 11V ripple peaks means, would a higher supply voltage be better for the circuit and if so, why?
Also I didn't quite manage to wrap my head around the level shifter idea (which seems nice, though). What kind of level shifter, that would have to be some gain/multiplier device which in the end again would have to have 27V or something, no? I mean, at some point I will have to have the 27V or so to get to my 25V output voltage?

There's an awful lot of precision values  -- I'd have to take a closer look at the ratios, but they all seem to be doing similar ratios.  You can probably adjust values to buy fewer types (BOM reduction).

Which, hmm... not so bad maybe?  14.7k seems to be well used, that's nice.  But, why not R8 too, as R9 is a unique value either way?  R29 doesn't seem to need to be so low either, it's... around 60mV at saturation, and resistive below there?  And all that for just 6mA?  Though it's always going to be some ratio to R31 and both need to be accurate to do it that way, so, you're kind of stuck with those two special values, unless some other method is used.

An alternative is to simply put a dumb ass resistor on the output, and since you know output voltage and its resistance (say, 1.5k 2W), just subtract that from the measurement, easy.

R20/R21 don't seem to need to be precision; they have no accurate connection to the output (2 * Vbe - D6(Vf)).  I expect ADC_CH1 is only used to detect current limit?  So great accuracy wouldn't be needed---granted, you might not have any other comparable values handy, and using an extra precision resistor or two is better than adding an extra BOM item.
You are right, I already tried to consolidate the precision values and reduce BOM items but I didn't think of R20/R21, they are just there for current limit detection, like you already figured out. Changing R8 to 14.7k would be smart, I totally missed that, thanks!
I thought I was really smart to use 14.7k for R28 :) That minimal load helps to make the PSU stable, 6mA is not a lot for a 0-1A PSU to waste and I don't have to calibrate much out, as the load should always be around 6mA.. That was the idea behind that and one of the op-amps was free anyway...
Due to the "large" range of 0-25V I didn't want to use a resistor as minimal load because that would have meant to waste quite a lot of power at higher voltages if I want the resistor to still draw a few mA at very low voltages... BTW I'm using the cheap Sumusu resistors available at Mouser, eg: https://www.mouser.at/ProductDetail/Susumu/RR1220P-1472-D-M?qs=%2Fha2pyFaduhWgMOgZQJAgM%2FnBGHB3545gZ%252BKEW2AuTT3GcZS6PUygw%3D%3D They are quite cheap.

An alternative might be making D6 into a current mirror of sorts; this may take more voltage headroom than is available here (i.e. IC3B might need -1V or so VEE to make this work), but the basic idea would be to turn D6 into a PNP, with the B-E junction as shown where the diode is currently.  Then, collector current is sourced into a near-GND sense resistor, and reflects the current shunted from R6.  That sense resistor can be relatively large (some kohms) so that it acts like a comparator, and it could be sensed adequately with an NPN inverter into a digital pin (or keep on sampling it with the ADC, it's just a bit more CPU work that way).
as minimal load, you mean? I'd have to try to wrap my head around that :D Although I'm quite happy with the current minimal load circuit...

What's all the buffering for -- IC3C, D, IC9A?  ADC inputs are generally quite low current (~uA), so so the Thevenin equivalent of the dividers (R14/R15, R20/R21) is more than adequate.
Mainly I put in the buffering to not disturb the control loop in any way with some voltage dividers and ADC sampling. I vaguely remember that when I didn't have the buffering, weird stuff was going on...

Oh-- missing resistor I think, IC9A has a series resistor to its NPN buffer, but IC3C does not.  Note that both will overdrive their loads as shown, the base voltage being clamped to about 5.7V (because both B-E and B-C junctions will be forward biased).  Not that LM324/358 has all that much output source current, but it's always better to have these things well defined.  (Note that, if it does saturate, the op-amp will also integrator-windup, saturating to +V or as close as it can get while trying to drive that resistor; and it will take some time to slew back down.)

What's D2 doing, and R26 doesn't seem important either?
Well spotted :) I did notice that yesterday as well. I'll put in a resistor for IC3C as well.

Lastly, grounding: there is no physical connection between P_VSS and AGND.  The poor IC2, and, pretty much everything really; who knows what kind of noise voltage might be induced there?  Oh there is an RF ground of sorts, a very thin one across IC2 -- C4 and C5, through the shunt resistors, yikes, heh.  And in the layout, not only is there a complete slot between ground pours, between power and analog sections, there's a nearly complete slot right under IC8, your precision source!

Hmm, but C21/C22 are bypassed to the analog side of AGND.  So then, really the problem is more the MCU ADC?  With, I assume AREF AVCC bypassed to the analog side, but AGND (or if it's not that as such, then simply the nearest GND, along with the rest of them) is on the digital side.  And all the ADC inputs of course are bypassed on the far side.

Yeah, really, just don't worry about it.  Join P_VSS and AGND in some reasonable way, and remove the slot in AGND.  All your digital signals are off to one side, that is all the "single point grounding" you need.  At worst, add some damping/termination resistors, say between ISP and IC9, and everything going out to PANEL.  (Maybe consider ESD diode arrays on PANEL too, or have a good way of handling ESD locally on that end, like multiple grounding points to a metal enclosure, if it's an HMI PCB sort of arrangement?)

Also guessing/assuming, that's an ATMEGA?  The ISP port certainly looks suggestive.  ATMEGA328p I would even guess, if it comes in that package?  Which then means 10 bit ADC, with pretty awful parameters really, so you may need to calibrate for best results, but also the steps are quite large so don't be worrying about esoterica like slotting grounds and AGND/DGND and ground loops and all that.  If you want to plop in a 16+ bit ADC and DAC, then you can start thinking about that, and using differential or instrumentation amps to sense V and I, and include features like 4-wire remote sensing and so on... then it will be worth it. :) For this, don't worry.

I have attached grounds.png where I marked the ground connection points. There is a "star ground" for AGND/GND in the lower right corner, which buggers of using a wire to the left where the transformers and VREGs are. The 27V AGND supply also has a wire to the left, I wasn't sure about whether I should wire an extra ground there or just rely on the star ground in the lower right corner for that...
P_VSS and the other grounds join on the left where the transformers and VREGS are as well.

Regarding IC8 (DAC) I tried to separate I2C crap from the analog part, but as neither the DAC nor the Atmega (1284p) do have separate AGND/DGND, I tried to manage it like I did, using a ferrite bead and ceramic caps (basically an LC filter of some sort). and putting the ground slot beneath IC8.
The 10 bit ADC of the Atmega doesn't seem to be too bad, it actually does the job quite well for what it is needed here. At least I'm happy with it :)
But in essence you're saying I should just join all the grounds together and leave it be?

Regarding ESD:
No user-touchable points* on the front panel are connected electrically to any circuitry or conductive part, however I can't of course rule out some really high voltage ESD could get through and zap stuff. Currently I don't have any ESD protection on the HMI other than the fact that the front is basically made out of plastic (*except for the bindig posts of course lol). The whole case is made out of plastic, resulting in a class 2 insulated device.

Also attached you'll find the front panel layout (not a whole lot to see there), as well as the schematics of the mains transformers and VREGs and the MCU part.

Hmm, do you by any chance have some poor quality power supplies, chargers, computers, etc. nearby?

Yet another thing LM324/358 is awful at: RFI is rectified by the input transistors, introducing variable offsets into your system.

Tim
Yes, all sorts of crap all around me. Multiple PCs, Mean Well switching supply for LED light (switched already off when doing measurements because of massive crap on the scope if it is turned on), LED spots on the ceiling, monitors everywhere...
@LM324/LM358: like mentioned above, easy and cheap drop-in replacements are very welcome :)

The issue with this project is, that I have put quite some time into it already and I'd love to get it to an end within reasonable time without having to redo a whole lot of it. It is not that I don't want to learn or don't want to do it right, there's just a whole lot of other stuff to be done and I'd like to get this thing out of my head. At some point I may revisit the Lab PSU topic and maybe even start from scratch, trying to inherently improve things but for now, I'm getting a bit tired of it, if you know what I mean :-)

C13 is the compensating capacitor for the CC loop. Is the 172KHz there only in CC mode?
Yes, it is only there in CC mode. In CV mode, the output voltage is clean as a whistle.
« Last Edit: March 29, 2021, 09:47:25 am by nemail2 »
Boron rhymes with moron
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21672
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: stabilize Lab PSU circuit CC mode
« Reply #8 on: March 29, 2021, 12:32:38 pm »
If I'd only had an idea on which values to start :) Some suggestions have been made here, already and I'll try them out but other than that, I'm completely lost, as someone else has done the compensation the way is currently is... :)

It's hard to give more than estimates, from a schematic; it's often easier to just do it in person.

The safe approach is typically: use too large of a capacitor (yes, like 100nF is probably "too large" enough), and adjust the resistor to get a stable response that looks good.  Then reduce the capacitor until the response looks about as fast as can be.  Tweak the resistor up and down and so on until it looks worse in all directions.

The adjustments are quite gross at first, by factors of 2, even 5 or 10.  It's rare that one needs to (or even should) tune this kind of control loop much more precise than, like, +50/-33% or so.

So, easiest way is to tack two wires onto the circuit nodes and stick them in a solderless breadboard, and grab a selection of resistors, 1k, 2.2k, 4.7k, 10k, 22k, 47k, 100k, 220k..., and similarly for capacitors, say 100pF to 100nF.  Start with an average value like 10k for the resistor, and large for the capacitor.  You're exploring a 2-dimensional solution space, by taking pretty big steps over it; the space should be pretty smooth, varying slowly from step to step, so a wide sampling should still be alright.  And by going back and forth between R and C adjustments, you're doing a gradient descent towards the optimal point in that space.  (It's so simple, a computer could do it. ;) )

Can also try with a small C in parallel with the R.  This can be helpful when R is especially large.  This has the effect of only C in the feedback path (like a pure integrator) at the highest frequencies.  This can reduce phase margin near cutoff (bad), but it can also improve noise immunity (by reducing gain).  Sometimes a little helps, sometimes not.

Which, you've kinda got already.  The---I don't have the schematic open at the moment, I remember seeing one across the volt error amp though?  Being directly across, it's just slowing down an already slow integrator, so it seems a bit odd, and maybe a better solution exists -- but maybe it's the best solution after all, and a little testing can prove that out.

Also, you know what I mean by load step testing, right? -- scope the output waveform and see how it moves, transiently, in response to a step change in load.  A good step load is to take two resistors, one always wired to the output as base load, the other wired to a MOSFET driven by a modest rate clock generator (say 10Hz to a few kHz, enough to see the transient fully decay).  It's simply putting the second resistor in parallel with the first, so the load current is alternating, exercising the controller.  With a selection of resistors, and a range of setpoints, you can have the voltage or current, bounce up and down, or alternate between CV and CC modes.

Or the simplest possible realization, don't bother with the clock and switch at all, just touch the extra resistor on by hand, manually.  Harder to get a clean scope trigger, but can work in a pinch!


Quote
Regarding the awful op-amp: I have heard that several times now :-) This is/was supposed to be a relatively cheap-ass PSU with okay-ish performance, so I chose to go with a cheap op-amp. Easy, cheap alternatives are welcome, as long as the necessary compensation values come with it to get at least the performance I'm having now - cause I for myself would have absolutely no clue where to start when it comes to compensating stuff :-)
Regarding the limiter circuit I have understood the R5 to R8/R9 thing but not how I would put in R10/C11 or how to compensate both (which) paths and what 'FN' means, I'm sorry, absolute cluelessness here  |O :-//
Unfortunately I want to fly a plane without knowing how to open its door...

'FN', I was abbreviating (Frequency Network), should've written that "F.N.".

I forget offhand what some better, but still jellybean, low precision, single-supply op-amps are; among the precision types, OPA4171 comes to mind for example.  At lower voltages, I might reach for TLV2374, which... (see level shifters below)

Quote
You mean reduced in terms of max. opamp supply voltage? I wanted it to be stabilized and I'm creating it from a 24VAC transformator which also does the voltage for the PSU output, so 27V seemed reasonable. I'm not aware of what wasting 11V ripple peaks means, would a higher supply voltage be better for the circuit and if so, why?
Also I didn't quite manage to wrap my head around the level shifter idea (which seems nice, though). What kind of level shifter, that would have to be some gain/multiplier device which in the end again would have to have 27V or something, no? I mean, at some point I will have to have the 27V or so to get to my 25V output voltage?

24VAC should give around 34V peak, less FWB diode drops say 32V, and, I don't know how much ripple you'll have; 1000uF I think would be enough capacitance for ripple to be around 10%, i.e. 3Vpp.

Hmm, maybe I shouldn't use that phrasing, "less" in this sense can pretty much be substituted with "minus".  So, "less ripple peaks" as in, sure the peak supply voltage might be 32V, but we can't operate at 32V all the time, if the ripple is 3V then we need to stay below that or else the regulator can't regulate.

Anyway, with a 27V supply, and the LM324 dropping about 2V when pulling up to +V, and the Darlington emitter follower output dropping about 2V (2 * Vbe), I'm guessing you're getting more like 21V max out.  Or 22, 23 because I rounded up most of those drops.  But I don't think you're going to get the full 25V range you indicated.

A good choice for level shifter is an NPN common base amplifier.  The base voltage can be set from a voltage divider, say 2V quiescent; the emitter is driven by the error amp, through a small series resistor (the amp's output range might be 0 ... 5V, but it really only needs 0 ... 1.4V to work), and the collector goes to the pass transistor base.  A current source pulls up on the collector, rated for required base current (a few mA should do).  The common base amplifier is noninverting, so you don't have to swap around anything with feedback polarity or anything, and gain is given by the emitter resistance (specifically, it sets transconductance).  You may still need compensation, in the form of an R+C network from collector to ground, or collector to base (for which it helps to set base voltage by a resistor divider, instead of say, a few diodes in series, where that wouldn't work so well).

Typical current sources/sinks:
https://sound-au.com/ism.htm

Or, if an inverting stage is acceptable, an NPN or PNP common emitter amplifier can be used.  This can be wired with a combination bias and negative-feedback resistor from collector to base (and a resistor from base to +V/GND to set bias, and one more from base to error amp output for actual signal drive).  Because of the C-B feedback, an emitter resistor may not be needed [to keep it biased stable], and this allows the transistor to saturate very near to +V/GND.  The error amp inputs will have to be swapped, but not the compensation networks; and the wired-OR arrangement for the CC/CV I guess needs to be swapped as well (i.e. flip the diode).

There are more complicated arrangements, using a few more transistors, with various advantages, but also with more complexity than I'll have any luck describing in text here...


Quote
An alternative might be making D6 into a current mirror of sorts; this may take more voltage headroom than is available here (i.e. IC3B might need -1V or so VEE to make this work), but the basic idea would be to turn D6 into a PNP, with the B-E junction as shown where the diode is currently.  Then, collector current is sourced into a near-GND sense resistor, and reflects the current shunted from R6.  That sense resistor can be relatively large (some kohms) so that it acts like a comparator, and it could be sensed adequately with an NPN inverter into a digital pin (or keep on sampling it with the ADC, it's just a bit more CPU work that way).
as minimal load, you mean? I'd have to try to wrap my head around that :D Although I'm quite happy with the current minimal load circuit...

Ah, the C/V operating mode sense circuit that is.


Quote
I have attached grounds.png where I marked the ground connection points. There is a "star ground" for AGND/GND in the lower right corner, which buggers of using a wire to the left where the transformers and VREGs are. The 27V AGND supply also has a wire to the left, I wasn't sure about whether I should wire an extra ground there or just rely on the star ground in the lower right corner for that...
P_VSS and the other grounds join on the left where the transformers and VREGS are as well.

Regarding IC8 (DAC) I tried to separate I2C crap from the analog part, but as neither the DAC nor the Atmega (1284p) do have separate AGND/DGND, I tried to manage it like I did, using a ferrite bead and ceramic caps (basically an LC filter of some sort). and putting the ground slot beneath IC8.
The 10 bit ADC of the Atmega doesn't seem to be too bad, it actually does the job quite well for what it is needed here. At least I'm happy with it :)
But in essence you're saying I should just join all the grounds together and leave it be?

Ah, I had a suspicion that's what those connectors were for.

Yes -- better to wire it all together on the PCB already.  You can do a bit of a star ground near the output terminal, perhaps, but for the most part, just cover the bottom with copper, it'll be more robust.

And you can always just let currents flow wherever the hell they do, and use differential sensing to make the measurement properly.  Instead of reading a single ADC channel for output voltage, for example, you might read two in quick succession, one for VOUT and one for GNDOUT, and subtract the measurements.  The control circuit can do the same, using a differential amplifier, the "REF" side of which gets tied to OUTGND (or a remote sense, if you want to get into that kind of thing).  This way, there could be whole volts between grounds, and the signals remain perfectly reasonable because that offset is subtracted out.  (I mean, whole volts wouldn't be very pleasant, it would noticeably eat into the controller's voltage range, or something.  But with good grounding and non-catastrophic fault currents across it, yeah, maybe a few mV if that?)


Quote
Regarding ESD:
No user-touchable points* on the front panel are connected electrically to any circuitry or conductive part, however I can't of course rule out some really high voltage ESD could get through and zap stuff. Currently I don't have any ESD protection on the HMI other than the fact that the front is basically made out of plastic (*except for the bindig posts of course lol). The whole case is made out of plastic, resulting in a class 2 insulated device.

Ah... that's kind of good, but also not.  The catch is: while that solves the matter of direct strikes, the fact is, an ESD event is a small EMP blast that radiates outward from the spark.  A typical test is IEC 61000-4-2's coupling planes: a metal plate is simply placed nearby the EUT, and sparked.  The radiation from the ESD gun and plate, couple all sorts of nasties into the nearby circuit -- and since it's largely electric or electromagnetic in nature, it goes right through a plastic case.  So you should imagine the effects that an influence of some tens to hundreds of volts, between exposed traces, or even between grounds, might have on your circuit.  It's only very brief -- some nanoseconds -- but this is more than enough to upset semiconductors, or even damage them.  (Probably not damage at this level, direct hits (8kV+) are much more destructive; but upset, or just plain old interference -- quite possible.)

Will your LCD be hiding behind a clear bezel or something?  Those usually (always?) have a metal frame, that might be worth insulating just in case...

Mmm, ground plane... :)


Quote
The issue with this project is, that I have put quite some time into it already and I'd love to get it to an end within reasonable time without having to redo a whole lot of it. It is not that I don't want to learn or don't want to do it right, there's just a whole lot of other stuff to be done and I'd like to get this thing out of my head. At some point I may revisit the Lab PSU topic and maybe even start from scratch, trying to inherently improve things but for now, I'm getting a bit tired of it, if you know what I mean :-)

Yes, the paradox of progress... :)  Fortunately, you've already done most of the work, and done it right; what's left is mostly pretty easy to fix, like adjusting component values; even if you've already ordered boards, those can be fixed -- just scrape off soldermask and solder on wire/braid/foil patches!

Tim
« Last Edit: March 29, 2021, 12:34:56 pm by T3sl4co1l »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: nemail2

Offline Vovk_Z

  • Super Contributor
  • ***
  • Posts: 1417
  • Country: ua
Re: stabilize Lab PSU circuit CC mode
« Reply #9 on: March 29, 2021, 01:36:59 pm »
How would I get rid of R10/C11 or R11/C13?
They may be needed, I wanted to say 'play with values'.
 
The following users thanked this post: nemail2

Offline Vovk_Z

  • Super Contributor
  • ***
  • Posts: 1417
  • Country: ua
Re: stabilize Lab PSU circuit CC mode
« Reply #10 on: March 29, 2021, 01:46:45 pm »
Isn't the TIP3055/BD139 combo quite slow as well?
No, this combo will try to oscillate if there is a possibility. You may add series 10R and 1R resistors before T1 and T4 bases accordingly (to make them more silent). But it is not a main root of a case (as it seems to me from an oscillation frequency and it oscillates only in CC mode. But who knows.)
 
The following users thanked this post: nemail2

Offline nemail2Topic starter

  • Regular Contributor
  • *
  • Posts: 206
  • Country: at
Re: stabilize Lab PSU circuit CC mode
« Reply #11 on: March 29, 2021, 04:47:30 pm »
Wow, thanks again for your time, really appreciated.

It's hard to give more than estimates, from a schematic; it's often easier to just do it in person.

I would love do that but unfortunately we are a bit... overseas from each other. Also, I'm afraid I couldn't afford that for a hobbyist project :)

The safe approach is typically: use too large of a capacitor (yes, like 100nF is probably "too large" enough), and adjust the resistor to get a stable response that looks good.  Then reduce the capacitor until the response looks about as fast as can be.  Tweak the resistor up and down and so on until it looks worse in all directions.

The adjustments are quite gross at first, by factors of 2, even 5 or 10.  It's rare that one needs to (or even should) tune this kind of control loop much more precise than, like, +50/-33% or so.

So, easiest way is to tack two wires onto the circuit nodes and stick them in a solderless breadboard, and grab a selection of resistors, 1k, 2.2k, 4.7k, 10k, 22k, 47k, 100k, 220k..., and similarly for capacitors, say 100pF to 100nF.  Start with an average value like 10k for the resistor, and large for the capacitor.  You're exploring a 2-dimensional solution space, by taking pretty big steps over it; the space should be pretty smooth, varying slowly from step to step, so a wide sampling should still be alright.  And by going back and forth between R and C adjustments, you're doing a gradient descent towards the optimal point in that space.  (It's so simple, a computer could do it. ;) )

pew that's going to take some effort but I guess it'll be worth it.. so you are saying I should try those things with R10/C11, R11/C13 and C12? With which pair would I start with and would I first go up or down with resistance after replacing 10nF respectively 1nF with the 100nF you mentioned?
Regarding the computer: I tried to simulate the circuit with LTSpice to recreate the real situation (and see the 100-something kHz oscillation) to then tweak it away but unfortunately the only stuff I got from LTSpice was garbage. I suspect the reasons to be:
- me, not knowing what I'm doing (simulation parameters and stuff)
- the lack of a MAX4080 model and my incapability of creating one or implementing some found ones or finding suitable drop-in replacement models

Can also try with a small C in parallel with the R.  This can be helpful when R is especially large.  This has the effect of only C in the feedback path (like a pure integrator) at the highest frequencies.  This can reduce phase margin near cutoff (bad), but it can also improve noise immunity (by reducing gain).  Sometimes a little helps, sometimes not.

Which, you've kinda got already.  The---I don't have the schematic open at the moment, I remember seeing one across the volt error amp though?  Being directly across, it's just slowing down an already slow integrator, so it seems a bit odd, and maybe a better solution exists -- but maybe it's the best solution after all, and a little testing can prove that out.

If you're talking about C12 22pF, that's across the VSET op-amp... Someone advised me to put it in a while ago and if I recall correctly, it fixed some oscillation under certain circumstances...

Also, you know what I mean by load step testing, right? -- scope the output waveform and see how it moves, transiently, in response to a step change in load.  A good step load is to take two resistors, one always wired to the output as base load, the other wired to a MOSFET driven by a modest rate clock generator (say 10Hz to a few kHz, enough to see the transient fully decay).  It's simply putting the second resistor in parallel with the first, so the load current is alternating, exercising the controller.  With a selection of resistors, and a range of setpoints, you can have the voltage or current, bounce up and down, or alternate between CV and CC modes.

Or the simplest possible realization, don't bother with the clock and switch at all, just touch the extra resistor on by hand, manually.  Harder to get a clean scope trigger, but can work in a pinch!
Thanks for pointing that out, I kinda overread it. I did a similar thing using a MOSFET to eliminate switching bounce and get a clean scope measurement and one load resistor but not two like you mentioned. Load transient response between CC/CV mode would indeed be interesting, especially in that context. I will include that into my testing when finally playing around with the compensation component's values.

'FN', I was abbreviating (Frequency Network), should've written that "F.N.".

I forget offhand what some better, but still jellybean, low precision, single-supply op-amps are; among the precision types, OPA4171 comes to mind for example.  At lower voltages, I might reach for TLV2374, which... (see level shifters below)
No worries, I wouldn't have understood F.N. either :D
Hmm, they both seem to be around an order of magnitude more expensive than the LM324. They'll be worth it, I guess, but still... In a more expensive, more precision design I used the OPA4197. I more or less cheap-assed the design and made this project out of it. Here is the original, if you're interested: https://github.com/mamama1/LabPSU_Darlington
LTC6102 current sense amp, 10mOhm shunt, LT4320 ideal bridge rectifier with MOSFETs, DAC8311 (14 bit DAC), ADS1115 (16 Bit ADC), REF5040 reference (4.096V, 3ppm/°C, 0.05%), 0.05%/~15ppm resistors for dividers and stuff, Teensy 3.5 for the MCU part, so lots of beef for software stuff, 128x64 OLED display (very crispy pixels), 0-16V in 1mV steps, 0-4A in 1mA steps, this thing is very precise while completely uncalibrated, but expensive as hell :)

24VAC should give around 34V peak, less FWB diode drops say 32V, and, I don't know how much ripple you'll have; 1000uF I think would be enough capacitance for ripple to be around 10%, i.e. 3Vpp.

Hmm, maybe I shouldn't use that phrasing, "less" in this sense can pretty much be substituted with "minus".  So, "less ripple peaks" as in, sure the peak supply voltage might be 32V, but we can't operate at 32V all the time, if the ripple is 3V then we need to stay below that or else the regulator can't regulate.

Anyway, with a 27V supply, and the LM324 dropping about 2V when pulling up to +V, and the Darlington emitter follower output dropping about 2V (2 * Vbe), I'm guessing you're getting more like 21V max out.  Or 22, 23 because I rounded up most of those drops.  But I don't think you're going to get the full 25V range you indicated.

Hmm you're right, at nearly full load I only get 24.1V at the output, but that's ok for me, as I was aiming for 24V anyways. I know there is not much headroom left for manual wire loss compensation or for mains undervoltage but meh, I'll hardly ever use the 24V anyway and even if, AND the DUT needs so much current, it most probably won't be some precision device and will be happy with 23.5V as well, I guess. But anyway, it is not as bad as you suspected (22-23V). Maybe because I got 3300µF of capacitance  ;D

A good choice for level shifter is an NPN common base amplifier.  The base voltage can be set from a voltage divider, say 2V quiescent; the emitter is driven by the error amp, through a small series resistor (the amp's output range might be 0 ... 5V, but it really only needs 0 ... 1.4V to work), and the collector goes to the pass transistor base.  A current source pulls up on the collector, rated for required base current (a few mA should do).  The common base amplifier is noninverting, so you don't have to swap around anything with feedback polarity or anything, and gain is given by the emitter resistance (specifically, it sets transconductance).  You may still need compensation, in the form of an R+C network from collector to ground, or collector to base (for which it helps to set base voltage by a resistor divider, instead of say, a few diodes in series, where that wouldn't work so well).

Typical current sources/sinks:
https://sound-au.com/ism.htm

Or, if an inverting stage is acceptable, an NPN or PNP common emitter amplifier can be used.  This can be wired with a combination bias and negative-feedback resistor from collector to base (and a resistor from base to +V/GND to set bias, and one more from base to error amp output for actual signal drive).  Because of the C-B feedback, an emitter resistor may not be needed [to keep it biased stable], and this allows the transistor to saturate very near to +V/GND.  The error amp inputs will have to be swapped, but not the compensation networks; and the wired-OR arrangement for the CC/CV I guess needs to be swapped as well (i.e. flip the diode).

There are more complicated arrangements, using a few more transistors, with various advantages, but also with more complexity than I'll have any luck describing in text here...

I did read the link about current sources/sinks (and I found my minimal load at the end :D) but still I have no idea how that could get rid of the 27V supply voltage and how that correlates with the amplifiers you were talking about. I guess that's just way above my current capabilities (due to my brain resistance, HA, got it?  :-DD) I will try to drown my brain in non-alcoholic fluids, maybe that will aid in lowering its resistance a bit... Always stay hydrated, like a cap, you don't want to get a lack of electrolytes! Ok enough of that  |O ;D

Ah, I had a suspicion that's what those connectors were for.

Yes -- better to wire it all together on the PCB already.  You can do a bit of a star ground near the output terminal, perhaps, but for the most part, just cover the bottom with copper, it'll be more robust.

And you can always just let currents flow wherever the hell they do, and use differential sensing to make the measurement properly.  Instead of reading a single ADC channel for output voltage, for example, you might read two in quick succession, one for VOUT and one for GNDOUT, and subtract the measurements.  The control circuit can do the same, using a differential amplifier, the "REF" side of which gets tied to OUTGND (or a remote sense, if you want to get into that kind of thing).  This way, there could be whole volts between grounds, and the signals remain perfectly reasonable because that offset is subtracted out.  (I mean, whole volts wouldn't be very pleasant, it would noticeably eat into the controller's voltage range, or something.  But with good grounding and non-catastrophic fault currents across it, yeah, maybe a few mV if that?)

OK thanks! I guess I'll then just flood the bottom layer with a ground plane, if I got to respin the PCBs at some point. I do differential sensing (kind of) on the more expensive design which I linked earlier but I don't think that that's something I'll go into on this design.

Ah... that's kind of good, but also not.  The catch is: while that solves the matter of direct strikes, the fact is, an ESD event is a small EMP blast that radiates outward from the spark.  A typical test is IEC 61000-4-2's coupling planes: a metal plate is simply placed nearby the EUT, and sparked.  The radiation from the ESD gun and plate, couple all sorts of nasties into the nearby circuit -- and since it's largely electric or electromagnetic in nature, it goes right through a plastic case.  So you should imagine the effects that an influence of some tens to hundreds of volts, between exposed traces, or even between grounds, might have on your circuit.  It's only very brief -- some nanoseconds -- but this is more than enough to upset semiconductors, or even damage them.  (Probably not damage at this level, direct hits (8kV+) are much more destructive; but upset, or just plain old interference -- quite possible.)

Will your LCD be hiding behind a clear bezel or something?  Those usually (always?) have a metal frame, that might be worth insulating just in case...

Mmm, ground plane... :)

The front panel at least has a complete ground plane :) The LCD is currently not behind a bezel (and it has a metal frame) but I'll do that, I think. Up until now nothing ever happened but you never know... I have attached a photo of how it looks like from the front.

Yes, the paradox of progress... :)  Fortunately, you've already done most of the work, and done it right; what's left is mostly pretty easy to fix, like adjusting component values; even if you've already ordered boards, those can be fixed -- just scrape off soldermask and solder on wire/braid/foil patches!

Thanks, nice to read from a professional that I have made it right (even if you would have said I didn't make it horribly wrong)!

Quote from: T3sl4co1l
What's D2 doing, and R26 doesn't seem important either?
I just remembered that I didn't answer that yet. D2 is doing nothing (not populated), someone advised to put that in and said that that would give fast response on high, rapid current spikes (in opposition to R5, which slows things down). In this layout, I removed it because it caused weird stuff in CC mode.
R4 isn't populated either, btw, for the same reason.

R26 appearently slows things down and and I tried without it, but that caused oscillation in CC mode as well. As this has been copied from my more expensive, precision design from the github link above, R26 originally was a current balancing resistor for the two TIP3055/BD139 pairs but I then left in in for stability, even with only one TIP3055/BD139 pair.
Boron rhymes with moron
 

Offline nemail2Topic starter

  • Regular Contributor
  • *
  • Posts: 206
  • Country: at
Re: stabilize Lab PSU circuit CC mode
« Reply #12 on: April 08, 2021, 09:53:37 am »
Hi

so I soldered wires to the 0805 pads of R10/C11 and R11/C13 and connected them to a breadboard where I did put in 47k/10n and 4k7/1n.
I measured the output voltage when in CC mode just like I did before and what should I say.. having the breadboard in the game, the output voltage looks completely different when in CC mode and doesn't seem to change at all, even when changing values for R10/C11 and R11/C13.

I didn't have much time so what I did was replacing R10 with 23.5k /putting a second 47k in parallel), replacing C11 with 100n, 200n and even 300n, R11 to 2.35k and C13 to 10n and 100n, including all combinations of those changes. The output voltage always looked identical on the scope, no matter what I was doing. I have to admit though, that I didn't check if the frequency was changing, but the amplitude of the oscillation certainly was not changing. The frequency wasn't changing a lot, if it was changing at all.

What values should I play with now, should I try to remove or change C12? I guess as C12 being only 12pf, involving a breadboard would add huge error/variation to that...

I can make scope shots of how the output looks with my last tests a bit later today, in the evening, if anyone is interested...

Thanks!

edit: reattached schematic
« Last Edit: April 08, 2021, 05:08:24 pm by nemail2 »
Boron rhymes with moron
 

Offline nemail2Topic starter

  • Regular Contributor
  • *
  • Posts: 206
  • Country: at
Re: stabilize Lab PSU circuit CC mode
« Reply #13 on: April 16, 2021, 09:31:08 pm »
Hmmm I maybe kind of fixed it now, by reducing R11 from 4.7k to 2.2k. At least now the only stuff I can measure is some 100 Hz action (maybe just ripple?) when in CC mode @ 12V/1A...

Also I noticed that connecting a multimeter (BM786) across R11 got rid of some oscillation stuff, I guess that was because of the input capacitance of the multimeter...?
As soon as I reduced R11 from 4.7k to 2.2k connecting the multimeter didn't change anything anymore.
Boron rhymes with moron
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21672
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: stabilize Lab PSU circuit CC mode
« Reply #14 on: April 16, 2021, 10:32:16 pm »
Seems like a lot of ripple, but at least it's stable.  Now for load step testing? ;)

Can figure out where the ripple is coming from, see if an error amp is saturating (so it's not regulating anymore), or if it's from the source (it should have good PSRR, maybe something's fucky?), or like ground loop (unlikely?) or what.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline xavier60

  • Super Contributor
  • ***
  • Posts: 2823
  • Country: au
Re: stabilize Lab PSU circuit CC mode
« Reply #15 on: April 17, 2021, 08:00:57 am »
If C5 has not been removed, it would be passing some ripple current.
HP 54645A dso, Fluke 87V dmm,  Agilent U8002A psu,  FY6600 function gen,  Brymen BM857S, HAKKO FM-204, New! HAKKO FX-971.
 

Offline nemail2Topic starter

  • Regular Contributor
  • *
  • Posts: 206
  • Country: at
Re: stabilize Lab PSU circuit CC mode
« Reply #16 on: April 19, 2021, 06:23:30 pm »
Now for load step testing? ;)

Thanks for the reminder, had my head full of other stuff already. Will have to make a nice setup for this, though...

If C5 has not been removed, it would be passing some ripple current.

Also forgot that I wanted to do that (remove C5). Now the same condition creates the output like you can see in the screenshot. Almost gone!
Boron rhymes with moron
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21672
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: stabilize Lab PSU circuit CC mode
« Reply #17 on: April 19, 2021, 06:33:28 pm »
And that could well be ambient noise or ground loop!

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline nemail2Topic starter

  • Regular Contributor
  • *
  • Posts: 206
  • Country: at
Re: stabilize Lab PSU circuit CC mode
« Reply #18 on: April 20, 2021, 07:11:24 am »
Hmm I noticed something weird, which I can't explain...
For all the tests I was using and am using a 12 Ohm power resistor.
Voltage was always set to 13V.

From 100-800mA the output waveform looks quite flat, just a tiny bit of wiggly action to see.
At 900mA ripple appears
At 1A the ripple seems to flatten a bit out, the waveform looks a bit smoother and not so sharp like at 900mA load.

Is there an obvious explanation for this? Or is it just me, seeing sharper edges in the waveform with 900mA load?
Not that it really matters i guess - other PSUs have much worse ripple and I don't think this is going to hurt any DUT which I would use with this kind of supply. I'm just curious...
Boron rhymes with moron
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf