Author Topic: Programmable Power Supply Digital Interface  (Read 15529 times)

0 Members and 1 Guest are viewing this topic.

Offline Perpetually_DebuggingTopic starter

  • Contributor
  • Posts: 16
  • Country: us
Re: Programmable Power Supply Digital Interface
« Reply #25 on: April 17, 2017, 04:26:53 am »
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.

Whoops, 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.


That's what I get for doing this stuff at midnight! :-DD

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  ;D
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14196
  • Country: de
Re: Programmable Power Supply Digital Interface
« Reply #26 on: April 17, 2017, 08:22:12 am »
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.
 

Offline Perpetually_DebuggingTopic starter

  • Contributor
  • Posts: 16
  • Country: us
Re: Programmable Power Supply Digital Interface
« Reply #27 on: April 17, 2017, 10:54:29 pm »
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.

The 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.

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.

Like this?:


Thanks again!
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16615
  • Country: us
  • DavidH
Re: Programmable Power Supply Digital Interface
« Reply #28 on: April 18, 2017, 01:35:28 am »
The 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.

That 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.

Quote
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.

Your current control loop is all screwed up now.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14196
  • Country: de
Re: Programmable Power Supply Digital Interface
« Reply #29 on: April 18, 2017, 06:58:41 am »
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.
 

Offline Perpetually_DebuggingTopic starter

  • Contributor
  • Posts: 16
  • Country: us
Re: Programmable Power Supply Digital Interface
« Reply #30 on: April 19, 2017, 08:54:01 pm »
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:

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.

I 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!
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16615
  • Country: us
  • DavidH
Re: Programmable Power Supply Digital Interface
« Reply #31 on: April 20, 2017, 02:44:25 pm »
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.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14196
  • Country: de
Re: Programmable Power Supply Digital Interface
« Reply #32 on: April 20, 2017, 03:55:48 pm »
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.
 

Offline Perpetually_DebuggingTopic starter

  • Contributor
  • Posts: 16
  • Country: us
Re: Programmable Power Supply Digital Interface
« Reply #33 on: April 21, 2017, 07:34:08 pm »
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.

I'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.
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.
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.
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.



All of these changes have been implemented below, hopefully somewhat correctly :) Let 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.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14196
  • Country: de
Re: Programmable Power Supply Digital Interface
« Reply #34 on: April 23, 2017, 09:04:08 am »
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. 
 

Offline Perpetually_DebuggingTopic starter

  • Contributor
  • Posts: 16
  • Country: us
Re: Programmable Power Supply Digital Interface
« Reply #35 on: April 24, 2017, 07:45:56 pm »
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.



I 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.
The voltage control loop usually also uses a divider so the set voltage is in a more manageable 0.5 V range or similar.

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. 

I think I may have mis-phrased my question in the previous post. I'm wondering if I can power the opamp with a lower supply 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.
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.

I'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!
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14196
  • Country: de
Re: Programmable Power Supply Digital Interface
« Reply #36 on: April 25, 2017, 12:52:12 pm »
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.
 

Offline Perpetually_DebuggingTopic starter

  • Contributor
  • Posts: 16
  • Country: us
Re: Programmable Power Supply Digital Interface
« Reply #37 on: April 28, 2017, 03:44:07 am »
The inputs of IC1B are still mixed up, just like the circuit before.

Darn it!
The frequency compensation might need an additional resistor in series to C2.

I'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!
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14196
  • Country: de
Re: Programmable Power Supply Digital Interface
« Reply #38 on: April 28, 2017, 07:40:31 am »
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.
 

Offline Perpetually_DebuggingTopic starter

  • Contributor
  • Posts: 16
  • Country: us
Re: Programmable Power Supply Digital Interface
« Reply #39 on: April 28, 2017, 06:46:01 pm »
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!
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14196
  • Country: de
Re: Programmable Power Supply Digital Interface
« Reply #40 on: April 29, 2017, 09:06:28 am »
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.
 

Offline Perpetually_DebuggingTopic starter

  • Contributor
  • Posts: 16
  • Country: us
Re: Programmable Power Supply Digital Interface
« Reply #41 on: April 30, 2017, 01:39:10 am »
The resistors shown at C2/C3 are in parallel, not in series.
*facepalm*
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).

That 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.
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.
I'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!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf