loading

In this instructable I'm going to show you how to convert an old ATX power supply to a bench power supply that also displays the current drawn for each voltage rail on an LCD display.

Features:

The PSU uses a 20x4 LCD display to show the current readings for every voltage rail. But because the screen is too small to fit all five readings the same time, a momentary switch is used to select between viewing the currents from the 5V, -5V and 3.3V rails or from 12V and -12V rails.

A second momentary switch is used to turn on or off the backlight of the LCD.

A third momentary switch is used to power on the PSU or put it into stand by mode. In order for the microcontroller to been able to do that, it needs to have power even when the PSU is into stand by. For that reason it is powered from the 5V Stand By signal of the PSU. That way even when the PSU is into stand by mode the microcontroller still has power.

The microcontroller also monitors the Power Good signal and until it goes high it displays four stars "* * * *" on the screen to indicate to the user that the PSU is not ready. Also, the microcontroller starts to read the current sensors only after the Power Good signal goes high.

Step 1: The Parts

The parts you need are the following:

  • 1 x ATX power supply. It can be any old (or new) ATX PSU.
  • 1 x resistor with 10W rating (for older PSUs) or 1 x 22Ω resistor with 10W rating (for newer PSUs). If you can't find 10W resistors you can also use two 10Ω resistors with 5W rating in parallel, or two 47Ω resistors with 5W rating. If you are not sure if you need a 5Ω or a 22Ω resistor don't worry I'll explain it further later.
  • 6 x Female banana connectors. One for each of the voltages of the PSU plus one for ground.
  • Heat shrink tubing and electrical tape.
  • 1 x 20x4 character LCD display.
  • 4 x Female to female brass standoff spacers plus 8 screws for them. Alternatively you can use 4 female to male spacers plus 4 screws and 4 nuts.
  • 3 x Momentary switches.
  • 5 x ACS712 current measuring modules. There are three types of ACS712 modules. The 5A type, the 20A and the 30A. Personally, I used two 5A, one 20A and two 30A modules because my PSU can deliver a maximum of 28A on the 3.3V rail, 35A on the 5V, 16A on the 12V, 0.3A on the -5V and 0.8A on the -12V. But the problem is the higher the maximum current the hall sensor can measure the lower its sensitivity, and that leads to lower resolution of the measurement. So, when you use a 30A module to measure small currents the reading can be very inaccurate, I'm taking about ±75mA of error. For that reason even though your PSU most probably can deliver way more than 5A in most of its rails I recommend using the 5A modules for all the rails because most of the time when we work with electronics we don't work with high currents, so it is worth to have better resolution than been able to measure currents more than 5A.
  • Several female to female jumper wires.
  • 4 x 1K Resistors with 1/4W rating
  • 1 x 10K Resistor with 1/4W rating
  • 1 x 10K Trimmer pot
  • 1 x 220Ω Resistor with 1/4W rating
  • 1 x 8Mhz Crystal
  • 3 x 2N3904 Transistors
  • 2 x 22pF Capacitors
  • 1 x 100nF Capacitor
  • 1 x 2.54mm 40Pin male 90° angle pin header: You are going to cut it in 3 pieces of 2 pins, one of 6 and one of 5.
  • 1 x 2.54mm 16Pin male pin header for the LCD display if it doesn't already have one soldered: If you can't find one in that size you can get a bigger and cut it.
  • 1 x 2.54mm 16Pin female pin header: If you can't find one in that size you can get a bigger and cut it.
  • 1 x PIC16F876A microcontroller in SPDIP package: You can use a SOIC or SSOP package if you want, but you will have to modify the schematic and the board layout.
  • 1 x 72x50mm PCB photoresist or bare copper board plus all the materials need to etch the PCB depending on the etching method you are going to follow. Or, if you prefer not to etch a PCB then you can just use a prefboard.

Step 2: Making the Controller PCB

The next step is to make the controller PCB. Here you have two options, you can either etch a PCB based on my PCB layout, or you can solder the components on a prefboard and make all the connections by yourself according to my schematic. Personally, I suggest the first option because the end result is going to be much better and the circuit will be much more reliable.

Because this is not a tutorial on how to etch PCBs I'm not going to get into detail on how to do the etching, there are already many tutorials on the web if you want to know.

Now, about the soldering part, there are some things you need to be careful.

First of all, note that the microcontroller and the 3 transistors must be soldered on the copper side of the PCB. But on the other hand, the pin headers and the crystal must be soldered on the non copper side. As for the resistors, the capacitors and the trimmer pot you can solder them either side you want.

Apart from the components, you also need to solder directly from the PSU on the PCB the 5V Stand By signal (purple cable), the Power Good signal (gray cable), the Power On signal (green cable) and the Ground signal (black cable). Be sure to use heat shrink tubing where possible.

