Power of Three

Tom Biskupic

Issue 4, October 2017

Creating your own bench power supply is no small task, let alone a three-channel, touch-screen controlled unit! With three fully independent channels, voltage adjustment from 0 to 30V, and up to 4.6A available, per channel! It's super steady and we we wanted to know more!

Tom was looking at expensive commercial power supplies, until he realised he could probably make his own, and learn a stack of new information in the process! With a Raspberry Pi (RPi) at heart, and a touch-screen for an amazing user-experience, we wanted to know more about Tom’s amazing creation.

Other than your need for a power supply (and who doesn’t need a good power supply?), what led you to embark on this project - instead of just buying one!

I recently took up electronics as a hobby and I was using a simple Jaycar single channel power supply for my experiments. But one day I needed a bipolar supply for an opamp circuit and realised I needed something more powerful.

I actually studied computer engineering many years ago, but I ended up bailing out. Since then I’ve been working as a software developer. So while I am not totally new to this, I am still very much an apprentice.

I’ve always enjoyed playing with electronics, having grown up hacking on Commodore 64s and the Commodore Amiga. A few years ago my son started playing with quadcopters and 3D printing, and I really wanted to learn more. I started watching Dave Jones on EEVBlog and things just took off again from there!

In addition to multiple channels, I also wanted a bit more current than the 3A my Jaycar supply could provide. I also found that although the Jaycar supply is very dependable, it’s not very quick and takes quite some time to respond to load transients and the like. I looked at the Rigol DP832, but since the whole point was to reboot my electronic knowledge, I thought I would have a go at making one! As it is a one-off I had a pretty free hand in terms of budget and I didn’t care about physical size. Basically I wanted a really quiet linear supply with very high accuracy. Being a smart and networked device seemed important too, because I had lots of ideas where being able to control the supply and coordinate it with other devices would be useful.

Making the project open source seemed important. I wasn’t sure (probably am still not sure!) if it is something someone would want to copy, but if anybody did want to use my design then I felt it was important they could understand it fully. I love old Keysight and Tektronix equipment where you can get full schematics and even detailed descriptions of the circuit operation. It means you can really understand the limitations of your equipment.

We love Dave and the EEVBlog channels too. There are many choices when you have a combination of a microcontroller and analogue circuitry - what made you settle on the Raspberry Pi?

To be honest I didn’t consider other Linux-based SBCs too much, as I was familiar with the Raspberry Pi (RPi) and quite liked the RPi community.

The RPi was attractive for a few reasons, but initially I was thinking I could easily get networking and the ability to store data on USB for free. I also thought I could build a user-interface toolkit targeted at electronic instruments. I thought it might be an interesting platform to build other test equipment. For example, I thought of building a home-brew arbitrary function generator or perhaps an electronic load.

In the end I found the Kivy Pi toolkit, and it provided loads of useful tools. I didn’t feel the need to build a toolkit but it might still be worth it. I’d need to do another project I think to really understand what could be generalised.

Just being able to program the GUI logic in Python is very nice. You can do anything in Python. I work in Java and C++ during my day job, but for small things you can’t go past Python.

Using USB to connect between the channels and the front-end made life really easy. Each channel has an Atmel ATMEGA328PU that runs the show. I used a MCP2200 USB to serial chip to interconnect these, as it is well supported by the Pi. Also using USB meant that during development I could connect the channel control boards to my computer, and just type commands at them to make them go. The USB hardware on each channel however, is isolated from the rest of the channel circuitry. The Pi powers the MCP chip, and then the serial signals from the MCP are passed through an isolator chip before they go to the MCU on the channel.

The downside of using the RPi is that it is a bit slow to boot, and you have to shut it down properly. The latter point led to the need for a standby supply and a soft-power switch, but it worked out okay in the end.

Now there’s a valid point - we never really considered boot up/shut down when using Raspberry Pi for something like this. Nevertheless it’s a great basis for control. A touchscreen is a great interface. Was that an easy decision?

I wanted to use an LCD user interface from the beginning, but to begin with I had other plans for input. My son told me about this flexible 3D printing filament and so my plan was to experiment with printing my own keyboard membranes.

Using a touchscreen however, means the user interface is totally flexible. For example, halfway through the project I reoriented the user interface from a vertical layout to a horizontal one, as I didn’t have enough space below the screen for the binding posts.

The cost of the display is a factor but I bought the parts over time so it didn’t matter too much to me. Also compared with what a comparable commercial supply would have cost, I felt it wasn’t that much; but maybe I have more pocket money than some!

I probably should have implemented a dial to adjust voltages/current; I still might. I also thought about adding a virtual dial on the display - I’ve found a Kivy widget for doing this.

I probably didn’t need a display quite so big. I had (have) plans for more graphic capabilities, and so the big screen was chosen with that in mind.

Tom's custom PCB.
Tom's custom PCB.

A PSU with live voltage and current statistics on the display? We could get behind that! What made you decide on three independent channels?

I originally planned to have two channels only, but when I was working though details of the box and heatsinks, I found I could do three. Having the analogue circuitry on separate boards makes this relatively easy.

Three channels gives me the ability to configure a bipolar supply (so for example +/- 15V for some analogue circuitry), and then I still have an additional channel for a digital supply. Also I can connect them in series to generate higher voltages.

I do like repairing old equipment and having three (or four if I use my old supply) independent channels, as it means I can bypass the power supply in a piece of broken equipment and run the unit from the lab supply for troubleshooting.

Having the 1mA/1mV resolution gives you some interesting capabilities also. For example it’s a neat way to measure an LED voltage drop, as you can set the current limit to the current you want the LED to consume, and then you can read off the voltage. So to enable a limit of 20mA, and then set the voltage to say 8V, you can just read off the forward voltage drop at 20mA from the supply.

Lately I’ve been thinking about upgrading the software to implement a sort of curve-tracer type feature (a poor man’s SMU), where I can use one channel to sweep the bias voltage on the gate of a MOSFET (for example), while using the other channel to provide and measure current through the source/drain. I can imagine other configurations where three channels would be useful also.

The RPi software is pretty rudimentary right now, and I plan to add more features.

As long as it’s stable and providing good functionality, the bells and whistles can come later! Does each channel have the same capabilities?

Yes the channels are all symmetrical; they are built on identical boards. You could probably reduce the size/weight/cost by using smaller transformers for one channel and adjusting the software current limits, but for me it was easy enough to make them all the same.

Awesome - that definitely provides great versatility. Tell us about any special features of this power supply that may not be evident?

The first thing is that the supply is very high precision. It uses an AD780 voltage reference, which is very stable. It uses 16 bit analogue devices ADCs and DACs, so I can set the voltage and current to within 1mV or 1mA, or read back the output voltage and current flow to the same accuracy. I spent some money and bought Vishay 4 terminal shunt resistors to measure the output current, and I use fancy low-offset voltage opamps (LT2050HV) in the current measurement circuit. Also there are four wires from the analogue board to the terminals, and there is a differential voltage amplifier to measure the voltage at the terminals, which eliminates voltage drops in the internal wiring.

The voltage control loop is pretty quick. Keysight usually specify a settling time of 60 microseconds from a 50% change in load. I have measured less than 20 microseconds of settling time when the load switches from zero to full load.

It is a linear supply so the design has to manage heat. The design uses a MOSFET as the pass element, to reduce the required voltage drop. It also uses a pre-regulator to manage the voltage on the pass transistors and thus, to reduce heat losses. Transformer tap switching is used when switching voltage ranges, although this is more about increasing the current output at lower voltages.

The supply is designed to be very low noise on the output. Rather than using a switching pre-regulator, the design uses MOSFETs to switch off the current to the bulk capacitor once it reaches a target voltage. I initially tried using Jim William’s design from AN-32, which uses an SCR to delay the turn-on time at each mains cycle. This generated a current surge as it switches at the part of the cycle where the current is highest. By switching off when the capacitors reach the target voltage, it is switching at the lowest current flow. The pre-regulator is based on a design I saw on the EEVBlog (put up by a guy who goes by “Black Dog” and hence it became known as the “BlackDog Pre-regulator” although I think he shared it from some other place initially).

I’ve tried to measure the output noise, and all I can say is that with my measuring equipment it appears to be less than 1mV RMS. The supply can provide 0V to 15V at 4.6A and 15V to 30V at up to 3A. It’s pretty cool being able to set the output to 10mV to play with some devices.

Towards the end of the development I splurged on a bench digital multimeter (DMM), capable of being driven from Ethernet. The supply has a feature where you can connect the outputs to the DMM and put it in a calibration mode where it talks to the DMM directly. The supply reads back the voltage while it steps the DACs through a series of voltages. The supply then saves this data to NVRAM on the power supply channel as calibration data. Pretty neat!

Mounted into a solid case
Mounted into a solid case, the analogue electonics are duplicated for each of the channels.

Self-calibration (in effect) is a great thing to have; we’re a little jealous right now! Did your analogue board take much revision, or did you nail it first-go?

