Programmable Power Supply Digital Interface - Page 1
Forum section: electronics / projects

author: Perpetually_Debugging
author_rank: Contributor
timestamp: March 30, 2017, 05:54:17 pm
content: Good day all!This is my first post on these wonderful forums, so I apologize for any unintentional breach of etiquette, incompetence, or just asking dumb questions.I'm in the process of designing a LT3081-based programmable power supply for the lab, and I'm having trouble working out the digital interface for the device. From what I understand, I can feed a set voltage straight through into the SET pin, and this drives the non-inverting input of the error amplifier. There is an internal 50uA current source upstream of the pin, which allows the voltage to be set very easily by a pot between set and ground. However, I don't want to use a pot, I'd like to have the thing controlled by a DAC (driven by an external reference) to program the voltage precisely. This leads to my first question:Would it be possible to take the output of the DAC, scale it with an opamp to get the full voltage range of the regulator, and then run it into the SET pin? My concern is that the gain resistors will provide a path to ground from the current source, and there will be a voltage on SET that I didn't put there. And if this is the case (and will affect operation) would it be wise to put a buffer after the opamp to remove this path to ground, and then I wouldn't have to worry about the current source?Second, I don't know how to digitally interface to the ILIM current setting pin on the LT3081. The datasheet only shows applications with a resistor or a pot between ILIM and VOUT, and I'm curious as if and why it needs to be tied to VOUT. I've seen people set the current limit digitally, by using a current mirror, and driving the controlling side with a current source, as shown in this project:https://hackaday.io/project/12763-vederpsu#menu-descriptionIs this the best way to go about controlling the current limit, and is the current mirror necessary? I can understand using it for some isolation to protect the opamp maybe, but that's its only purpose that comes to mind. Also, would adding any of this circuitry cause the regulator to oscillate, and potentially cause large problems?I know I could use a digital pot in order to program the thing easily, but I'd like a lot more resolution than what even the 1024 step ones can provide.Lastly, I've heard that the 3081's current set is heavily temperature dependent and somewhat useless. Would it be worth having the 3081 running as a voltage regulator only (using internal current limiting only) and use some kind of current source/limiter device connected to the output? I'd like to stick to using the 3081 for voltage regulation because it can go down to 0V, and can be easily paralleled for the final implementation.Thank you all for tolerating my long post, and for any advice you give!-Perpetually Debugging

author: David Hess
author_rank: Super Contributor
timestamp: March 31, 2017, 02:36:00 am
content: Quote from: Perpetually_Debugging on March 30, 2017, 05:54:17 pmThe output resistance of the operational amplifier when it is driving its feedback network is essentially zero and this is the resistance that the SET pin current sees so no offset voltage is generated.However in a better design, the output of the LT3081 drives the operational amplifier's feedback network and the output of the amplifier drives the SET pin so offset errors in the LT3081 are removed.QuoteThe current limit is obviously referenced to the output voltage but I could not find any internal details. It *has* to be this way because the output pin of the regulator is its common; all of the internal circuits operate at or above this point.As shown in the hackaday example, they set the output current limit to the minimum by using a low Ilim resistance and then add a current to Ilim to raise the output current.QuoteIt is not for isolation; the Ilim pin needs to be driven positive (above OUT) to increase the output current and doing so with a current allows it to follow the output voltage exactly.If the LT3081 is used inside of a feedback loop for greater accuracy, then frequency compensation will be needed to prevent oscillation and produce the best transient response.Driving Ilim with a current and shunt resistance and Iset with a voltage outside of feedback loops should be pretty safe but not nearly as accurate.QuoteThat is what the datasheet shows; it is not a precision current limit.I think if you want precision current limiting, then the best way is to use a separate precision current shunt and error amplifier to either override the voltage loop error amplifier or drive the Ilim pin with a current like shown in the hackaday example. An optocoupler might work as well as the PNP current mirrors in the hackaday example but PNP current mirrors are trivial and accuracy is not a problem.I think driving Ilim will produce a higher output resistance which is good for current limited operation but in most applications this will not matter.And on the subject of output impedance in constant current mode, take a look at the small value of the output capacitance. Check outNational Semiconductor linear brief 28for an example of a power supply design which uses even less output capacitance and an integrated power stage which is oddly similar to the LT3081. I wonder if Linear Technology got the idea for their single resistor programmable regulators from the National LM395.

author: prasimix
author_rank: Unknown
timestamp: March 31, 2017, 06:39:44 am
content: You have a LT3081 programmable power supply (EPSUX3V2) designed by Frex with both voltage and current programminghere. A complete history can be foundhere.

author: Kleinstein
author_rank: Super Contributor
timestamp: March 31, 2017, 07:37:15 am
content: Using a voltage regulator chip to build a lab power supply has it's limitations:The loop stability may not be that good, as the regulators are made for well behaved loads. A lab supply is supposed to work with essentially any load.As there are no separate feedback pins, all resistance outside the chip will add to the output. Lab supply circuits can use voltage sensing more or less directly at the output posts.The reference (here only for current limiting) is inside the chip and thus sees considerable temperature swing. So there will be quite some temperature drift from self heating.The power is limited - paralleling chips is problematic and expensive. So while possible in theory more than one chip is not really practical.Adding external current limiting (or more accurate voltage control) it calling for trouble with loop stability. It is possible, but usually not easier than building a proper lab supply from scratch with OPs for control and power transistors.

author: Perpetually_Debugging
author_rank: Contributor
timestamp: April 01, 2017, 02:14:59 am
content: Thank you for the quick and helpful replies!Quote from: David Hess on March 31, 2017, 02:36:00 amAha! Is that effect of an essentially zero output resistance caused by something similar to how a virtual ground occurs?Quote from: David Hess on March 31, 2017, 02:36:00 amI'm not quite sure what this would look like on a schematic, perhaps something similar to this?:Quote from: David Hess on March 31, 2017, 02:36:00 amIf I was to use a precision current shunt and error amplifier to drive the Ilim pin, would this induce any instability in the loop? I would think that it would introduce at least some small phase shift, as there is a non-zero delay in the amplifiers, but I could be wrong. I think such a circuit would look like this:I've got IC1 amplifying the voltage off of the shunt resistor, and IC2 controls the current mirror which drives the current limit of the device. IC3 is configured as a differential amplifier (I think) and will output a voltage proportional to the difference between the DAC's setting voltage and what the how much current is being drawn, as according to the precision shunt. This will drive IC2, making the current through ILIM follow the error between the DAC's voltage and the voltage off of the current shunt. I have no idea what the stability of this loop will look like.Hopefully some of that might work, let me know if I've made any mistakes or if there is a simpler/better way to do it.Also thank you for the links to Frex's supply, it looks oddly identical for the Vset and Iset sections from the hackaday link.Thank you all again!

