Everyone has hacked their ATX supply to provide a crude and cheap bench top supply. However at work I have a "real" bench top power supply, and it is really nice to be able to adjust the voltage with a simple turn of a knob, and it is also really nice to get feedback on the amount of current being used.
I have been using a hacked ATX supply for a while, and it usually gets the job done, but it could be much better of course.
For more details and the latest updates see my blog about this project.The new supply
For my new supply I had the following requirements:
With this in mind I came up with a small board that has 2 terminal pairs on it. One pair for ground/12v and one pair for ground/adjustable voltage. The adjustable voltage uses a 2k potentiometer and an LM338 voltage regulator to set the output voltage. The heart of the system is an arduino, and an 16x2 LCD display, with binding post/bananna plugs for access to the voltage. The final assembled unit is shown above.How it works
The remainder of this post will discuss how this thing works, from the input all the way down to the output. Full source code and schematics can be found on github.Input power
There are two possible input powers, one is a 20pin molex header found on all ATX power supplies. The power on line from the ATX header is connected to ground, so no modifications to your ATX supply are required to use this board, just plug it in and turn it on.
If you donít have an extra ATX supply around, and just want to use the one in your PC then you can hang a 4 pin hard drive power line from your PC outside your case and plug it into the 4 pin hard drive supply (not populated in the above photo, but it would go directly next to the 20 pin header).
So there are 2 options for powering this thing, 20 pin ATX, or 4 pin hard drive power cable.Voltage and Current sense
This power supply uses an Arduino Micro to drive the LCD display and to sense the voltage and current with a few analog inputs.Voltage sensing
The Arduino analog pins can only go up to 5 volts however on this board the voltage may be as high as 12 volts, in order to safely sense the voltage that is being provided a simple voltage divider circuit is used, with the resistors I have chosen the voltage is divided by 2.5. So 12 volts comes out to 4.8volts on the analog input. Then in the arduino software I scale the input from 1023 down to 5.0v (AREF) and multiply by 2.5 and that gives me 12 volts, and the same formula works across the whole possible voltage range.Actual Voltage = (AnalogPin * (AREF / 1023)) * 2.5
In the above schematic you will notice that I connected the AREF to the 5v input from the input power cable, I was thinking that it would provide a better AREF than the arduino, but after playing with it for a while I finally decided to cut the AREF line and just use the internal AREF, and now I get more stable analog inputs. In the rev 2.0 schematic I removed the AREF connection, but on the rev 1.0 board that I actually built: I just took a knife to it.
I also have the same voltage divider on the constant voltage terminal and it is also sensed and displayed just like the adjustable voltage. Even though it should always be ~12 volts, it is just nice to have a confirmation.Current sensing
Another pair of Arduino analog pins are used to sense the current on each power terminal. In order to figure out the current, I used a .01ohm current shunt resistor, and a Texas InstrumentsINA139. The INA139 is little more than an Op-amp with some built in resistors, and acts as a high side current shunt monitor.
The INA139 in effect amplifies the voltage drop across the resistor, and this is fed into the Arduino and then converted into amps with ohms law. The voltage drop across a .01ohm resistor is typically quite small (unless you are really pulling a ton of current). The op-amp basically multiplies the voltage drop so that it can be easily measured by an analog pin. The amount of amplification that the INA139 provides is set with a single resistor, for this project I used a 100kohm resistor to set the gain to 100x.