## Saturday, July 15, 2017

### My New Power Supply Design Project Part 2

I actually built prototypes of the earliest design and started to learn more about the functionality, and try to find the limits. I'll go in much more details later, but for now let's go through the characterization of the complete control segments and see how stable this design rally is, by using the simulator. In the process, we will also figure out what frequency optimization we can use to make the supply stable and still have the optimum switching speed, which is the usual trade-off.

Because we are dealing with two circuits, the Voltage control and the current control, I have actually split the stability characterization in two parts.

Volt Control Stability Analysis and Tuning.

Here is the LTsim circuit of the Voltage control section:

I also use this for the Step Response measurements, so some artifacts are already in this schematic.  I won't go into many details because I may mislead you, but in order to do the stability analysis, you need to measure the Open Loop Gain. This is accomplished by "breaking" the Voltage feedback loop and inserting a small sweeped AC signal (V5 with 1V AC, 0 phase shift).

In order to let LTsim establish the DC settings, we'll apply a huge inductor and a huge capacitor to block any AC from disturbing the Open Loop measurement. Because we want to do an AC analysis and get a Bode plot of the responses, we instruct LTsim to do an AC sweep with 10 decade steps from 10Hz to 100MHz. (.ac dec 10 10 100meg) as you can see below V1. (The .trans instruction below it is turned into a comment and does not play a role here.) I have isolated the Current Control section by breaking the connection between the LED and the bias circuit.
With a load of 10 Ohm at the output terminal we draw the maximum load (3A).

After I played with the frequency compensation networks (C7 R6) and a potential network across R8, this is the resulting Bode plot.

There are a number of key parameters to obtain from this plot.
1. The cross-over frequency (fx) where the Gain curve (straight line with scale on the left) is crossing the 0dB or Gain=1 line. In this case the frequency is almost 10KHz. This is a function of the speed of the system.
2. The Phase Margin. The phase curve is the dotted line with the scale on the right. This is a measure of the stability of the system. The Phase Margin (PM) should be >45 degrees at fx. In this case it is about 60 degrees, which is OK.
3. The Gain Margin (GM). The GM is another measure of the stability of the system. When the Phase is crossing -180 degrees, the system will oscillate. There should be enough margin in the Gain to prevent that. The GM at fx is about 50dB. The GM at -180 degrees is minimal, but the Gain is already attenuated with 100dB, and the Phase is crossing the -180 degree point at 50Mhz. I don't think this causes any harm.
4. The slope of the Gain at fx should be -20dB/decade, and that's exactly what is is.

I think that this is good enough to try in real life.

Current Control Stability Analysis and Tuning.

Here is the LTsim diagram for the Current Control section that I used.

I disconnected the Voltage Control section by removing the connection between the LED and the bias. In order to make the current section do something to drive the pass transistor, I used a separate Voltage source (V5), and set that to 0.1V, enough to drive the Current Limiting with 10 Ohm at the output. The Open Loop Gain is obtained by breaking the feed back loop with the same trick as I used for the Volt section.

Here is the resulting Bode plot.

Let's look at the 4 key criteria again:
1. fx at just over 400KHz, which is pretty fast. One of the reasons is that there is no large capacitance in this loop, because the output cap C6, is out of this loop.
2. PM at fx is about 65 degrees (-220 + -155), which is OK
3. GM at fx is about -40dB, which is OK
4. Slope of Gain at fx is about 34dB, also good.

Step Response Verification for the CV to CC/CL Mode Changes

This is the combined circuit of the two above.

The difference is with the LTsim analysis instructions, because now we want to see the system in action. Three LTsim settings are needed. We tell the simulation to run a transient measurement by making the .trans instruction active again. We tell the simulator to run for 55mSec.

Because we want to see the Voltage turn on and off, we instruct V1, the volt setting input to start at 0V, after 5mS switch to 2.5V (which is 15V at the output), and leave it there for 40mSec. Both ramps are with 10uSec edges.
Because we want to see the Current limited in action, we set the current setting input V7 to initially start at 1V (no CL), after 15mSec, switch to 0.5V and leave it there for 10mSec. both edges are 1uSec.
Here is the result:

At 5mSec, the output goes to 15V, at 15mSec, the CL kicks in. At 15V, a 10 Ohm resistor will result in 1.5A and with the CL set at 0.5V this will result in a maximum current of 226mA, causing the voltage to drop to 2V. The edges are very clean, no ringing, no overshoot. The round corner of the leading edge of the CL is die to the fact that the output capacitor is de-charging, causing a slight delay in the CL limiter. This is the major reason I like to keep this capacitor as small as possible, and I even put a small resistor in series. Real testing will reveal of this is acceptable or not.