author: David Hess
author_rank: Super Contributor
timestamp: April 01, 2017, 02:38:06 am
content: Quote from: prasimix on March 31, 2017, 06:39:44 amThat is the same design Perpetually_Debugging linked although looking at the alternative schematic, I found an error. The current mirrors which allow setting the output current and current sharing are configured wrong so there is considerable current sharing error. The amusing part is that they used matched transistor pairs for each current mirror but then defeated the matching by using two separate current mirrors in parallel.

author: Kleinstein
author_rank: Super Contributor
timestamp: April 01, 2017, 07:41:27 am
content: Adding an extra loop for more precise current limiting can be tricky and cause instability. One point in the circuits shown here is that the external loop will go into saturation when the current limit is not active. This will cause a significant delay before the current limit will start to work as intended.The circuit shown by Perpetually_Debugging has an additional problem with IC3G1, as this will be running at open loop gain (no working local feedback). But the whole circuit is not worth fixing it.Better build a lab supply from scratch.

author: David Hess
author_rank: Super Contributor
timestamp: April 01, 2017, 09:58:50 am
content: Quote from: Perpetually_Debugging on April 01, 2017, 02:14:59 amYes, the open loop resistance, including the feedback resistance in a virtual ground, is divided by the difference between the open and closed loop voltage gain. Since the open loop voltage gain is very high, the closed loop output resistance is very low.QuoteSort of but eliminate the link between R1 and R2. Actually, the frequency compensation network if needed goes where that link is.QuoteYou have identified the problem. If the phase shift reaches 180 degrees before the gain drops below unity, then that plus the 180 degrees from the negative feedback creates an oscillator.QuoteThe stability would be poor with three operational amplifier stages in series requiring good frequency compensation. With some cleverness, all of them can be combined into one integrator.Ground referred current sensing makes things easier if its limitations are acceptable. But take a look at the design of theTektronix PS501power supply to see an example where the current sensing is done on the output of the power stage with only one error amplifier inside the current control loop.QuoteThis kind of design is not trivial for a beginner but you can learn a lot getting it to work.QuoteThey are practically identical. They even have the same mistake in the current mirror.

author: David Hess
author_rank: Super Contributor
timestamp: April 01, 2017, 10:15:03 am
content: Quote from: Kleinstein on April 01, 2017, 07:41:27 amThe National Semiconductor example I linked clamps the error amplifier for the current control loop using the operational amplifier's external compensation pin.Most designs manage without clamping the error amplifiers but they also have more output capacitance which allows more time for recovery at the expense of lower AC output impedance which is good for voltage control but bad for current control.

author: Perpetually_Debugging
author_rank: Contributor
timestamp: April 03, 2017, 04:34:48 pm
content: Thank you David and Kleinstein, and I apologize for the delayed reply, this last weekend produced a rather large amount of homework.Quote from: Kleinstein on April 01, 2017, 07:41:27 amWhat would be some good resources to look at to design the thing? Most of the designs I've seen are quite different from each other, and it would take some time to figure out how each would work, and I'd like to make sure I'm learning from good designs. Also, would a 723 work, and do you think I could control it digitally, precisely, and easily (or at least more so than the 3081).I did some more thinking and I'm curious if this circuit would be any better:I think I've configured the opamp as a differential amplifier, and assuming I keep it in unity-gain, the voltage off the DAC will equal the voltage on the shunt. I've reduced it to a single opamp so I think the phase shift should be pretty low, and hence the loop would be stable. My only concern is that the low voltage produced by a shunt (100mV/A for a .1shunt) would have to amplified by an Opamp for it to be non-miniscule, increasing the phase shift. That or make the shunt 1so that I'd get 1V/1A, and then the voltage I'd have to set the DAC to wouldn't be in the mV range. This would have the effect of increasing the output impedance, but I think that (and correct me if I'm wrong) 1would still be okay.Quote from: David Hess on April 01, 2017, 09:58:50 amWhat are the limitations of ground referenced current sensing? Only thing I can think of is that the negative terminal of the supply wouldn't be at ground, but it will be pretty close to it.Quote from: David Hess on April 01, 2017, 10:15:03 amThis leads to a fairly stupid question: should I clamp the opamp, or somehow prevent it from going into saturation? How would I do so, just a diode on the output?Lastly, the accuracy of the set pin varies 15% in either direction over temperature. I don't believe I mentioned this before, but I intend to insert a tracking switching pre-regulator upstream of the 3081 just like in the hackaday/Frex link. The power dissipated by the LT3081 will be the 2V overhead mulitiplied by the output current, which is a maximum of 1.5A per regulator. I have some large copper heatsinks that I can use, and if each regulator is only going to be pulling 3W maximum, I think these heatsinks will be able to keep the regulator fairly cool. If I can keep the regulator within a narrow temperature band over all load currents by over-engineering the heatsink, then would it be possible to have a fairly precise current limit(±5%)?Thank you all again for your patience and insight!

author: Kleinstein
author_rank: Super Contributor
timestamp: April 03, 2017, 05:19:21 pm
content: The main limitation of adding an external shunt to the LT3081 circuit is that it could add to the output impedance. Also Stability of the extra loop is tricky, as there are no accurate data on how the set current input is behaving.Avoiding saturation of the external loop is rather tricky - a simple diode only avoids the OP itself to reach saturation, the compensation capacitor (still missing in the plans shown) would still charge up a lot.I know there are a lot of lab supply designs, good ones and also quite a lot of bad one on the web. There are mainly two classes of supplies:1) one with a low output impedance power stage (e.g. the TEK PS501 mentioned before and many 723 based designs). They typical have an Emitter follower for output and are often limited to something like 30 V maximum output as the controlling OP limits the voltage range. Voltage control is usually good, but current control can be problematic.2) Designs with a high impedance / current controlling ouput stage. These usually use a second supply (e.g. transformer) for the control circuitry. Most of the HP linear lab supplies use this system. The Advantage of this system is that it is very flexible with the voltage range: essentially the same control circuit type can be use for 3 V or 200 V (just change resistor values and power transistors). Here current control is usually better, but voltage control might be a little slower.Taking the schematics of a commercial available supply as the basis might be a good idea. The TEK PS501 seems to be relatively simple, though limited in voltage. For the second class, something many of the cheap chinese seem to use this type, e.g. the "Mastech" and others HY1803D (using BJTs). There is also a plan available for the GW Instek 3303S (using MOSFET, though it has a few minor issues, especially with channel 3/4).The LM723 has somewhat similar limitations to the LT3081: the original current control is poor (cold be even worse than the LT3081) and adding more precise current regulation is difficult, though easier than with the LT3081.For a start, I would avoid using a pre-regualtor: this adds quite some difficulties. It is only needed to get high power from the small LT3081.

