Saturday, 13 June 2015

Lab Power Supply - Current Sensing/Limiting (Testing)

In the last post I had the current sensing/limiting working however I had a problem with voltage overshoot when coming out of current limiting and I had problems with the pre-regulator. I think I have both of these nailed so here goes!

Current Limiting Overshoot

Last time I described a problem where the voltage would overshoot the set point when the circuit comes out of current limiting mode (see below). When the current returns below the current limit the voltage (blue trace) shoots back up but overshoots.


I experimented with various things. The main things were trying to use a diode to bypass the capacitor when the voltage drops. I also tried reducing the current flowing through the diodes (increased the pull-up resistor to 47K) and this also didn't have any effect. On the plus side it draws less current however so I will keep the change.

A bit stuck I turned to my trusty guide - the Agilent E3634 service manual and schematics. They take a different approach in that they sum the reference voltage and the inverted output voltage to drive the MOSFET. I noticed that there was a capacitor across the diode that joins the voltage error amplifier to the MOSFET gate. I wasn't exactly sure what this did but I tried it out. The circuit essentially now looks like this (I have added C8).


While it did not totally eliminate the over-shoot it reduced it to the point where it is negligible. I don't quite understand how this works - it is essentially capacitor coupling the voltage error amplifier with the gate driver.

When I tested this on the breadboard it looked like this (see below). The yellow trace show the current flow measured by the dummy load (1V/A) and the blue trace is the voltage output. The voltage shoots from zero up to 26V when the current drops. You can see a very slight upward deflection in the voltage and the top of the blue trace but otherwise it is pretty smooth. 


I did have a slight concern that this would effect the speed of the transient load response but here is the output voltage when the load switches from 0-2A and back again. It is still responding with 10uS in both directions:



This looks perfect to me! I am calling it fixed!

Pre-regulator

The other problem is that I found that if I set the pre-regulator to track the output voltage, when the supply goes into current limiting mode and then returned to constant voltage mode, the voltage would not return to the set voltage.

Having the pre-regulator track the output voltage is important. Otherwise if the pre-regulator sets the capacitor voltage based on the desired set voltage and you short the output terminals, the MOSFET would have to drop virtually the entire output power. I'd have to use a massive heatsink to support this. Setting the pre-regulator from the output voltage means that in current limit mode the MOSFET only has to drop a few volts.

To illustrate the problem, here is a trace showing the load current (yellow), the output voltage (blue) and the capacitor voltage (green). The output was set to 25V and limited to 500mA. The dummy load was set for 1A so you can see short spikes before the limiting takes over. The voltage never makes it back to 25V when the current drops as the pre-regulator voltage hovers around 19V.


Interestingly if you set the output voltage lower it works and although it isn't clear why.


It took me some time to replicate this behaviour in LTSPICE. I figured out that as I was simulating the transition from 3A to 1.5A and back again it was different to the breadboard test. I also had to increase the simulation time as the capacitor would take time to discharge.

I tried changing the Zener diode in the pre-regulator that determines how far above the set point it is aiming for but this didn't have much effect. I tried increasing the capacitor on the servo op-amp that controls the firing point but this made it worse. Then I experimented with smaller values and found that if I used a 470n capacitor it would work. The downside is that the charging of the bulk capacitor is less frequent (more sporadic) but it does work.

Here is another test with the 470n capacitor, with the dummy load set for 3A and the limit set to 500mA and the voltage set to 25V. The pre-regulator holds the voltage comfortably above the output and the circuit is functioning correctly.


When I vary the output voltage the pre-regulator moves accordingly which is fine.

Again I think I will call this fixed. I think the dissipation on the MOSFET is still significantly reduced by the pre-regulator. When I set the dummy load for a constant (and large current) and set the limit for a smaller output, the pre-regulator does a good job of maintaining a lower capacitor voltage so the output holds at the desired voltage and the current holds constant.

Tuesday, 9 June 2015

Lab Power Supply - Current Sensing/Limiting (Testing)

In this update I continue with the Lab Power supply project. The parts required for the current sensing/limiting circuit finally arrived and I test out my design. Yet again I got caught out with ground placement and I found a flaw in the circuit I planned to use. I find a couple of performance gotchas that aren't easy to fix and may require some compromises to be made.

Current Sense Resistor

I installed the 10m ohm current sense resistor in the negative supply rail close to the output. My plan was just to install the resistor and measure the voltage across it using a multimeter to see how it goes. I left the earth point for the grid supply and the control circuitry to be at the negative side of the sense resistor.

I tested the circuit to make sure it was still working and found it was oscillating wildly. I tried moving the earth point to be nearer to the output terminal (i.e. the other side of the sense resistor) but this didn't change anything.

After some head scratching it occurred to me that as the output voltage sensing is after the sense resistor and the output capacitor is before it, the sense resistor and output capacitor form a pole. I moved the output capacitor to be literally on the output terminals and the oscillation stopped. Crisis averted.

