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.
The new supply
For my new supply I had the following requirements:
- Small, so I can cut some holes in the ATX case and maybe squeeze the whole thing inside (or build a small custom case).
- Adjustable, I want to be able to turn a knob and have a nice range of power (I can get 1.5-almost 11volts. Then there is a separate terminal with the 12v line directly from the ATX supply).
- Feedback, I want to know what voltage the adjustable output is set to, and I also want to know how much current is being drawn. I decided to use a 16×2 LCD display for this.
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 16×2 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.
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.
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.
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 .01Ω current shunt resistor, and a Texas Instruments INA139. 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 .01Ω 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 100kΩ resistor to set the gain to 100x.
Bill of materials
- Single row .1 inch headers (both male and female)
- 3mm led
- Bourns 3266W Trimpot
- Alps RK09K1110 Trimpot A 2k trimpot would be better, but the symbol on the board may need to change
- LM338 voltage regulator (with heatsink, and thermal paste)
- 2×16 LCD display
- Arduino micro
- 2 Current sense resistors .01Ω 1206
- 39-30-1200 molex header for ATX input
- Female ATA molex header for hard drive power input (optional)
- Axial (0.3) resistors: two 100kΩ, 1000Ω, 240Ω, two 140Ω, and two 100Ω
- Two INA139 current shunt monitors
- One slide switch, I just jumped the switch with a wire so it is always on when the power is applied, because I didn’t have the right switch…
The next step would be to stick it inside an ATX case, or I might try to design a new laser cut acrylic case that will hold the ATX PCB, as well as this PCB with mounting holes for the LCD display, binding posts, potentiometer, etc… But for now I will let it sit on my desk top as is.
For the record, here is a photo of my old ATX power supply which I will be retiring now.