author: David Hess
author_rank: Super Contributor
timestamp: April 06, 2017, 07:04:56 pm
content: Quote from: Perpetually_Debugging on April 03, 2017, 04:34:48 pmYou can learn a lot by studying fully documented designs like the Tektronix PS501 and PS503 and various older HP power supplies. The National Semiconductor application note that I linked for the LM395 has a lot to teach.A 723 integrates an error amplifier, reference, driver, and current limit protection into a single package. It could be used as part of a programmable power supply but I am not sure if it would have any advantage over separate functions. I might use one as a low cost alternative to the LM399 reference by configuring it to operate itself at a constant temperature using its output transistor as a heater.QuoteThe error amplifier needs high gain at low frequencies like an integrator so replace R5 with a capacitor; this location is the principle place where the frequency compensation is adjusted. Depending on the maximum level from the current shunt, divider R3/R4 is not needed.The low signal level has no effect on the operational amplifier's frequency response.QuoteIt moves ground away from common which is inconvenient in some designs like bipolar tracking and programmable regulators. In your example schematic, now the output voltage compared to common has an offset which depends on the current.QuoteSince the objective of clamping is to prevent windup of the error amplifier's integration term, what has to be done is a modification to the feedback loop so that once the amplifier's output is no longer controlling the regulator and would be operating open loop, instead it drives its inverting input. The integration term is provided by any external capacitance between the output and inverting input and by the frequency compensation capacitor inside the amplifier.In the example schematic I linked, one of the amplifiers supports external frequency compensation giving direct access to the internal node where the frequency compensation occurs but that is not strictly necessary to do this. The clamping can be done completely externally; this comes down to shorting the output to the inverting input when the amplifier is not controlling the output.Most power supplies simple ignore this (the Tektronix power supplies have no clamping) but it becomes more important if the output capacitance is low which is good for current limit performance.Quote5% might be possible under those conditions but most constant current outputs are much better than that. In practice 5% or even 10% would be good enough for most applications anyway.

author: Perpetually_Debugging
author_rank: Contributor
timestamp: April 07, 2017, 04:54:36 pm
content: I binge-watched most of Dave's series on the uSupply, and I believe that his architecture where he controls the current out of the regulator by a comparator-controlled transistor off Vset will perform quite well, from seeing his testing and as the ILIM behavior of the 3081 is unknown.I'll also take a look at some of the older HP power supplies later on, but I modified Dave's supply for the LT3081, and paralleled two of them for a 3A max output. I have about 80 IE0512S isolated DC-DC converters laying around, and I have one configured as a negative voltage supply from which a LT3092 current source is run off of, and that draws 10mA from the output of the 3081s so they can regulate down to zero. The schematic is attached.Note: the Opamps I have in there are LM358s, which aren't rail to rail, I would replace those with a rail to rail part in the actual device, just grabbed the first opamp in Eagle.I don't think Dave had any saturation problems (at least that he mentioned by part 4) and since I basically copied his I think I should be good. The internal current limit/thermal shutdown of the 3081 is still active. Would the output impedance of the supply include the shunt resistor, because it's on the input of the regulator? I don't think so because the transistor inside the 3081 is basically acting as a resistor too, and we're only concerned with the resistance on the emitter to ground. The 10mballast resistors will count for output impedance I think.Quote from: David Hess on April 06, 2017, 07:04:56 pmDave's (and mine too now I guess) supply gets around this by having a high-side current sense, and he's got a differential/instrumentation amplifier off of the shunt. Would there still need to be a frequency compensation capacitor, maybe in parallel with the gain resistor on the AD623?Quote from: Kleinstein on April 03, 2017, 05:19:21 pmUpon reconsideration, I think I will do just that. I'm not terribly concerned about efficiency and I already have the heatsinks, why buy more parts and physically isolate the RF from the rest of the board? Can't be bothered...If this design looks like it'll work, I'll get the thing soldered up and give 'er a go!Thanks again guys!

author: David Hess
author_rank: Super Contributor
timestamp: April 08, 2017, 09:38:36 pm
content: Quote from: Perpetually_Debugging on April 07, 2017, 04:54:36 pmI usually try to avoid rail-to-rail operational amplifiers because they cost more and usually compromise performance and in the case of a power supply where extra bias supplies are easy to include, they are not really needed.The one exception might be for high side applications where the common mode input range needs to go to the positive supply although this is usually where they have precision problems. (1) There are some non rail-to-rail input operational amplifiers which have a common mode range which extends to the positive supply like the ancient LM301A and various JFET amplifiers (TL051 series, LF351, LF355, LF356, LF357, LF441) so this can be avoided if necessary without a positive bias supply.High power current shunts tend to limit accuracy so this might not be such a large problem. 1mA out of 1A should be barely possible but beyond that requires heroic efforts. A temperature change of 20C with a 50ppm/C shunt is 1 part in 1000.QuoteNo matter where the current shunt resistor is, the difference between the error amplifier's open and closed loop gain divides it (I'm simplifying) and at high frequencies, the output impedance is determined by the output shunt capacitor. For high accuracy, the current shunt needs to be on the output (2) and if the output is an emitter follower, then the increase in impedance can actually be an advantage for stability.QuoteAdding a separate difference/instrumentation amplifier (3) will make compensation more difficult as I learned with my first lab power supply. I ended up needing so much compensation that the current limit performed poorly as far as speed.I think the best overall configuration is how Tektronix did it with the PS501/PS503. Use high side current sensing on the output but instead of using a difference/instrumentation amplifier to create a ground referenced high speed current signal, do the opposite and reference the slow current control level to the high side and float the current error amplifier to follow the output.Now the problem becomes how to do a precision level shift of a slow signal to the high side instead of a fast signal to the slow side.If elevating the negative output from common is not a problem, then just sense the current on the low side.QuoteIf the heat is not a problem, then a power transistor cascode could be added to the input of the regulator or a transistor current amplifier could be added to the regulator to bypass some of the current. But this calls into question whether an integrated regulator should be used at all.(1) I think TI has some rail-to-rail input amplifiers where you can move the input threshold to solve this.(2) I think some of the HP power supplies placed the current shunt on the input side of the pass transistor and then compensated for the base current error. Today a FET could be used to reduce the error.(3) Differential amplifiers are a difference beast. I know differential, difference, and instrumentation amplifier are often used for the same thing but differential is really confusing because there are real differential amplifiers which have nothing to do with difference and instrumentation amplifiers. In the past, differential amplifiers were sometimes confusingly refereed to as push-pull amplifiers and push-pull has a completely different meaning now.

