I said last time I would look at the software and firmware for this post but I decided I needed to spend more time on the regulator to address the DC response issues I had observed, I felt this was more important to get right so this article focuses on that. The good news is, I have achieved good results and I believe the regulator design is complete – at least for the high current version of the module (0-8V 0-8A).
I had problems with the regulator over shooting by about 500mV when transitioning from a high power load to a low power load. There were two main problems, the first was down to the inductance of the wiring on the output, that creates a problem which in turn was amplified by the relatively slow response of the various amplifier stages. I have achieved significant improvement on my previous measurements by tuning response times through the various stages, this simply required lowing the impedance through the various stages to ensure the servo was able to respond more quickly to changes on the output. This was achieved by adding C24, C25, C39, C40, C41, C43, C45, C46, C47 and C48 to the input and driver stages. I also needed to throttle back the fast rise time of the control drive from the DAC to follow behind the response curve of the regulator circuit. These changes mean the regulator now delivers a clean and very acceptable dynamic response to fast-switching load conditions.
Here is the latest schematic which is at version 0.7 including all of the latest changes. The most significant changes are on sheet 3.
I now need to lay out the new PCB and get some ordered, I will do this over the next couple of weeks. I will definitely cover the development environment and the firmware in the next post as well as the serial protocol used to control and monitor the module.
It took a while to decide on the final form factor, I wanted to consider cost and ease of mechanical construction before committing to a layout for the PCB. My original design goal was to make a completely self-contained module for a single fully isolated channel of programmable DC power and my thinking was extending to thermal management. My original idea was to rely on the module to be thermally fixed to a heat sink which could be decided upon by the builder. However, heat sinks are expensive usually and construction would depend on what heat sinks you may have to hand so I thought it would be nice to make this more flexible and use components that are easy to find and obtain for very little money. As a general rule, if you can buy something off the shelf this is always going to be cheaper than making your own, and if you can use off the shelf components that are mass-produced then all the better. I got to thinking about the heat sink I needed – force air cooled and able to handle 100 watts of dissipation in a small space that is mass produced, with a built in fan that can be controlled for quiet and efficient operation, is commonly and easily available, is of standard physical construction, good quality and cheap to buy – enter the common PC CPU Cooler, which meets all of those criteria.
So thats what I have done, I have built the PSU module into a form factor that easily accommodates the CPU cooler and still remains 100% self-contained. The built module with all required power components, mechanical construction with heat sink and cooling fan measures only 150mm wide by 80mm deep by 90mm tall. All you need to make it work is a mains transformer, four 4mm banana output jacks and something to control it via a serial interface.
I have updated the article to include the schematics which I had previously omitted.
The PCB is made with 2oz Copper to handle current and provide better thermal mass. The high power path is run 5mm thick tracks (minimum) and run on both sides of the board. Where possible the top and bottom tracks are joined at the through-hole pads for the power components which is everywhere except at the current shunt resistor. For this I have many small via’s connecting the top and bottom traces to handle current and thermal bonding.
The BODGE WIRES
In laying out the PCB I forgot to pay attention to the star earthing I had set out in the previous post. The impedance of the ground path makes a big difference when you are looking at the lower 1mV of the range. Using DipTrace I had to use a ZERO ohm resistor to properly segregate GND and GNDANALOG nets, but I physically routed to the GND side of that resistor to the wrong point. I done a pretty similar thing on the low-side current sense connection. As a result there are two bodge wires on the board (see photo below). The first is the GNDANALOG to GND connection – Instead of installing R79 (which is ZERO ohm) I have taken a wire from the bottom pad down to the low-side of the current sense resistor array. The second is slightly more difficult to do, I had to cut the track from the top pad of R82 and then again take a wire down to the low-side of the current shunt resistor.
In order to manage the thermal properties of the module, the firmware simply uses the temperature measurement of the heat sink to set the fan speed calculated on the following basis: –
below 25 degrees centigrade – FAN is idle at its lowest speed (0% PWM)
25 to 50 degrees centigrade – FAN is driven with variable PWM 25 degrees = 1%, 50 degrees = 100%, which is a rate of 4% per degree of temperature rise
more than 50 degrees centigrade – FAN is driven at 100%
Controlling a 4-wire fan is pretty easy, the specification developed by Intel describes the electrical interface and requirements for both fan control as well as fan manufacturers. I have added it as a download on this page for convenience. The fan I tested and used in the video above runs at about 1500 RPM to 3400 RPM with a 0-100% duty cycle on the PWM control signal. The taco output is open collector and provides 2 pulses per revolution.
Intel 4-Wire PWM Controlled Fan Specification 93.83 KB
Next time I am going to *try to* characterise the PSU. I don’t have much experience doing this which is why I say I am going to *try* – none the less I should be able to pull together some basic specs and test conditions.
Following that I am going to design and make a front panel controller for the PSU. Although I am making this specifically for this project I am thinking about making this more generic so it can be used in other systems and/or test equipment. The basic goal is to create a single PCB front panel with a 4×20 VFD display, some buttons and controls, a micro controller (PIC32 or maybe ARM) with RS232, USB, Ethernet (and possibly a GPIB interface module) with 3-4 independent TTL level internal serial interface channels (to connect to PSU modules for example). Don’t know, all just thoughts at the moment, we shall see…
After my initial tests there are two things I now know for sure. The first is I cannot treat the DAC like a programmable voltage source, it’s not going to be accurate enough and secondly, because of the INL of the DAC the resolution needs to be high enough to give me headroom to “trim” the DAC to the correct voltage. On this basis there really are only two practical options to achieve the goal.
The first option is to use a mapping table. Assuming I have a DAC with enough resolution it would be feasible to build some form of calibration rig which could step through each desired voltage then trim the code written to the DAC to get as close as possible for the resolution of the DAC and store that number in a table which can then be written to micro controller as a lookup table. The problem with this approach is its messy, and it would mean that if the calibration was lost in use it would need the calibration rig to re-calibrate it. This is not an ideal solution.
The second option, and the one I will take forward is to build a system where I have an ADC and a DAC and the system is configured so I can read the DAC output. When a given voltage it programmed the ideal DAC code is written to get within a few millivolts of the desired output; and then a software loop is used to trim the DAC code up or down as required to get as close to the required output voltage as possible. If the PSU is to measure up (no pun intended) then it needs a metering function regardless so all I need to do is design the system so I can switch the ADC’s inputs to the DAC for the calibration cycle.
The ADC needs a good resolution, it needs to be accurate and it needs to be low cost. The conversion speed is also important, if its too slow the calibration cycle would take too long to complete. I found a good part for this in the form of the LTC2402 Delta Sigma ADC device from Linear Technologies. I must say at this point that Linear Technologies design support is really great, they have been kind enough to furnish me with sample devices which I have been testing in the design. I have also tested a couple Analog Devices parts too and they were also kind enough to furnish me with sample devices, and these were very close in performance and a bit cheaper too (so not excluded just yet) but for performance in this application Linear Technologies parts so far have the edge – I will talk more about that later on and in future articles because I have tested a few different DAC’s and ADC’s. The following schematic shows the digital control circuitry which is extended to include the ADC chip and a 74HC4053D analogue switch which is used to switch the input of the ADC from monitoring the PSU regulator outputs to monitoring the outputs of the DAC for calibration read-back.
One of the interesting attributes of the ADC chip is it’s a two channel ADC, but in reality though it is actually a single channel ADC with a two channel multiplex on the front end so it samples each channel alternately. This made for an interesting problem to solve because the calibration loop needs the conversions from the ADC to be as fast as possible. The chip its self can only perform a maximum of 6.2 samples per second according to the data sheet, but because of the input multiplexer it can only actually achieve 3.1 samples per second per channel. For normal monitoring three updates per second is acceptable but for calibration I wanted better performance. I configured the analogue switch so in calibration mode I can use both inputs of the ADC to monitor a single channel of the DAC which gives me a calibration loop speed of 6.2 trim and read back per second.
Unlike the DAC, the INL of the ADC is significantly better mainly due to the nature of how it works. The architecture is a switch capacitor system which unlike laser cut resistor strings the charging and discharging of current into a capacitor is significantly more predictable and linear.
PLEASE NOTE: The LED flash is continuous but the video frame rate make it looks like it stopes and starts – which is does not.
In software I have tired two different calibration schemes. The first is the simplest, it sets the ideal code for the target voltage, measures the output of the DAC and does a calculation to determine the difference between the ideal code and the actual code required, then applies this. The second scheme is more complicated. It is the same as the first scheme but then with a second phase of micro trimming which essentially sets a window around the centre point and then adjusts the codes in steps re-reading the output; you can think of this as an electronic/software version of someone turning a variable resistor while watching a meter to get a precise voltage. The second scheme also takes more time as it needs to perform multiple read-backs in order to complete the trim cycle. I have limited the trim cycle to a maximum of eight iterations, in practice it seems to take between 2 and 7 most of the time.
(P.S. The command ‘pr’ means “property read”, it reads the EEPROM configuration of the module)
I re-tested with the spot voltages in the previous blog post and the bottom line is, 14-bits is not enough. The MCP4922 is great for the $$ but its not good enough for this project so I will not bother creating another spot voltage table for this variation, that’s a waste of time given we have established the DAC is just not up to the job. In the next article I will try out two 16-bit DAC chips, one from Analog Devices and the other from Linear Technology.
Now the overall high level system design and parameters are set (see Part 1), its time to get down to some practical design. As I specifically do not want to use one of those “out-of-the-box” all in one regulator chips the first thing we need is a working linear voltage regulator that we can build upon. Using the prototyping breadboard I created the following circuit. The objective was to set up and verify the DC conditions for a basic regulator. Unlike a classic regulator circuit where there is typically a fixed reference and a variable resistor (POT) in the feedback loop, this regulator calls for something slightly different because our micro controller and appropriate DAC will generate an accurate reference voltage between 0 and a couple of volts, the exact value of which will be set by the user; the regulator circuit must track this reference voltage and set its DC output to a multiple of that reference.
The following schematic shows my initial 30 minute attempt at building such a regulator.
I should state at this point that the circuit is basic and is missing lots of things that one would expect to find. The purpose of this initial design was not to create a perfect regulator but was to setup a circuit to verify the basic DC conditions and theoretical practicality of the circuit.
The circuit is built around a FET pass device (type IRF540) which is the power workhorse. Unregulated power into the drain with the load placed on the source. The op-amp is configured as a simple error amplifier. The op-amp will move its output up or down (depending on the input state) in order to get its two inputs as close together as possible. Because the op amp drives the power device and the negative input of the op-amp is derived from the output that the power device we have a closed loop servo circuit and this is in essence what a typical regulator is made up of.
Because of the closed loop nature and the tight feedback loop, one of the biggest problems with these types of control circuits is stability. Each component and any introduced capacitive or inductive loading will create phase shifts (all components exhibit parasitic capacitance and inductance). Phase shifts will put the circuit into positive feedback at certain frequencies so there is a good possibility that such a circuit will become an oscillator at certain frequencies. As a consequence, a great deal of attention needs to be paid to this problem in the design which needs to ensure that it works reliably and remains stable within the scope and specs of the requirements. The more voltage and current range required the more difficult it is to tune the circuit to be stable of the range. Component choice, DC conditions, speed/bandwidth, gain, noise and PCB/Track layout all matter a lot here. It’s for this reason that many power supply designs avoid discrete solutions in favour of a one-chip solution. Discrete regulators are hard to make, and even harder to make reliable and stable and to be honest, most people cannot be bothered when there is a $2 off the shelf IC that will do the job most of the time. However, a professional grade programmable bench power supply needs something more than what these one chip solutions offer.
Considering the breadboard approach to building the above circuit (see photo) under moderate loads the regulator circuit was pretty stable, actually I was very surprised just how stable it was.
I thought I was on my way but very quickly realised I was actually on the wrong track. The reason why this design is stable is because it does not have much gain, in fact it has a gain of just 2. So put 2 volts into the V_REF input and get 4 volts out. The driver transistor Q1 is in effect a current amplifier in this configuration – the op-amp has to swing its output pretty much the range of the desired output. For low voltage requirements where you con comfortably run your entire circuit from a single supply this is a very good approach because of the inherent stability of the circuit. However, this design requires a regulated output of 0-30v which would require the unregulated input voltage after the rectifier and reservoir caps to be about 45 Vdc. Not many op amps can run at this level, and those that can are only just within range so we would be right on the edge of the spec for the device which does not make for a robust design and I personally don’t like components being pushed to their limits – it feels wrong, a bit like driving your car continuously in the red like, you can do it but not many people want their car to scream like that all the time.
In order to facilitate ease of use and the modular design I have set out to achieve, I want to create a regulator module that runs from a single AC power source, a single winding from the mains transformer. Many bench PSU’s (for example, like the Agilent E3631A I recently repaired) have multiple internal power supplies where the control circuitry is powered separately from the main power source. This makes it easier to design for higher regulated voltages and helps with things like noise immunity too but because of the design goals I have set it’s not an option for this design.
The design needs to take into account some system design constraints. No split supply for the op-amps, so we need to use single-supply capable devices. The op-amps and control circuitry need to run at a much lower voltage than the pass device and regulator output and the only way that is possible is by introducing voltage gain outside of any op amp. Voltage gain using an emitter follower (or equivalent approach) provides the level translation needed and lots of gain but that’s where the stability problems start.
In Part 3 I will describe the next evolution of the regulator circuit where I introduce gain and a considerable amount of instability and start to formulate a workable solution.
After fixing a high quality power supply (see here if you are interested) it spurred me on to have a go at designing and making my own – I think anyone who does electronics as a hobby will at some point or another build a power supply to use on their bench – I have not done that myself before so I thought I would give it a go. My aim is to use my basic understanding of analogue electronics and create a fully programmable bench PSU that will perform at least as well as the Agilent PSU, I think this aim is reasonable on the basis that todays components are considerably better than those that were available 20 years ago. Apart from the performance characteristics, there are a system engineering characteristics that I also want to consider because I would like to make it possible for anyone else to build this PSU as a DIY project with the ultimate aim of creating a high quality PSU that is modular and can be built in various configurations and be built at a hobby user or small lab price point. Here is a photo showing the very first working prototype regulating at 5.010 volts.
Why a PSU project, there are hundreds of them already? Firstly, the two areas of technology I really enjoy are electronics/embedded and software development and this project requires a fair amount of both to be brought together. Apart from that, no other reason than because I think I can do a decent job – we shall see 🙂
I thought it would be a good idea to try and set out what I have in mind. My aim is to create a modular PSU system designed to be used in lab or test automation environments. The first thing I want to create is a module similar in concept to those audio amplifier modules you can buy for building a HIFI amplifier, the module will physically look something like this.
The PSU module will take a single AC input from your line transformer of choice on its input and will provide a fully programmable lab quality Constant Current/Constant Voltage regulated DC output. The module its self will not have any kind of controls or display, but instead will have a fully isolated serial I/O which will be connected to a controller with the idea being you can create a multi-channel PSU with isolated outputs while also providing a single earth referenced controller that can be safely connected to a computer or other test equipment in test automation environments. Once I have created these modules, my intention will be to make a a few variants of controller, an RS232 interface and a PC software controller, a simple stand-alone control board with an LCD display and a couple of rotary encoders to control a single module and a more comprehensive control board that can control up to four modules with a nicer display (TFT/VFD?) and other interfaces such as RS232, USB and Ethernet to create a full function standalone multi output bench PSU.
Focusing back on the PSU module, I would like it to support a number of configurations with just a few component changes, primarily this is to allow different voltage/current ranges and resolutions to be selected to suit different requirements.
The headline specs for the regulator module are as follows: –
Over voltage, over current, reverse power and short circuit protection at all power levels
Optional on-board pre-regulator to lower the modules heat dissipation for higher voltage ranges
On-board temperature monitoring
Fully isolated serial interface for programming, control and monitoring
Control resolution down to 1mV and 1mA in low voltage range
There are also some system engineering constraints I want to apply, these are: –
Low component count
Easy to source low cost components
Easy to build DIY
Physically robust construction
One single PCB design for all voltage range configurations
In terms of my design approach, and I must state at this point that I am no analog electronics expert, I really just have a passing understanding. None the less, I want to avoid using the easy option in the form of the classic single package regulator IC’s that most DIY PSU builders use. LM317T, LT3080 and the like. These are great components, don’t get me wrong, but what you don’t get with these is a professional grade PSU without putting a significant amount of other electronics around them, by which time you have pretty much lost any advantage you have gained over using discrete components. Apart from that, one of the main drivers for this project is to learn more about building this kind of project and to share that learning with others.
In Part 2 I will describe my first attempt at building a discrete linear voltage regulator, with a schematic of the first working circuit along with a description of what I found along the way.