Note that if you have an ICSP programmer like PICKit you don't have to worry about programming the microcontroller yet. You can solder it and program it directly on the PCB through the ICSP header. However, if you don't have an ICSP programmer you need to make sure to program the microcontroller before soldering it. Jump to Step 5 if you want to read about programming the microcontroller.

Step 3: Assembling the PSU

Now that you have all the parts you need, it's time to prepare the chassis of the PSU to put the LCD screen, the switches and the banana connectors.

First, you will have to make six holes big enough to fit each banana connector. Then, you need one big square hole to fit the LCD screen plus 4 small holes for the screws of the spacers. Lastly you need 3 small square holes for the momentary switches.

The next thing you need to do is to mount the banana connectors to the chassis. Be very careful any metal part of connectors not to be in contact the chassis because it will make a short circuit. After that you need to screw the spacers on the 4 holes around the big square hole you made for the LCD display.

Next step is to screw the LCD on the top of the spacers. Make sure the copper pads of the mount holes make good contact with the spacers and the screws because you want the ground of the LCD to be connected to the chassis. Some LCD modules also have one or more jumpers that need to close in order to connect the ground of the PCB to the chassis. On my LCD these jumpers where called J1 and J2. You need to put a bit of solder to close them.

After screwing the display into place you can connect the female pin header of the controller PCB to the male pin header of the LCD.

Now you need to place the momentary switches in each of the three square holes. To easily connect them with the controller PCB you can use three half female jumper wires. Solder one side of each half with one side of every switch and connect the other side of the jumper to the pin header on the controller PCB. The other side of each switch needs to go to the ground. Because the chassis of the PSU is already grounded if you want you can just solder it directly on the chassis. Keep in mind though that the chassis of the PSU has a very large thermal capacity so try to use a bigger tip with your soldering iron than the one you normally use and set it to a higher temperature. Finally, put some hot glue to protect the switches from vibrations.

Next, you need to attach the current sensors to each rail of the PSU. To do that you can remove the plastic around the two input pins and directly solder the one of the two pins on each banana connector (except of ground). Be very careful any module not to touch the chassis.

On the other input of each sensor module solder the cables of each rail of the power supply. The yellow is 12V, the red 5V, the blue -12V, the white -5V and the orange 3.3V. For maximum current capacity on each rail tie all same color cables together before you solder them on each sensor input, but preserve one 5V cable because you are going to use it to power the sensor modules and one more 5V or one 12V (depending on your power supply) because you are going to use it to connect the dummy load resistor. You also need to preserve two ground wires.

Now you just have to connect all the GND pins of the sensors with the one of the two ground cables you preserved and all the VCC pins with one 5V cable you preserved. For this purpose you can use ten half female jumper wires. Finally, connect the five OUT pins of the sensors with the pin header on the controller board using five female to female jumper cables.

Lastly if your PSU has any exposed metal areas that might come in contact with the controller board put same electrical tape to insulate them. For example in my PSU there where two large heat sinks that where almost touching the controller board. So for safety I put same electrical tape on top of them.

Step 4: Adding the Dummy Load

Because the ATX PSUs are switch mode power supplies they require a minimum load in order to be stable. The load needs to be on the rail that the PSU has the maximum current capacity. That is typically the 5V rail on older PSUs and 12V on newer PSUs. To figure out were you should connect the dummy load resistor simply check were your power supply can supply the most current. For example my PSU can supply a maximum of 35A on the 5V rail and 16A on the 12V rail, so I connected the dummy load between 5V and ground. Most PSUs require a minimum of around 5W of load in order to be stable. So you need either a 5Ω resistor on 5V or an 22Ω resistor on 12V. The resistor needs to be rated at least 10W otherwise it might catch fire.

To connect the resistor solder one of its leads with the 5V or 12V cable you preserved (depending on you PSU) and the other lead with the ground cable you preserved. Don't forget to use heat shrink tubing to prevent any shorts. To secure the resistor in place you can use some hot glue. I recommend putting the resistor as close to the fan as possible because it's going to release a lot of heat.

Step 5: Programming and Calibration

When you are finished with the hardware part of the PSU it's time to program and calibrate the controller board. To do that you are going to need an ICSP programmer. If you don't have an ICSP programmer you could program the microcontroller before you solder it on the PCB but you will not be able to do any calibration.

To compile the code you need to have installed the MPLAB X IDE and the XC8 compiler, so make sure that you have both installed.

The full MPLAB X project with the source code can be found on Github. If you have Git installed on your system you can simply clone the repository on a local directory by running the flowing command.

git clone https://github.com/magkopian/pic-atx-psu-controller.X.git