author: Kleinstein
author_rank: Super Contributor
timestamp: April 09, 2017, 09:04:12 am
content: In the LT3081 circuit, any shunt / current sharing resistor behind the output will usually show up in the output impedance. So using 2 of the LT3081 is not such a good idea. In an conventional supply the drop at the shunt is compensated by the regulation loop.The modified LT3081 based circuits has some problems: the lt3081 might not like the shunt on its supply side, stability can suffer from this. Also the current measured at the input side may not be exactly the same as on the output side.In a power supply there usually is no need for rail to rail OPs. Some circuits might want a single supply OP like the LM358, though the LM358 can be tricky sometimes.The difference in having the shunt at the high or low side is not that large. In a conventional supply with emitter-follower type output stage the shunt at the low side makes current regulation easier and voltage regulation a little more difficult. The Tektronix PS501/PS503 looks simple, but relies on the common mode rejection of the OP used for current control - so it needs care on what OP to use there. It is elegant in a way making the constant current response relatively fast, despite of using the emittter-follower structure.

author: Perpetually_Debugging
author_rank: Contributor
timestamp: April 11, 2017, 03:49:31 pm
content: Quote from: David Hess on April 08, 2017, 09:38:36 pmA normal opamp it is then.Quote from: David Hess on April 08, 2017, 09:38:36 pmIf the amount of frequency compensation on that instrumentation/difference/differential amp would be problematic and it would be better to reference it to the high side, would it be possible to accomplish that precision level shift by using a differential amplifier to "subtract" the current setting voltage from the high side? If that works, then it would be possible to omit any frequency compensation on the "subtracting" amplifier as the signal (from DAC or a pot) is slow?After studying the schematic for the PS501, I'm wondering if there is any advantage to using a diode OR gate instead of the transistor/resistor configuration that Dave's got in the uSupply? Less noise, perhaps?Quote from: David Hess on April 08, 2017, 09:38:36 pmFeel free to correct me if I reference the wrong kind of amp, and you're right, it is rather confusingQuote from: Kleinstein on April 09, 2017, 09:04:12 amIf I parallel two 3081s with a shut at the high side of the output, do you think they would have any problems? I believe they would have some voltage error due to the drop across the shunt resistor. Another reason to build it out of discreets I guess, can just sense the output voltage past the shunt and then the compensation is done inside the feedback loop of the voltage regulating opamp.Thanks again everybody!

author: Kleinstein
author_rank: Super Contributor
timestamp: April 11, 2017, 04:44:36 pm
content: There is no big difference in combining CC and CV control through 2 diodes or a resistor and transistor. With the transistor one can be limited by the base-emitter voltage in reverse. Dave's circuit has the difficulty that the transistor adds gain to the current loop. This can make compensation difficult.It is possible and sometimes an advantage to transfer the reference / set signal to the high side in stead of the measured current signal. The Tek. PS501 kind of does this by using a current source to set the current limit.Having a kind of slow amplifier is also a kind of compensation. The usual way frequency compensation is done to make the slowest amplifier stage in the loop even slower. With modern OP without provisions for external compensation, this is usually be adding a capacitor in feedback, making the OP a kind of integrator or PI (sometimes neglecting the P part, which may not be good) controller. With old OPs like the LM301 that use external compensation, one could also add the compensation at the corresponding pins of the OP and thus make the OP itself slow.

author: David Hess
author_rank: Super Contributor
timestamp: April 12, 2017, 12:12:35 am
content: Quote from: Perpetually_Debugging on April 11, 2017, 03:49:31 pmIt is an instrumentation/difference amplifier and not a differential amplifier. Differential amplifiers have two inputs and two outputs.Using an instrumentation/difference amplifier will work but there is an easier way. Convert the current control signal to a current and pull that current from a resistor connected to the positive supply to create a voltage referenced to the positive supply. This avoids the resistor matching requirements to produce high CMRR in an instrumentation amplifier and is less expensive.The PS501/PS503 sort of work this way but they use a constant current to create a high side voltage reference for the current control operational amplifier.QuoteKleinstein identifies the problem with the way Dave did it; common emitter connected Q2 adds voltage gain which would normally make the current loop unstable. The only reason it works is that R12/C2 operate as a low pass filter producing dominant pole compensation but this also makes the current control loop slow.A pair of diodes like the PS501/PS503 use is the simplest way. I like using emitter followers to buffer the amplifier outputs and diodes to protect against base-emitter breakdown if necessary. The collectors of the transistors can drive LEDs or a logic circuit to display the operating mode in real time. The next step up from that is to include clamps around the amplifiers to make the switching between voltage and current control modes as fast as possible.QuoteI am a little fuzzy on exactly how the LT3081 current sharing as shown in the Linear Technology application note works but I do not think there will be any problems using an external current shunt.The voltage feedback loop compensates or can compensate for the voltage drop across the current shunt on the output.

author: Perpetually_Debugging
author_rank: Contributor
timestamp: April 12, 2017, 04:22:35 am
content: Quote from: David Hess on April 12, 2017, 12:12:35 amI'm having a hard time visualizing what you're describing, perhaps something like this?And then once installed in the system it would look like this:Not sure if that's what you had in mind, please correct me if it's not.Quote from: David Hess on April 12, 2017, 12:12:35 amAside from buffering the output and allowing for status LEDs/logic, is there any other benefit to adding emitter followers? And what would that clamping look like? Perhaps putting a diode with a lower forward voltage (schottky) inside the feedback loop, or maybe just using schottkys for the OR gate?Quote from: Kleinstein on April 11, 2017, 04:44:36 pmWould this circuit need any frequency compensation? I think it still would, and if that takes the form of a cap on the inverting input (inside the feedback loop) then that would be really easy to test and adjust.Also I'm thinking of using essentially that same circuit in the final supply (plus DACs and ADCs of course) and if there's anything else wrong with it please let me know.Thanks again everybody!