Here is a trace of the current going through the load resistor:

The output current starts out with 0A, then switches to 1.5A. When the CL kicks-in the output goes to 226mA, after which it goes back to 1.5A, to become 0A again towards the end.

Thermal Protection & Management
Because I use rather small enclosures, the size of the heat sinks where the pass transistor(s) are mounted on are limited in size. The worse that can happen is when the series pass transistor develops a C-E short, which will surely destroy the DUT, and may even destroy the power supply itself.

For this power supply, I wanted to have two thermal protections. One that would react as fast as possible to the die temperature of the pass transistor(s). Another circuit would be to drive a fan to cool the heat sink, but I only want the fan on when it is needed, to cut down on the noise level. (I cannot stand loud fans!)

Let's cover the thermal protection of the pass transistor first. The easiest method I have found is to mount an NTC directly on top of the transistor. I have found an NTC that is mounted on a lug that can be inserted under the screw that mounts the TIP142 to the heatsink. I have found that the fastening screw itself gets warm very quickly, and since the NTC is also on top of the plastic package of the transistor, there is little mass involved, so the NTC will react pretty quickly.

I use a simple comparator circuit to set the trip temperature of the NTC.

Normally, the 10K NTC is part of a voltage divider, here with R1 and R2. I simulate the voltage level of this divider with V3. When the voltage is representing the right trip temperature, the Opamp switches state and sucks the bias current away from the pass transistor, turning it off. R5 is used to create a hysteresis so this switching state will not oscillate. You want to be able to turn the supply off, because it will otherwise turn on after the temperature has lowered. Sometimes that's OK, like if you are charging a cell.

Here is the resulting trace.  The green trace depics the voltage of the divider with the NTC, and this will turn on the Opamp, taking the bias current away. After the temperature has move up a bit higher than the trip temperature, the supply is turned on again.

To add stability to the overall control loops, it is customary to add a little load to the output, so everything is under control when there is nothing connected to the output. You could simply use a resistor, and I have been using a 3K3 resistor so far, which generates about a 10mA current, at 30V. However, knowing Ohm's law, that load is dropping to about 1mA below 10V, so no longer really a load...

In many supplies, a constant current load is created by an LM317, or a J-FET. Unfortunately, these solutions only work well above a few Volts. I came across a simple and very effective circuit, unfortunately, I did not record where I found it. Apologies to the creator, because this is a very nifty circuit and starts working above about 0.6V already.

Here is the circuit as I tested it in LTspice:
(actually I verified it again after I blew up the transistor on the PCB while I was ramping up the output voltage the first time.)

Four components is all it takes to create a constant current of 10-12mA, regardless of the output voltage.

Here is the simulation:

The red trace is the power supply output voltage that is going from 0 to -30V and back. The green trace is the current through R2, the 56Ohm resistor. The current flows when there is more than 0.6V, or thereabouts, on the output.

There is more to this circuit though... I initially build a prototype with normal THT components on a breadboard. I used a 2N3904 transistor (my favorite workhorse) and a BS170 MOSFET. I picked this MOSFET because I use that a lot and it was the first one I saw in my box. I tried it and was amazed how well it worked. Initially, I was going to use a single J-Fet, but I didn't have one that was capable of handling the 30V output voltage. I tried a few alternatives, but this is by far the best solution.

When I populated my PCB, I selected two SMD parts. A BC847B transistor and a 2SK3018 MOSFET. When I first tested the supply and started to ramp up the output, the transistor turned into a torch. It turned out that the 2SK3018 was not up to the task, because the VDS rating was too low. I sloppily selected this part, instead of a 2N7002 that I also had in my box. Because I did not take the trouble to simulate this with the actually selected components, I overlooked this fact. So to understand what was going on, I added the2SK3018 and the 2N7002 MOSFET 's to the LTsim library and did it again. Sure enough, the 2SK3018 caused the fail. After replacing both parts, everything worked as expected. Lesson learned!

Fan Controller
I also use a fan controller circuit, to turn the fan on and off, and the chip I use will control the speed of the fan based on the temperature. The NTC needed for this circuit is mounted directly on the heat sink with a bolt.

The chip I use to control the fan is the TC648B that I also used in other projects. Have a look at my other post for more information.

I'll continue in Part 3
http://www.paulvdiyblogs.net/2017/07/my-new-power-supply-design-project-part.html

1. 2. 