If you don't have Git installed you can download the latest release from the releases page. If you do it that way make sure to rename the project folder from pic-atx-psu-controller.X-x.x.x to pic-atx-psu-controller.X otherwise MPLAB X might give you an error when you try to compile the code.

To program the microcontroller using a programmer supported by MPLAB X such as PICKit 3 it's very straightforward. Just connect your programmer with the ICSP header of the controller board, open the project using the MPLAB X IDE and then hit the "Make and Program Device" button. If your programmer does not fit inside the PSU you can connect it to the ICSP header using jumper wires. In case of a PICKit you just need five female to male jumper wires. Also, make sure the PSU has power before you try to program the microcontroller.

If you don't have a programmer supported by MPLAB X IDE you need to only compile the code without programming the microcontroller to generated a HEX file. When you have the HEX file you can use the software that comes with your specific programmer to burn it to the microcontroller. To only compile the code without programming the microcontroller just hit the "Build Project" button. After that you will find the HEX file inside the project folder in the subdirectory dist/PIC16F876A/production/.

To calibrate the PSU you simply have to edit the values on the lines 75 and 76 inside the file main.c before you compile the code. If have only used the 5A modules a good starting point is to use 0.0350 as a multiplier and 17.955 as subtractor for all five sensors and compare the current measurements of the PSU to a multimeter. Keep adjusting the multiplier and subtractor and reprogram the microcontroller until you are satisfied with the measurements.

