Output spikes when changing mode CC - CV in linear PSU - Page 1
Forum section: electronics / projects

author: Verdefluox
author_rank: Contributor
timestamp: May 21, 2023, 12:29:35 pm
content: Hi folks,from time to time I'm working on a relatively simple PSU (15V/500mA) controlled by an Arduino. Schematic is pretty straightforward, two op-amps that pull low the driving transistors in a sort of OR configuration. Here I present a simplified version, as I can see that the problem I'm having seems to be intrinsic into the configuration. The problem is actually quite easy: when I'm changing from CC to CV or viceversa, the two op-amps need to react to a new configuration, and hence the base voltage of the Darlington experiences to brief change of the voltage, and hence the current. Obviously this is intended, but leads also to very ugly spikes. Being in the closed loop, I'm having trouble on figuring how on the best solution to elimitate the problem. I know that the LM324 are actually quite old, but for now these are what I have around.What I've tried so far:1- increase R1 hoping that the op-amps deal with lower current excursions: limited success, doesn't really solve the problem and increasing the value even more doesn't actually reduce it after a certain point2- slowing the op-amp via the feedback caps: no success3- slowing down the inputs: no success, as the problem is anyway on the interaction of the two op-amp outputs via the diodes.4- changing the op-amps to faster ones: the problem is not solved, it's just that obviously the spike is narrower.At this point, I'm wondering if the problem is indeed in the configuration itself, and if I should maybe considering some topology alternative. I was also thinking if something could be done by changing the connection of the diodes maybe, but I honestly have no clue on how to proceed.Considering that it's gonna be controlled via an Arduino, I may consider also something done digitally, but I'm not sure if this is gonna be a viable solution. I've looked also at various PSU built with the same structure, but I actually never found an explicit solution regarding this specific problem. Some ideas regarding the matter?

author: Shay
author_rank: Regular Contributor
timestamp: May 21, 2023, 12:56:04 pm
content: LM324 have a slew rate of 0.5V/us.Either try utilizing a higher slew rate op amp, or limit the supply voltage. There will always be a spike when changing modes.Also, try adding some base-emitter resistors. Maybe 100 ohms?

author: Kleinstein
author_rank: Super Contributor
timestamp: May 21, 2023, 01:10:55 pm
content: The configuration with an output stage that is more giving an voltage out in open loop case is part of the problem. It makes it a bit more difficult to handle the CV to CC transition (but it help with the CC to CV transition). A base emitter resistors at the power transistor can help a little, though this is more something for the CC to CV transition.There is the limited speed of the LM324 and there is also a kind of integrator wind up for the inactive control loop. While in CV mode the OP-amp for the current regulation will be at the way to the supply and have it's integrating capacitors charged. So it is not only the slow LM324 but also the extra voltage in the capacitor to discharge.The are way to get at least partially around the wind up problem. A relatively elegant way is to have the capacitors for the regulation loops from behind the diodes. There are other methods too, but it is a tricky part. One can to a certain degree overcome it by having a single integrator for the CC and CV mode and have the diode minimum circuit before the integrator.There is another idea to protect the circuit: have a 2nd fixed, fast current limit directly at the ouput stage.For practical use there is also a good thing if the supply can provide a little more current for short spikes of a few 100 µs.Having some peak / overshoot for the CC-CV and back transitions is normal and seen with most lab supplies, even from the big brands.

author: jwet
author_rank: Frequent Contributor
timestamp: May 22, 2023, 03:39:32 pm
content: Often instead of having two error amp loops pulling on the output stage, consider having the current stage pull on the input to the voltage amp- this way there is only one device driving the output and one main loop. This implies kind of voltage priority but it can simplify things. You would have a divider on the reference input- (where your signal gen is in the spice circuit), you then have small FET across the bottom of the divider that pulls the reference down at current limit tapering off drive and you slip into current mode wihtout a hard transition. This avoids the integrator windup problems Kleinstein mentions and should make it easier to tame, pretty conventional.