author: David Hess
author_rank: Super Contributor
timestamp: April 12, 2017, 09:44:09 am
content: Quote from: Perpetually_Debugging on April 12, 2017, 04:22:35 amThe MOSFET and operational amplifier make a current sink going to ground or the negative supply so operation down to ground is possible. The drain of the MOSFET connects to a resistor which itself connects to the upper side of the current shunt. So now the error amplifier has a reference voltage which follows the output voltage.So there are two precision resistors, one in series with the source and the other in series with the drain, and their tolerance affects the gain and not the common mode rejection ratio. The operational amplifier and MOSFET make a voltage to current converter and then the high side resistor converts the current back into a voltage for use by the current loop error amplifier.I might put a capacitor across the top resistor for lower noise and to prevent some odd things from happening when the output voltage shifts rapidly. This would limit the speed at which the current limit could be changed but would have no effect on the speed of the current error amplifierQuoteThe emitter followers allow the set pin current to be high and independent of what the operational amplifiers by themselves can drive. Schottky diodes would only have the advantage of increasing the compliance a little bit with their lower forward voltage drop; that might be necessary if a negative bias supply is not available for the operational amplifiers.There are too many ways to do the clamping. Basically they come down adding another feedback path between the output and inverting input of the amplifier forcing it to unity gain when in this case the output rises above the output of the other amplifier. This prevents the output from rising and charging the feedback capacitor and internal compensation capacitor up which is refereed to as "wind up".These are referred to as "anti wind up" circuits. I looked online and did not find any examples for a power supply (except for the National Semiconductor example which is high performance) but this just reflects how unimportant it is in most applications. They are only needed if the original design was poor or if the highest performance is required.The National Semiconductor application note that I linked shows another way to clamp the amplifier by driving the compensation pin but it is not easy to understand and requires an operational amplifier which supports external compensation which is rare these days. Some very specialized operational amplifiers have external clamp pins to implement this function.QuoteWith slow amplifiers like the 324/358, 741, and OP-07, compensation will probably not be needed. Faster operational amplifier like the LT1007/OP-27 and most JFET input amplifiers will require frequency compensation.Even if frequency compensation is not absolutely required, adding it will improve performance. Testing can be done with a function or pulse generator and oscilloscope so it is easy enough to do.

author: Perpetually_Debugging
author_rank: Contributor
timestamp: April 15, 2017, 05:40:32 am
content: Quote from: David Hess on April 12, 2017, 09:44:09 amI think I've got it now, would it look like this?:R3 and R4 are the precision resistors of which you speak. I also added the emitter followers on the error amplifiers' outputs, as well as some LEDs to indicate CV/CC modes. Let me know if I misconfigured anything.Quote from: David Hess on April 12, 2017, 09:44:09 amIf there's that much trouble around clamping and the benefit is marginal, then I won't worry about it.Quote from: David Hess on April 12, 2017, 09:44:09 amIf I were to include frequency compensation (in the form of a capacitor on the input) would it better to use a slower or faster opamp to begin with? I'm thinking a OP-07 to start, and then add capacitance as needed.Quote from: David Hess on April 12, 2017, 09:44:09 amWhat would that look like? Driving the base of a power BJT or MOSFET and using that as a dummy load? Basically just the emitter follower voltage regulator, but the non-inverting input of the opamp is driven with a pulse or some other waveform?Thanks again guys!

author: David Hess
author_rank: Super Contributor
timestamp: April 15, 2017, 09:43:51 am
content: Quote from: Perpetually_Debugging on April 15, 2017, 05:40:32 amExactly like that.In the past T4 would be a JFET driving a bipolar transistor but now we have MOSFETs.QuoteD1 and D2 are backwards. I do not think R2 does anything useful.Depending on the details, the fault current through the LEDs might be excessive. On the PS501/PS503, the drive from the error amplifiers is reversed so PNP transistors would be used and there is a current source between the collector and base of the output transistor making it "normally on". So the error amplifiers pull the output down instead of pushing it up. This sets the maximum current the PNP transistors and LEDs can see under all conditions.As you design is implemented however, it will certainly work and it has the advantage of not requiring a negative bias supply to get down to zero volts output. R7 and R8 could be combined and then even better, replaced with a constant current source protecting the LEDs. Under normal operations, the current source would be saturated; this might be a good place for a JFET current source or constant current diode.QuoteThat is a good way to start.One thing to beware of is that precision amplifiers like the OP-07 and OP-27 have back to back protection diodes across their inputs. On your schematic this means adding a resistor in series with the inverting inputs which is needed anyway as part of any external frequency compensation.358, 741, and JFET operational amplifiers have no such requirement but still need the resistor in series with the inverting input to implement external frequency compensation.QuoteEither way works. Just weakly coupling the output of a square wave into the non-inverting input of the voltage and then current control amplifiers to shift the output voltage or current by a small amount is sufficient. Then the output load can be varied to test stability with different loads.Or since your design is programmable, have the processor adjust the voltage DAC and current DAC to do the same thing if they are fast enough which isn't the case for your current control loop with C1 in place.

author: Kleinstein
author_rank: Super Contributor
timestamp: April 15, 2017, 09:58:46 am
content: Combining the signals does not work this way: The diodes are the right direction to get an output that corresponds to the minimum of the two possible control loops. So the transistors need to be changed to PNPs (or left out) and it needs a current source or resistor to provide some base current to the output transistor.The current source for setting the current limit still needs a negative supply, though just a little can be enough.With slow OPs, there is chance it might work without extra compensation. However this would also make the CC mode rather slow.

author: David Hess
author_rank: Super Contributor
timestamp: April 15, 2017, 10:29:01 am
content: Quote from: Kleinstein on April 15, 2017, 09:58:46 amWhoops, you are right. Many eyes make for fewer mistakes.With the NPN transistors and diodes as shown, the output becomes the higher of the voltage and current limits.