<p>Hello,</p><p>Observing that you've used the ACS712 to measure a <br>negative current, e.g. on the -12v rail, I'm wondering if I can use the <br>same device to measure the current drawn on the negative rail of an <br>audio amplifier? If so, how did you connect the ACS712 to the negative <br>rail?<br></p><p>Many thanks for your time,</p><p>Ian</p>
<p>The ACS712 chip is a hall effect current sensor, it measure the magnetic field produced by the electric current that passes through the IP+ and IP- pins. The direction of the current is what determines the direction of the magnetic field, and by measuring it the sensor can determine the direction of the current.</p><p>So, to put it simply as long as the sensor is in series with the power source and the load, it doesn't matter the way you connect it. It will just give you the opposite sign than what you'd expect, just like when you measure current with a multimeter and you put it the other way around.</p><p>You can find more information in the <a href="https://www.sparkfun.com/datasheets/BreakoutBoards/0712.pdf">datasheet</a> of the ACS712.</p>
<p>Hello,</p><p>Many thanks for your reply. I now know that I can use the ACS712 on the negative rail to measure current and obtain a positive ADC value depending upon the connection. Thanks for sharing your work.</p><p>Thanks,</p><p>Ian</p>
<p>Awesome instructable as allways Manolis! made my own!</p>
<p>Welcome to the club: Just a note to let you know I have added this instructable to the collection: Encyclopedia of ATX to Bench Power Supply Conversion</p><p>&gt;&gt; <a href="https://www.instructables.com/id/Encyclopedia-of-ATX-to-Bench-Power-Supply-Conversi/" rel="nofollow"> https://www.instructables.com/id/Encyclopedia-of-A...</a></p><p>Take a look at about 70 different approaches to this project. This topic is one of the more popular of all instructables.</p>
<p>Yeah, reinventing the wheel is pretty much beating a dead horse by now. People were converting computer PSU to bench supplies long before instructables came along.</p><p>This one is a little more advanced than some but it still has two fatal flaws. 1) A terrible quality PSU was chosen as the host. Sure it will be capable of low current but to spend all the time on a PSU that never should have been in the market in the first place due to its fraudulent specifications? No.</p><p>2) If you're going to design with need for a fan to cool it, use a good fan instead of the one used.</p><p>Aside from these issues, it would make a fair bench supply if you ignore the original specifications, derate by ~60% using a better fan or derate by 85% and omit the fan. However, on a bench rather than a generic one off PSU mated to the load's needs, this is far too noisy an output. For bench you generally want the cleanest power possible while this is closer to the dirtiest regulated PSU available.</p>
<p>Do you know of a good write up somewhere to make a better bench supply? Capable of some amperage<br><br>And if there is another write up of a cleaner supply, could I still implement the monitoring portion of this project to display the amperage/voltage?</p>
<p>There are a lot of these, but I am always happy to see a new one with some new ideas, this one has them and is worth a read.</p>
<p>EXCEPT at low % load relative to the specs. It's all about context. If you never need a high load then a PSU capable of one would be overkill BUT the fan is still an issue, that if it needs the fan it should have a better quality fan.</p>
<p>As for the fan, I did not use an extra fan to cool the PSU. The fan you are seeing is actually the stock fan of the PSU, I just moved it from inside of the case to the outside because the space was very limited and I could not fit otherwise the current sensors.<br><br>So far I don't have any overheating issues, but if I notice something I will sure use a better fan that its stock.</p>
<p>Thanks for the input, I really appreciate your feedback. Of course a converted ATX PSU is never going to replace a proper bench power supply. But depending on how you plan to use it, it may be OK for the job. <br><br>Me for example, I work mostly with low power electronics (microcontrollers most of the time), and very rarely I have to work with something that needs more than 1 Amp. So for my particular needs an ATX PSU is fine to use for prototyping.<br><br>Another nice thing about ATX PSUs is that they give you multiple voltages to work with and that may be very handy in many situations (e.g. when you work with dual rail opamps). But the main advantage of an ATX PSU is the cost, since you already have it you only need to spend very little to convert it to a bench power supply, and also it is something fun to build.<br><br>In my opinion for a hobbyist or a student that mostly works with low power electronics converting and using an ATX PSU as a bench PSU is fine. On the other hand, if you are a professional don't even bother with it, do yourself a favor and buy a proper bench power supply. The last thing you want to do when you are actually making money by working with electronics is to waste time debugging you own tools when something goes wrong. But if you are a hobbyist or a student it's not a big deal.</p>
<p>That's awesome, thank you!</p>
<p>Thanks for sharing &Mu;&alpha;&nu;ώ&lambda;&eta;!</p>
<p>Can i just use an Arduino for the microcontroller?</p>
<p>Well, in theory of course you can, Arduino is just a microcontroller after all. But if you do, you will also have to rewrite the whole firmware by yourself. If you use the same microcontroller I used, you don't need to write any code you just need to compile my code and burn it to the microcontroller.</p><p>Also if you use an Arduino, don't forget that you will also have to redesign the PCB by yourself, since the pins of an ATmega328 don't much the pins of a PIC16F876A. But since I have published the Eagle files this should not a big issue. Maybe, you could be able to get away only by making some modifications to the original files.</p>
<p>written in C code?</p>
<p>Yes.</p>
<p>Thanks, I thought arduino sketch was written in C, yet again my knowledge of programming are limited.</p>
<p>thats great.... A useful project...I will try to make</p>
<p>TY for sharing, this cool Instructable gave me the kick I needed to finally make my own ATX PSU. </p><p>I didn't bother with the monitoring circuitry because I had some LED panel meters already, and I can insert my Fluke for current measurements if it becomes a need. </p><p>The other difference is that my PSU is built-in behind a panel in the bench in my work area, and so instead of using load resistors I just wired up a bunch of LED lighting for the workbench, so that when the supply is on, the bench is lit. Saves having to worry about cooling, and also solves the problem of running potentially hazardous mains leads around the bench for lighting. A single 5A blade fuse is inline with the line I kept for lighting supply just in case I put a craft knife or soldering iron through a lead somewhere. </p>
<p>PS: Having noted all the banana-plug type PSU conversions out there I have to say that I use a cheap screw-down terminal block for higher power connections, but for small breadboard projects etc what I have is a pair of push-lever type speaker terminals each for 5V and 12V. </p><p>A) I'm never going to draw that much current with my projects and B) I can use breadboard jumper leads to go directly from those terminals to the breadboard. Plus, these things are on the back of every speaker ever left in a kerbside hard rubbish collection so if I do splat one with a short or something, I have a dozen more in the junk box.</p>
<p>Glad to hear that this project inspired you to make your own PSU. Also, thanks for sharing the approach you followed, it was very interesting.</p>
<p>Nice instructable.</p>
<p>Just a point - the +/- 75 ma toerance at 30A is 0.24% - you should be happy</p>
<p>Yes, that was expected, you can't get anything better using the 30A modules. Choosing the module type is a tradeoff between the maximum current you can measure and the resolution of the measurement.</p><p><br>I just pointed out that when working with electronics you rarely have to work with more than 5A so it should worth it to make the sacrifice and use the 5A modules for all rails to get more resolution. When I made the PSU I haven't thought of that so I used two 30A, one 20A and two 5A modules. If I had to make a second PSU though, I would use only 5A modules.</p>
<p>These p/s are also handy to power a mobile amateur radio, or any car mobile 2-way radio.</p>
cool. great to see people are still using pic microcontrollers.
<p>Very Nice !!!!<br>Thanks For Sharing !!!!</p>
Well detailed and organized... I too thank you for sharing.
<p>I'm glad you like it!</p>
<p>This looks great! Thanks for sharing! </p>
<p>Thank you!</p>

About This Instructable

48,285views

702favorites

License:

More by magkopian:Raspberry Pi Zero HDMI / WiFi Soldering Microscope SMD Decade Resistance Box Voltage, Current and Resistance 
Add instructable to: