Wednesday, 16 March 2016

Lab Power supply ADC and Output Voltage

So I fixed the error in the amplifier that converts the output voltage down to the range required by the ADC and fitted the ADC, voltage reference and crystal. I soldered the sense and output wires together but I was *still* seeing problems with output voltage fluctuations under load.

ADC

When soldering the ADC I took a slightly different approach. Initially I used solder paste on all the components but found I couldn't dispense it finely enough for the fine pitch components so went back to hand soldering. Keeping the chip aligned while hand soldering is tricky so I revisited using paste. This time I applied flux to the board and then held the solder paste syringe nearly vertically so the tip was flat to the tracks. I gently moved it up and down and the flux would slightly dissolve the binders in the paste so I could smear on a smaller amount. This worked really well and gave me a pretty neat joint after I heat-gunned it.

I fitted the reference, the crystal, the crystal capacitors and the bypass caps as well as the ADC. I powered it up and saw a nice steady 2MHz signal on the oscilloscope. I re-enabled the software to read from the ADC and I modified the code to add a command to read the ADC count rather than the converted voltage. This would make calibration easier.

The output looked *really* good. Before I found the ADC would give dodgy results when switching between the two channels but there was no sign of this. Also the ADC seemed a bit slow but that also was gone and the response comes back without delay. The ADC counts barely vary and even when they do it is less than a single count so the noise is very low. Even without calibration the values looked very consistent.

I did a calibration run where my python script steps the voltage (by stepping the DAC count through 32 steps evenly divided across the count range) and then reading both the output voltage on the Agilent 34461A and the ADC count. The results are stunning - here is a graph of voltage vs count:

I then took each voltage and divided it by the count (effectively measuring the volts per step). The first one was a bit off but otherwise they too were *very* good.


If I remove the first one from the data you can see the variation more clearly:


The variation between the top and bottom value is less than 1.5ppm. Impressive!

Output Voltage

Previously I noted that if I moved the output terminals around, the voltage variation under load pretty much cancelled out. While testing the ADC I noticed that under load the output voltage reading varied from the unloaded value. I decided it was time to tackle this problem once and for all!

The power and sense wires each had a round spade terminal soldered and crimped to the end of them, The connection between them was just by contact and the pressure of the retaining nut. I made new sense wires and soldered these onto the same lug as the power wires so there was no contact resistance issue and hopefully when I wiggled the wires nothing would change!

When I powered it up the output was much more consistent and still close to the calibration setting. 10V came out as 10.001V. When I enabled a 4A load (from the dummy load) the voltage went up to 10.025V (25mV increase).

When I tried tracking this down before it was really hard as I felt like everything was in motion. This time wasn't so hard - under load the voltage at the S+ screw terminal was about 10mV different from the V+ and similarly the S- and V- differed. The difference between the S+ and the voltage at the banana plug was tiny (less than 1mV). In fact I measured the difference between the top of the banana and the bottom (where the wires connect) and it came out to 0.7mV.

This all makes sense - the 10mV difference is due to the wire resistance and the sense voltage is consistent with the output voltage. There is a small difference between the voltage at the back of the banana (where I am sensing from) and the front but nothing to get upset about.

On a hunch I thought it might be my old friend the grounding problem. I attached the negative probe of my DMM to the virtual ground (the inboard end of the 10m shunt) and measured the difference in ground potential to various points around the board. 

The ground at U1 (the main opamp package that drives the voltage and current control loop) varied by 5mV! There is a layout problem as I grounded this from a different point along the fat ground conductor going to the output:

I soldered a wire from the correct ground point to the bypass cap near the chip. I can't totally fix this as it is still connected to the fat track but it meant the voltage only varied by about 1mV instead of 5mV.

So then where is this 25mV difference coming from? I noted that the ADC reading matched the output voltage both when under load and not under load. This means the differential amp that reads the output voltage must be right. So then why does the output vary?

I measured the output of the amplifier that takes the 0-5V from the DAC and converts it to 0-30V for the control loop. That too was varying by nearly the exact same amount as the output! I measured the difference in the DAC output when loaded and un-loaded and it was tiny - would barely account for 1mV of the output difference.