So then I started looking at the voltage across the sense resistor while loading the supply using the dummy load. The first problem is my shiny new scope only has 10x probes and the lowest settings is 10mV per division. So a 1A signal just makes it to 1 division and the scope would't trigger. I think the problem is that even if you clean up the signal with the high-resolution acquire mode, its too noisy for the triggering to work correctly. I measured the voltage using a multimeter and it seemed to match what I expected however (11mV which is within tolerance). More on measuring the sense resistor voltage below.

Current Sense Amplifier

I put together a 5V rail using a LM317 and cascaded it off the 40V rail I already have. I added the LT2050 current sense amplifier and configured it to amplify the current sense resistor voltage so that 1V at the output is 1A. This is actually a bit of a problem as the common mode range on this component is only up to 1.3V below the positive rail. I might have to run this off 6V to get the full current range.

The output was a bit disappointing in that there was a regular spike that seemed to correspond with the 100Hz bulk capacitor charge cycle. In the image below the yellow trace is one of the AC signals and the green is the output of the current sense amplifier with no load on the supply.


I thought that perhaps this could be noise induced in the wires. I am running a 15cm wire from a vero-board where all the high current circuits are back to a breadboard where the control circuits are setup. The voltages are pretty small so I thought it wouldn't take much to induce this amount of noise. 

I twisted the wires together to minimize inductance but this had no effect. I found an old USB cable that had a clip-on ferrite bead and decided to try using the bead as a sort of common-mode choke. I wrapped the wires through this a couple of times but this too didn't really help.


I tried fiddling with the bypassing and even tried adding capacitance but none of this changed anything. At this point I was trying to decide if the problem was in the amplifier or if there was some sort of noise current occurring.

I remember that my old Tektronix 475 can go down to 2mV/division when the probes are in x1 mode. I remembered an old EEVBlog video where Dave Jones measures the ripple and noise on the output of a supply using a pair of probes. The basic idea is to use two probes as a sort of differential probe.

Unfortunately my old scope has drifted a bit so it took a little bit of fiddling to get the traces right. I configured each probe for the minimum setting, grounded each channel in turn and adjusted the trace to be on the zero line. Then I inverted the second channel and added them together. Unfortunately if you ground both and hit add the trace moves. I figured out how much and compensated by adjust each trace half this amount. 

When I adjusted the scope correctly I got a relatively noise free measurement of the voltage over the sense resistor and I could see the same weird bump occurring in the voltage. This means the sense amplifier is working and the error is somewhere else!


I went back to LTSPICE and remembered that I hadn't updated it with the changes I made to the circuit after adding the sense resistor. I moved the output capacitor to be closer to the output terminals but this didn't change anything. I remembered I had moved the ground point to be near the output terminals (after the sense resistor) and I tried changing this in the simulation. Oddly this was the cause of the fault - I was able to reproduce the behaviour in spice. 


I moved the earth point back to the other side of the sense resistor and the problem went away. The voltage control/pre-regulator etc was still functioning correctly too.

Current Control Circuit

I constructed the current control circuit that I designed in the previous log entry:

For the current set point I just used a 5.6V Zener diode and a pot (so I could vary it).

I discovered there is an obvious hole in my plan - because of the diodes, the minimum that the current control circuit can pull the voltage down to is 0.6V. If the load is low impedance (in my case it was my dummy load) then often this isn't enough to get the current down to the desired level. This pretty much kills this approach.

I re-configured the circuit so that the driver transistor is diode-ored between the current and voltage control amplifier outputs (as I had before). When I simulated this I found that the voltage would overshoot  when it came out of current limiting and I wanted to see how bad this is in reality.

Here is a scope trace demonstrating the effect: The output voltage is set for 25V (roughly), the output current is set for around 600mA and the dummy load is configured to draw 1.3A in 1KHz pulses. The green trace is the current (1V == 1A), the blue trace is the output voltage. You can see the current shoot up to the dummy load maximum until the current control takes over and brings it back. This takes around 100us to get in range but 200us to be stable. When the current drops off the voltage control takes over and gets the output voltage back up to the set output. The problem is that it overshoots by approximately 3V. It's back under control in around 200us however. I'm not sure about the ringing in the current but it is likely that because the dummy load is actively trying to drive the current up to the set level that there is a tug-of-war happening between the control loops. I don't think this matters too much in any event.


Right now I am really not sure how to fix this. The reason this occurs is pretty clearly due to the slew rate of the op amps. As the current control amplifier output increases, the voltage control is decreasing  and the overshoot is where the current control overtakes the current control. If I make the voltage control slower then this will work but clearly I don't want to compromise on speed.

Pre-regulator

I presently have the pre-regulator set to the voltage set point but this has a big downside when the current control kicks in. The problem is that the pre-regulator is holding the capacitor at 30V even when the output drops to close to zero because the supply is in current limiting. The heat dissipation is quite considerable even with just 600mA being drawn.

I tried setting the pre-regulator off the output voltage and while this works quite well for a relatively static load, the pulsed load above completely stuffs this up. The problem is that often the pre-regulator is caught with its pants down when the load drops and the voltage control goes back up to the set level. The result is that the output voltage is quite unregulated when the load drops out.

Again, I am not sure what I can do about this as the voltage is swinging between the extremes. Either the output will be low or the transistor will dissipate a lot of heat. This will require some thought.