I haven’t done much board design so this was definitely a learning experience! I started in the free Altium Circuit Maker when it was in Beta. I really wasn’t having much fun there and so switched to KiCAD. I love that KiCAD runs on my Mac and on my Linux computer. Last time I used anything like this it was called Protel. I quite enjoyed getting the hang of KiCAD overall.

So in the layout I have a digital section where I use a ground plane pour to reduce noise. In the analogue section, the grounding is more important so I run ground traces more deliberately. I wasn’t sure what size traces to use for the current requirements and so have probably overdone this. It does make layout pretty hard when they’re big. The power devices had to be at the back to get to the heatsink, and with the outputs at the front, I needed strong current paths between the power devices and the outputs. The digital had to be separate from everything else.

I did two revisions of the channel board - so many things went wrong! I stuffed up the footprint of the MCP2200 chip; it was a wide SSOP where I used a standard. One of the small SOT-3 transistors had the wrong pin ordering, so I had to bodge in a through hole for testing. And I forgot the diode across the relay, so it would reset the whole board when it switched transformer taps! Another rooky mistake was my footprint for the MOVs (they ensure the output never goes above 250V) and the PTC (to limit the current in case of failure) were backwards. They are asymmetric (point-symmetrical) but I misunderstood the datasheet, so the layout would actually have been correct if I’d soldered them onto the bottom of the board! I also didn’t implement the reset circuit correctly either, so some of the SPI hardware didn’t get reset. In hindsight, I am amazed this worked! But the fault would cause programming of the micro to fail occasionally.

The biggest problem however, was getting the grounding right. The current shunt really has to be the ground for everything to work correctly, and for the output to be accurate. Small resistances in the ground traces cause significant errors. The second revision improved this, but I still don’t think I nailed it. The first version would wander by a few mV as the load increased.

The analogue circuitry runs off 44V in 30V mode, and 28V in 15V mode (transformer taps). The relay runs off 24V so I had an LM317 that provided this. I underestimated the heat this would generate and used a surface mount LM317 in the first revision. In the second revision I used a TO-220 on the heatsink.

I was using Welwyn wire current shunt resistors to measure the output current. But I found a problem in that they would significantly drift as they warmed up. I was surprised by this, as their datasheet says they have a low tempco. I figured out later it was the thermo-electric effect and it was voltage drop on the solder joints. They would have been fine at higher currents, but 1mA equated to 10uV at the shunt and I was seeing 25uV of drift. This totally blew my accuracy budget.

In the second revision I figured out the box layout more, and changed the board from having a narrow edge on the heatsink to having the long edge on the heatsink. This reduced the lengths of high-current tracks, and kept things together more. I also got a bit better at the layout process, so the board came out more densely laid out.

touch screen
Clear touch-screen provides a fantastic UI.

Some valuable lessons in there, but an amazing effort for someone without much board design experience. If you had your time again, starting from version 1.0 - what would you do differently?

The biggest issue is that the UI is far too slow. I use a text protocol between the Pi and the channels and I think I need to slim this down a bit. I will probably fix this soon. This is also why I’ve not yet implemented an encoder or virtual dial - it would be too confusing right now.

I’m also having problems with the brown-out detection on the micro-controllers inside the power supply channels, which randomly screws up the calibration. I think it would be better to have the Pi store this data, and poke it into the channels at start-up.

I think if I were designing the channels again from scratch, I would change the voltage regulator design. Using an N channel MOSFET as the pass element means the gate voltage must be a few volts above the output. This then means the analogue circuitry and the gate needs to run at this higher voltage, and so the opamps are all 40V parts. This limited my choice of parts and made things more complicated.

If I was doing this again I would also use a floating bipolar supply for the analogue control circuitry, and make the positive output the ground for the control. This way the control circuit rides on the output voltage, and never needs to be more than a few volts above “ground”.

I originally designed the supply to provide sense terminals as well as output terminals. The problem was I just couldn’t make this stable if the leads were even 30cm long. Getting this to work would be a great feature, especially when coupled with the supply’s high accuracy.

Some great upgrades to tackle in the future. At least with the Pi your software upgrades can be trialled in-place. What is the next amazing project you’re working on?

Alas, work has me pretty occupied at the moment! But I’m slowly working through the restoration of a Phillips 115B valve radio from the 1940s for a friend. Valves are quite fascinating, although the circuitry terrifies me! Tag strip construction with 300V! I think it is pretty amazing that they can make a superhetrodyne receiver with just four or five valves.

I have a long list of things I’d like to learn about next, including some RF circuit design.

Well it sounds like we’ll be seeing some great projects from you in the future. Congratulations on your power supply, and thanks for sharing it with us.

Tom Biskupic

Tom Biskupic

Sydney-based maker and enthusiast, PKI software developer.