author: Verdefluox
author_rank: Contributor
timestamp: May 23, 2023, 01:31:56 pm
content: *** IMPORTANT EDIT: In the scheme posted, going with the correction described by jwet R1 is not necessary anymore since with one opamp I can drive directly the BJT (hence, removing also the diode), but I forgot to remove it. I basically closed without saving and when I reopened to took the screenshot I forgot to edit that thing. It has very little impact on the simulation though. ***Ok, I'm back after doing some simulations.Resistors kind of lowered them (noticed that placing two of them helped, as often done in Darlingtons - one for each BJT), but didn't really helped, since I still had an elongation by 30%. I'm not sure if changing all the opamps to a faster one will solve the problem, just make the spike narrower. Maybe having two with different characteristics in some order?QuoteI tried to read it but I'm not understanding the configuration you're proposing. May I ask you to show me a simple scheme? It can be useful to understand, maybe I can reuse it for other purposes.QuoteReally? Having spikes shouldn't be a good thing, especially with sensitive parts that risk to be damaged. When this doesn't apply and having bursts is a good think? Just out of curiosity.QuoteThis is interesting, I tried to implement it (if I understood correctly the configuration) and it actually worked (see attachments). Even with a simple BJT the results are way better than I expected. Playing around with the integrator values showed also that keeping the current control faster than the voltage control tames the bursts better. The inversion during the fast drops I think is a direct consequence of the scheme and the various speeds, but I don't know if I can somehow correct it without losing the improvements so far or something else, so I'll leave this question open. If you have an idea let me know. And, in any case:- an underelongation (is that a word?) is not a problem, maybe it's not high performance but in general it shouldn't risk a sensible part.- if it goes below zero, I can always place a fast diode at the output in reverse, as I will do anyway when building itThe -5V supply is just for convenience, may be useful in case one doesn't have a R2R opamp or something like the 324 that can reach a lowest output quite near its rails. In those cases, one would need it anyway to power the opamps.Note also that in the simulation shown I modified the input times, so in the same graphs there are shown both mode changes (CC -> CV and CV -> CC).Anyway, for the performances I was looking for this is more than enough, but any further improvement will be welcomed.A side note: to be honest, for my specific application this problem has always been a secondary concern, since I was aiming more for a programmable, two mode possibilities (CC and CV) power supply, assuming to work mostly inside one of the two (either CC say, for LEDs, BJTs etc., and CV for "classical" uses), and keeping the locks more as a bland safety layer (it's not meant to use it for critical applications). Hence, even the initial configuration was okayish for me. But for a future PS with stricter tolerances this is a good starting point I guess, maybe it's also useful for other people aiming directly for that.

author: Kleinstein
author_rank: Super Contributor
timestamp: May 23, 2023, 03:44:15 pm
content: Quote from: Verdefluox on May 23, 2023, 01:31:56 pmThe idea is to more one side of C2/C3 to the other (kathode) side of the diodes D1 and D2 in the original plan.The new plan uses a different method, kind of reducing the reference votlage when the current limit kicks in. However the new plan has a flaw: as shown the CC part is not able to lower the set votlage for the CV part far enough. To work OK it has to be able to pull the voltage all the way to zero or even a little negative. Otherwise the current limit would not be effective with a short.For the current limit it depends if a really fast activation is wanted. For things like testing LEDs or transistors this usually wanted. For testing circuits that can take current spikes in the supply current (e.g. some digital electronic or a motor control) it can be an advantageous if the supply can provide more current for a short time. It is not that the supply is causing the current spike, but the DUT calling for current spike and the supply able to keep the voltage constant. With a stiff CV loop a buffer capacitor at the supply is only effective after the CC limit sets in and the voltage drops.For the peak current one should also keep in mind that the physical capacitor at the output can also provide a high current for a short time with a drop in the volage. Relevant is the combined current from the electronics and the capacitor.

author: jwet
author_rank: Frequent Contributor
timestamp: May 24, 2023, 02:39:40 pm
content: You've got the general idea but a small N MOSFET like a 2N7000 would work better as the input clamp. If the LM-324's are powered from the -5v, and you can pull Vref to ground or below, this might help the issue that Kleinstein mentioned- you do have to kill the reference fully as he says to get short circuit operation. In the schematic you posted, it does look like you can go negative I think?Having a negative 5V auxiliary supply is almost universal in circuits like this. You'll often see an unusual diode connection at the AC input after the transformer of power supplies to create a small negative voltage like this. You might also see an auxiliary higher voltage used to supply power to the op-amp high rails. The LM-324 has a ground sensing input but its CM range only only extends to 1.5v below its high rail which means you lose a bit at the top. In commercial supplies, they have the luxury of custom transformers and can create an additional supply that is will often be pegged to the output and the whole circuit operates kind of upside down- its confusing but pretty powerful. Look at some service manuals for old HP Linear Supplies- HP6234 and the like- good learning materials.The other common thing in lab supplies is that since they are fully floating like a battery (or should be), low side current sensing is fine and simpler. The difficulty with high side sensing once you get out of spice and start using real parts with tolerances is the difference amps with LM-324's and 2% resistors are not very good and real INA's or Diff amps are expensive. Often, some clever arrangement is made with this low side current sense R and that -5v rail to make things work better.LM-324's are pretty capable parts really- they should be well suited here unless you're going for a lot of speed- their slew rate is about a volt/uS and your supply would have to be considerably slower in general. I would get something that sort of working in SPICE and put it together- no solderless breadboards- do on it on a bare PCB with a ground plane- Manhattan style. You can then bounce this bench circuit again your spice model and learn a lot.Have fun- a good variable CV/CC power supply is a very challenging analog design in the end- its has humbled many a man.