This amplifier looks like this:

I measured the voltage at the ground point on R7 and found it varied by a lot! (6mV). This would just about account for the problem.

Searching the board I found it too was badly connected to ground so I ran another wire to that point. That pretty much nailed it! The output now varies by around 2mV under load. 1.4mV of this is accounted for by the resistance of the banana jacks. The rest is probably due to the fact that I can't cut the connection to the fat track.

That's more like it!

An interesting effect of fixing the ground issues is that the output noise fell considerably. This is the output at 10mV per division, trigger source is line (as it tends to be in time with the line frequency) and a 4A load.

 
I did this again but used my Tektronix 475 (as it is better at low voltages). Here is the output with 2mV per division, line triggering and no load


And here it is with 4A load

So it looks like the noise went from around 2mV P-P to about 6mV p-p. Still *very* low. Also the measurement really needs to be done with coax to the terminals.

Next

I want to make sure the serial interface is fast enough for the GUI so it is time to hook up some GUI code (more on this later). I still have a nagging problem in the pre-regulator when under very low frequency pulsed load. Till next time!

Thursday, 3 March 2016

Lab Power Supply - PCBs

After a long wait the PCBs came from Seeed. I started assembling one and tracking down all the problems. So far nothing I can't fix or work around but I learned many lessons!

Actually I began writing this entry quite some time ago but work on this project has been sporadic due to work commitments and other things going on.

Staged Assembly

Some of the components I am using are expensive (maybe $10 per item) so I really didn't want to assemble the whole board at once in case there was a fatal flaw in the design. I wasn't sure I could harvest the parts off the board again and so I decided to work on a section at a time.

The process has been to test
  • Just the internal supply rails so the 5V, 28/40V and 24V supplies. Because the parts are either cheap or removable and because they would be hard to solver in later I also soldered in all the pre-regulator parts and the output MOSFET and bulk capacitors. These checked out although I couldn't test the so I moved onto the next step
  • The micro-processor. This might seem odd but I need this component to set the output. Also as it is relatively fine pitch, if the soldering goes wrong I didn't want to have too much extra on the board. I placed the micro-controller, the transistor that controls the winding switching relay and, bypass capacitors, ceramic resonator and the ICSP header. At this point I could connect my programmer and blow the software onto the micro and see it starts. After some soldering headaches (see below), I connected it up and successfully programmed the chip. It took quite some time to figure out that it was running as I couldn't see any signals on the oscillator lines nor the serial output. Turns out I had a big delay in the code so the serial output was just taking a while.
  • My plan was to place the USB parts next as then I could see the debugging from the micro more easily. I placed all the capacitors etc and was about to place the USB to UART converter chip when I realized I had the wrong one. The unit I bought was a SOIC but the footprint I designed was the TSSOP. I quickly placed an order for the TSSOP part. 
  • At this point I decided to go for broke and placed all the analog control parts and the DAC. I probably should have done just the DAC first but got impatient.

Soldering

I used solder paste for the first time on this board. For the resistors, capacitors and diodes my approach was to work on a section at a time and to place a dot on each pad and then  place the component. I then apply hot air (250C) generally to the board area and then in a more concentrated fashion to each component. Initially the paste will go a light-gray colour and then when the heat gets to the right place it goes shiny and pulls in. I found that if I apply the heat nozzle to the middle of the component so it heats both sides to melting then the component will naturally pull into the centre of the pad. Excess solder wasn't much of a problem even for the tiny SOD-323 pads. Transistors were similarly easy.

The tiny LT1716 was also pretty easy. I used a similar technique and placed a dot on each pad, placed the component (carefully aligning it) and applying heat.

Buoyed by my success I used the same technique on the QFP32 microcontroller. Putting a dot on each pad was impossible as the pitch is too fine. I placed (what I thought was) a thin line down each line of pads, placed the component carefully and applied heat. I thought the component would pull into the middle like others did but it didn't. It could be my nozzle was too fine. If anything it moved enough to skew the alignment. Also there was too much solder so I removed some by applying liquid flux and solder braid with the soldering iron. When I did I realized how bad the alignment was and had to remove the part. I used hot air to soften it up and spread my tweezers wide to grab the part and pluck it off.