author: Kleinstein
author_rank: Super Contributor
timestamp: April 15, 2017, 11:31:41 am
content: The external frequency compensation for the CC mode in the Tek circuit has a somewhat hidden advantage:The compensation only slows down the change in current, the OP can react much faster (with the speed of the OP) to a change in voltage. This helps to speed up the response to something like a sudden short, where the output voltage is dropping fast. So using a slow OP instead of compensation for the current control gives away this advantage.With this type of circuit (emitter follower and diodes to get the minimum voltage from both controls), the short circuit case is somewhat critical and needs a fast response of the control part (or a secondary current limit). Otherwise the base voltage will not drop fast enough in case of a short and would alow a high current spike, up to the point of destruction. A limited strength of the current source to provide the base current could be used as a backup current limit.It is also much easier to adjust compensation by changing a capacitor or resistor than changing the OP type. So using a slow OP instead of extra R,C for compensation is not such a good idea. It may later still happen that the capacitance for compensation can be reduced all the way to zero. But it is a good idea to have the option to add compensation.Adjusting the compensation is usually done with an external switched load or signal coupled into the feedback path. Switching of the set point (e.g. using the DAC for control) is somewhat different, and a fast response is not the same as a good loop response. The step test is better than nothing, but in principle the step response of the loop and set-point steps are different things. For this simple circuit there is even the option to do it old style: Reduce the compensating capacitor until the circuit just starts oscillating. Form that point increase the capacitance by a factor of 2 to 3. To day there is also the option of doing a simulation up front - this at least gives a good starting point.

author: Perpetually_Debugging
author_rank: Contributor
timestamp: April 17, 2017, 04:26:53 am
content: Quote from: David Hess on April 15, 2017, 10:29:01 amThat's what I get for doing this stuff at midnight!I've changed the NPNs into PNPs, and I put the LEDs on the collectors (which now to go to ground). The LEDs are being biased by a JFET current source, as is the series pass transistor (not sure I configured it right with the P channel JEFT). The value of R7 determines the maximum base current of the series pass transistor, and serves as a backup current limit to protect the supply. I've also moved the MOSFET high side referencing circuitry over to the other side of the schematic to make it a little easier to read.Let's talk frequency compensation for a second. Just to clarify, compensation is needed on both the voltage and current error amplifiers, and will look like this on the voltage error amplifier:Where the RC constant set by R1 and C1 set the dominant pole. I'll use a fast opamp in the circuit, and then add compensation as necessary.For testing, I've got a function generator whose output I'll couple into the non-inverting input of an opamp configured as a current sink, and use that to test different scenarios and I'll try the supply out on some reactive loads as well.Thanks again guys, ya'll are helping a measly high school student out quite a bit

author: Kleinstein
author_rank: Super Contributor
timestamp: April 17, 2017, 08:22:12 am
content: The principle with PNP transistors is much better and could kind of work in a limited range. The easy to fix part is that there would be no need for the extra current limit for the LED at the GND side - one could leave this out. The more difficult part is that the drop at the LEDs would prevent the output to go close to GND, or at least the LEDs won't lit any more. There might be still enough current base to emitter.So the CC/CV indication is not really practical this way without a negative supply. The more common way to implement the indication is to use a comparator to compare the two OPs ouputs. Than one can also leave out the PNPs all together - especially if you don't have a negative supply. With the transistors and diodes, even without the LEDs on the GND side, there is essentially no spare voltage to go all the ways to zero - so Schottky diodes would be a must to have a chance at least.A constant current limit does not need one of the rare P channel JFETs. It works with n-channel as well. One can also use a BJT based version, that might later also be used for an output enable function or to enable only if the raw voltage is high enough.The capacitor for frequency compensation is usually from the OPs output to the inverting input, thus making an integrator like circuit. There can be an alternative version taking the capacitor from behind the diodes that combine the two loops. For a more accurate loop tuning one might consider a resistor in series with the compensation capacitor. This is kind of going from an I-Regulator to an PI type.The capacitor between the OPs inputs is more like a way to make the OP oscillate and usually not a good way for loop compensation.

author: Perpetually_Debugging
author_rank: Contributor
timestamp: April 17, 2017, 10:54:29 pm
content: Quote from: Kleinstein on April 17, 2017, 08:22:12 amThe way I'm hearing it, it sounds like I would need a negative supply if I wanted to use the PNP buffers, but if I'm not using them then I can operate from a single supply, correct? If that's the case I'll remove the buffers, as their main advantage of driving the LEDs seems to have disappeared.I added an opamp running in open loop as a comparator, removed the constant current source on the LEDs, and changed the P Channel JFET into a N channel.Quote from: Kleinstein on April 17, 2017, 08:22:12 amLike this?:Thanks again!

author: David Hess
author_rank: Super Contributor
timestamp: April 18, 2017, 01:35:28 am
content: Quote from: Perpetually_Debugging on April 17, 2017, 10:54:29 pmThat will usually be the case but to me the main advantage is unloading the output of the operational amplifiers and making it easier to drive the LEDs. Solutions include:1. Just using the diodes; this is what Tektronix did even though they had a negative bias supply which allowed them to use a standard operational amplifier and then they stuck the LED in series anyway.2. Replacing the diodes and transistors with high Vbe PNP transistors if you can find them.3. Use a negative bias supply; the additional cost is minor except in the simplest designs.QuoteYour current control loop is all screwed up now.

author: Kleinstein
author_rank: Super Contributor
timestamp: April 18, 2017, 06:58:41 am
content: Using only the diode is just enough that is can work without a negative supply.However for the current source that set the current limit, the circuit will need a negative supply anyway.The maximum output voltage is limited by the OPs supply. So you may not want a very large negative supply - just a little, like -0.5 V or -1 V could be enough, a little more if you use non single supply OPs instead of the LM358. The negative supply is also helping when it comes to a minimum load.The comparator should compare corresponding points - so either directly at the OPs or behind the PNPs, but mixing is not that ideal. It still kind of works most of the time.The circuit shown at the end for compensation is wrong. It is missing the resistor for the DC feedback, and the capacitor for compensation should go directly to the OPs output.The current control part is really screwed up. The current source for the set point was wrong before, not just in the last post. It also needs to take into account the negative supply, so it is not the simple current sink circuit, but can be similar.

author: Perpetually_Debugging
author_rank: Contributor
timestamp: April 19, 2017, 08:54:01 pm
content: I've decided to run the circuit off of a mains isolated 20V preregulated supply (laptop power supply) instead of a transformer because I don't want to mess around with mains wiring and I already have a power brick, but I don't have a transformer. Because the voltage is constant, I should be able to get away with a simple resistor instead of a current source for the main series pass transistor. I'm going to throw a -1.5V negative bias supply in there too, and that's going to be another isolated wall power supply with the positive tied to the other's negative. Both supplies will be well decoupled with multiple values of output capacitors in parallel.The diode OR gate now uses schottky diodes.Also the output of the comparator (IC2B) drives a single LED now, this will drive a MCU input through an optoisolator and two LEDs aren't necessary. The optoisolater LED is D3.I'm heavily eyeballing using OP275s for the circuit, and those'll have a negative supply.I've fixed the opamp comparator's inputs. I could do this without an opamp, but there's a spare one on one of the OP275s, might as well use that. These changes are reflected in this updated schematic:Quote from: Kleinstein on April 18, 2017, 06:58:41 amI think I've got it right now, and I'm not sure what you mean by taking into account the negative supply. Could you elaborate a little?Thanks again everybody!

author: David Hess
author_rank: Super Contributor
timestamp: April 20, 2017, 02:44:25 pm
content: The current control loop amplifier is still wired wrong.R4 is wired correctly but the inputs to IC1B need to come off of the output ends of the two resistors. Move the inverting input to the other side of R3.

author: Kleinstein
author_rank: Super Contributor
timestamp: April 20, 2017, 03:55:48 pm
content: The current sink to produce the current proportional to the set current is also wrong: The normal current sink has the inverting input of the OP from the source side and the controlling voltage to the non inverting input.With the current sink starting on the negative supply (to be able to work to slightly below GND on the drain side) however one would need an input voltage relative to the negative supply. A DAC for the set point will likely give a voltage relative to GND. One can get around that problem by adding 2 resistive dividers, e.g. with 4 equal resistors:The noninverting input get the voltage between the DAC output and the negative supply and the inverting input get the voltage between GND and the current sensing resistor.Using an OP275 is a slightly unusual choice, it is rather fast and high in supply current: the more obvious choice would be a TL072 or similar. However the dual OPs have essentially all the same pin-out.For the negative supply one could likely build a small switched mode converter of some kind to make something like a -2 V (depending on the OP). With special wound small ferrite transformer its not hard to get few more voltages as well (e.g. 24 V for the OPs to get a higher output, 5 V for an µC). This will be low power and thus not really large. The laptop supply will not be super low noise anyway. So no real need for a second plug.It still makes sense to have a current source instead of R8. I would prefer a version with 2 PNP's, in a way that it gets enabled only if the supply voltage is reasonable high. One could also implement an output disable function this way.Usually one could save the 2 PNPs at the OPs output - With a typical darlington at the output, with a gain of 1000 or more, It only needs about 2-5 mA. That is not a problem for most OPs. Not have the transistors also makes is possible to use a simple diode as a simple kind of down programmer, current limited by the OPs.

author: Perpetually_Debugging
author_rank: Contributor
timestamp: April 21, 2017, 07:34:08 pm
content: Quote from: Kleinstein on April 20, 2017, 03:55:48 pmI'm struggling to understand what you mean here. Would the resistor dividers be outside the feedback network of the opamp? It sounds like they wouldn't be, and R4 and R5 would get another resistor each and form a divider? Or would there be two dividers apart from R4 and R5?Thanks for the tip about the TL072. I'm wondering if it would be possible to power it separately from the main bypass transistor Q3. Say I had a separate 15V output powering the TL072, could I take the collector voltage significantly higher than that, say to ~40V? I just don't want my output voltage range to be limited by the maximum supply voltage of the opamp. I think that the maximum voltage output would be limited by the maximum input voltage to the opamp, and if so, I'll do some more looking for JFET input high-ish voltage opamps.Quote from: David Hess on April 20, 2017, 02:44:25 pmQuote from: Kleinstein on April 20, 2017, 03:55:48 pmQuote from: Kleinstein on April 20, 2017, 03:55:48 pmAll of these changes have been implemented below, hopefully somewhat correctlyLet me know if I misconfigured anything else.Sidenote: I tried to link the schematic in the post like I've been doing, but it doesn't seem to be working this time. I've attached it just in case.

author: Kleinstein
author_rank: Super Contributor
timestamp: April 23, 2017, 09:04:08 am
content: The current source for the current limit now looks good, but still needs a set input relative to V-, not GND. This is a minor point that can be fixed later.The OP inputs for the current control are the wrong way around - so wrong polarity.Both control loops still miss compensation - it likely won't work without.The voltage control loop usually also uses a divider so the set voltage is in a more manageable 0.5 V range or similar.The PNP based current source on the positive side should work, though with discrete transistors it might won't emitter resistors to get less temperature sensitive and more accurate.One can power the OP and the current source from a higher auxiliary supply, like an extra 2-5 V. However there still is a limit to the OPs supply. So the choice of OPs gets difficult with more than about 25-30 V output voltage. When starting from an around 20 V laptop supply it might worth getting a few more volts on top - still not a problem for the OP.

author: Perpetually_Debugging
author_rank: Contributor
timestamp: April 24, 2017, 07:45:56 pm
content: Quote from: Kleinstein on April 23, 2017, 09:04:08 amI fixed the current error amp inputs, and I also added frequency compensation (I think). I might need a resistor in parallel with the capacitors, let me know if I do.Quote from: Kleinstein on April 23, 2017, 09:04:08 amI think I may have mis-phrased my question in the previous post. I'm wondering if I can power the opamp with alowersupply than the main series pass darlington transistor. If I used a voltage divider on the inputs then the maximum input voltage of the opamp wouldn't be exceeded, and it would still be able to regulate.Quote from: Kleinstein on April 23, 2017, 09:04:08 amI'm going to use an integrated dual-PNP transistor so that the temperature difference between the two is small. Are there any precautions that I should take to avoid thermal runaway?Thank you again everybody!