I had to clean up the pads with flux with solder wick after removing the microcontroller. I managed to damage a couple but luckily they were unused pads (or perhaps they are more fragile because they are not connected?). The trick is dabbing the wick rather than wiping it as otherwise it moves the pads. I put on solder paste (much less this time) but I put it more to the middle of the pads so when I placed the component I could see the alignment better. I held the component down with tweezers this time as I applied heat so it wouldn't float off. This sort-of worked and with just a little bit of mucking around with wick I got it near enough.

My procedure for checking the soldering is to use my fine SMD probes and my DMM on continuity mode. I check that I have continuity between the chip lead and the pad (being careful not to put too much pressure on the lead as then it bends down and touches anyway)  and checking I don't have shorts between adjacent pins.

After the horror of soldering the micro-controller I did some Google searching and found videos of other people hand soldering these. The trick seems to be to apply some flux, place the component to get a good alignment and then use a soldering iron to tack a couple of leads in place. You put solder on the iron and the liquid flux will allow it to wick off the solder tip onto the lead. Then you can put paste on the other leads and use the hot-air to finish the job.

Even this wasn't that easy as the alignment is really hard and it is easy to over apply the solder. I thought I had everything done and then at some point I was getting weird problems with reliability. At one point I couldn't program the board unless I pushed on a particular spot. I ended up applying flux and solder (via the iron) to re-do some joints and this fixed it. For fine-pitch components the best approach seems to be to apply solder via the iron rather than using paste.

Board Faults

For the most part the board was Ok however there were a number of faults. Unfortunately one turned out to be a killer that means I need to re-spin the board
  1. The footprints for the PTC and the MOVs are mirrored. I think I must have looked at them from the component side when designing the footprint. As they are two legged components you can solder them in but they just don't sit right.
  2. The spacing between the main MOSFET and the last LM317 means the boards don't quite fit on the heat-sink. I can get around this by screwing the LM317 down somewhere else and running leads to the PCB. Not sure if I will fix this as it is a bit of stuffing around
  3. (The killer) The SSOP MCP2200 finally came and I went to fit it. Unfortunately this doesn't fit either as the package is a wide SSOP not the standard size. Dammit. It was a tiny bit too wide too so I tried soldering it in place but with no luck.

Design Faults

In addition to the board faults I found a few errors in the schematic some of these are errors in transcribing from the prototype.
  1. The LDAC pin of the DAC is pulled high not low. I can get around this in software however
  2. PNP transistor in the CC Mode detection circuit was the wrong way round. I  worked around this by soldering in a TO-92 PNP transistor and otherwise this circuit worked.
  3. The output of the comparator in the pre-regulator circuit went through a voltage divider to the SCR gate. This didn't work and in fact by just having a resistor between the comparator and the SCR gate it works fine. I just removed this resistor from the board and the pre-regulator fired up.
  4. The differential amplifier that measures the output voltage didn't quite work. More on this below.
  5. The relay lacked a diode to snub the back-EMF created when it was switched off.
  6. The opamp that buffers the output voltage for the ADC had the V+ and V- inputs exchanged and basically didn't work. I didn't notice this at first as I haven't fitted the AD7705 yet.
  7. The bridge rectifier needs to go on the heatsink (see below).
  8. Despite my calculations, the LM317 that supplies 24V to the relay still gets hot.

Output Voltage Measurement

The idea is to either get the voltage from the front panel or, if sense leads are being used, to read from the device being powered. Using 10K resistors between V+ sense and V+ created a massive voltage divider and so this didn't work. Even reducing these down to 20 ohms meant the resistors introduced a significant error as 20/4.7K is still a significant proportion.

The problem is the input impedance is too low. I figured out if I switch to using 100K resistors this problem is greatly reduced. The problem then is the loop compensation makes the opamp too slow so I also need to reduce the feedback capacitor to 10pF. Another problem is 100K resistors create significantly more Johnson noise (the reason I used small resistors in the initial design) but I don't think I can't avoid this.

I changed the circuit and removed the resistors on the board that connect the voltage sense lines with the voltage output lines and I changed to using 100K resistors and 10pF feedback. The output was stable. Unfortunately if I use sense leads to measure the voltage on the dummy load the output oscillates. I tried twisting the leads and other things but I can't avoid it. I think for now I won't provide external sense inputs and just have two banana plugs per channel.

At that point I did a calibration run using my Keysight 34461A and the voltage output is very stable. I haven't been taking temperature measurements but the temperature in my lab will vary by as much as 15 degrees (no air-conditioning and it is summer in Australia) and the output voltage varies by much less than 1mV

At one point the opamp package that amplifies the DAC output and buffers the output voltage failed (this is how I noticed the buffer problem I described above). The output went to the rail and killed my DAC unfortunately. I think the ground pin of the opamp didn't have enough solder on it and it made a momentary break when I was probing things and killed the opamp. I replaced both packages, re-calibrated and then it was back up again.

It was at this point I noticed the output was varying a lot with load. I spent a long time noting down voltages at different points in the circuit relative to the power ground. I spent quite some scratching my head and then I moved the leads slightly and everything changed. I have banana plugs screwed to a small bit of MDF and the power and sense wires are crimped onto spade lugs screwed to the back of these. The other end are screwed onto the terminal block. When I move the wires the voltage goes all over the place as I think the contact between the V+ and S+ or V- and S- can vary. I think I will solder them together in the final design.

Load Testing

Now that I have it on a PCB I can screw the power devices to the real heat-sink and do some load testing. My dummy load only goes to 4A but for now that is enough.

As I will have multiple channels all on the same heatsink I need to insulate the devices from the heatsink. I use cheap silicon rubber insulators from Jaycar with heat grease. I marked holes for the devices, drilled the holes and tapped them. The location of the devices isn't great as they are behind capacitors so it's hard to screw them down. I managed it but it was not easy.

The LM317s and the P-Channel MOSFETS didn't get very warm however the N channel MOSFET (the main pass element) got practically incandescent (quickly hit 90C). The heatsink however didn't even get slightly warm. I experimented with screwing the device down harder but with no luck.

At about this time I needed to order a replacement DAC (see above) and so I ordered some Aluminium Dioxide insulators. The problem was these are slightly too wide and clash with the adjacent MOSFET. The material is as hard as ceramic so no chance of cutting or drilling it. I managed to mount the transistor with the heat pad side-ways. It provided enough contact so I screwed it down and re-ran the test. Now the MOSFET just touches 60C after running for a while and the heatsink starts to warm up. With a low-speed fan I think this will be perfect.

The bridge rectifier however was pretty dam hot - I measured over 100C at times. The thing is the device is rated for 15A so I was surprised it got so hot with just 4. It turns out it is rated for 3A with no heatsink and 15A with a heatsink. Doh!! Another design change required.

Here is the PCB on the heatsink and surrounded with test gear. The yellow wire is the thermocouple for the MOSFET. Note also the through-hole PNP transistor bodged in there due to the PCB design fault.


Relay Transient

I noticed that when I switch from a voltage in the 15-30V range back to a voltage in the 0-15V range, the relay would click but the voltage wouldn't change. Initially I thought this was a software fault but I found sometimes the output would go to zero. If I change the voltage to some other value it often will then work.

Basically it seemed like the DAC wasn't responding when I switched the relay. I had a bit of an 'aha' moment and realized there was no back-EMF diode on the relay. I put a scope probe on the base of the transistor that switches the relay and capture this mess. The base is seeing transients as low as -8V! Needless to say  - I think I need to fix this!


I added a diode across the windings so it would absorb the back EMF and now it looks much better, In addition I don't have a problem with the DAC command getting lost.

Next

I think I will fit the ADC and reference and continue to test out the design. Better to find all the faults before I spin more boards. At this stage however these boards are totally toast :(

Also as I won't provide sense inputs I only need two MOVs which should save a lot of space. I think I might use the bigger versions of the ADC and MCP chip as they are much easier to solder. I need to do some re-design to mount the bridge on the heatsink. This might mean putting the regulator on smaller heatsinks. But this is all for later...