author: Kleinstein
author_rank: Super Contributor
timestamp: April 25, 2017, 12:52:12 pm
content: The OP still needs the high voltage at the output. In the current circuit the output is at something like 0.7 V lower than the OPs output. So reducing the OPs supply is usually not a good idea. This somewhat limits this type of circuit to voltages up to about 30-35 V.Near that limit, one might limit the supply for the OP, so it would not exceed the ratings on the peaks of the raw voltage.The inputs of IC1B are still mixed up, just like the circuit before.The frequency compensation might need an additional resistor in series to C2.To protect the output transistor from to negative a base to emitter voltage, it would be a good Idea to have a diode in parallel here.Thermal runaway should not be a problem with a dual transistor in the current mirror, unless the power level is really high. So 2 mA at 20 V should be OK with a sot23 size. Emitter resistors, even if small (e.g. 50 Ohms) can help with stability / accuracy.

author: Perpetually_Debugging
author_rank: Contributor
timestamp: April 28, 2017, 03:44:07 am
content: Quote from: Kleinstein on April 25, 2017, 12:52:12 pmDarn it!Quote from: Kleinstein on April 25, 2017, 12:52:12 pmI'm curious how selecting values for resistors and capacitors would go. It was mentioned in a previous post to fix the resistance and adjust the capacitance to the point where it stops oscillating, and then double or triple that value. Is there a set of equations that I could look at perhaps?I'll fix the amplifier's inputs and include a diode in parallel with the darlington.Thank you again!

author: Kleinstein
author_rank: Super Contributor
timestamp: April 28, 2017, 07:40:31 am
content: The method with adjusting the capacitor to oscillation and than double/triple the value is kind of using the Ziegler–Nichols method from conventional PI control. There might/should be a similar rule on how to adjust the resistor, but I don't know the suitable formula. Just form looking at the Ziegler–Nichols method, this should be something like R = const * f * C ; with f the frequency of oscillation, C the capacitor for compensation and a constant factor on the order of 1. It likely would need a few tries to get a good transient response.The alternative method today would be to use a simulation (e.g. LTspice) and this way find suitable capacitor and resistor values. This could also help to find a suitable capacitor for the output. The simulation is usually faster than a real life measurement and one has essentially unlimited measurement capability - e.g. on can do an frequency scan from mHz to 100 GHz in a second and down to -150 dB.

author: Perpetually_Debugging
author_rank: Contributor
timestamp: April 28, 2017, 06:46:01 pm
content: Sweet, I'll go ahead and buy parts and then work on the simulation while I wait for them to get here. I haven't used LTSpice before so that'll be interesting.If I switch the inputs, add a resistor in series with C2 and C3, and then add a diode to protect the darlington, the schematic comes to this:Two questions:1. Does this look good? I don't think there's anything blatantly obvious, except maybe output capacitance. I'm under the general impression that it should be a balance between high and low so as to keep the CV mode stable and the CC mode quick. Would 10uF be okay, or is this a value that I will determine through experimentation after the rest of the circuit is built?2. What is the purpose of a resistor across C2? I would think that it's for discharging the capacitor, or allowing some DC through. Its value is probably going to have to be tweaked too, and would it be wise to select values to avoid throwing the RC circuit into resonance? Only C2 was mentioned for another resistor, would C3 need one too?Thanks again guys, I really appreciate it!

author: Kleinstein
author_rank: Super Contributor
timestamp: April 29, 2017, 09:06:28 am
content: The resistors shown at C2/C3 are in parallel, not in series. I don't think one will need parallel resistors. The series resistors offer an additional degree of freedom in frequency compensation and thus could allow a faster response or better stability with difficult load. But of cause they also need to be adjusted. For the current loop, I am not so sure of an additional series resistor to C3 is really needed. Simulation would have to show. One should at least keep that option in mind, in case adjustment of the loop gets difficult. Often the current loop is not that difficult to get stable (as the output capacitor is relatively large anyway to get sufficient transient response of the CV loop). The problem with the CC loop is more the recovery from saturation. So limits to windup might be a good idea.The output capacitance is needed for handling fast transients, the part before the regulator reacts. So the faster the regulator the less capacitance is needed, but a fast adjustment is also more tricky as parasitic effects like wire and resistor inductance (especially in the low impedance area) become noticeable. So a 10 µF output capacitance already needs some care. Usually it is also not just one capacitor, but more like 2 caps: one with low ESR and one with a noticeable series resistance/damping. So more like 100nF-1 µF film type or ceramics and maybe 10 -100 µF of electrolytic type with some ESR (e.g. Ohms range).There is another thing to test in a simulation: in some cases, the circuit can be prone to a kind of large signal oscillation: after a large current step (especially with a significant capacitive load and thus less margin of stability) the output stage might oscillate between fully of and high current. This part is a little hard to look at by hand as it includes nonlinear effects (eg. saturation, windup), but simulation will show rather straight forward.Depending on the required speed, the circuit might want a kind of minimum load, e.g. a crude constant current sink towards V-.The circuit is still missing the divider in Feedback (a DAC for the set voltage will likely only give a 0..5 V range or similar). The divider can also influence compensation - so it should be included from the beginning. Also the current setting needs to take into account the negative ref. point. Also the source for V- is still open. There are a lot of options - but still have to decide. Finally provisions for a clean start (no overshoot) might be needed. With digital control one often also has digital display of measured voltage and current. The current measurement is not that simple in this circuit. So it still needs a few more parts before getting everything together.The TIP122 is also rather small - good for maybe 40 W or 2 A from a 20 V raw supply. If in doubt I would prefer the larger TIP142.

author: Perpetually_Debugging
author_rank: Contributor
timestamp: April 30, 2017, 01:39:10 am
content: Quote from: Kleinstein on April 29, 2017, 09:06:28 am*facepalm*Quote from: Kleinstein on April 29, 2017, 09:06:28 amThat makes sense. My concern is that I may put too much output capacitance in the circuit, and that would compromise the CC loop's performance. I'll start out with a 100nF ceramic in parallel with a 10uF electrolytic, and adjust it once it's built up.Quote from: Kleinstein on April 29, 2017, 09:06:28 amI'll include the divider in the voltage error amp's feedback loop, and use the TIP142. For V- I think I'll use an isolated wall-wart for the time being, although in the final I'll probably use a transformer. What would the clean start look like? A RC circuit across the base of the current source for the darlington? Would a high-side current sensing IC feeding an ADC work for monitoring current digitally, as that'll be referenced to ground?Also there needs to be some circuitry in between a DAC and the input to the current control current source, would an opamp do the trick? I remember some reference being made to a set of voltage dividers to reference the voltage to V-, but I'm still not sure what that would look like.Thank you again!