Introduction: Bench PSU Power Supply From Old ATX With Arduino and LCD Monitor
Hello all and welcome to my first Instructable.
I've always wanted a bench PSU for easy access to a power source, and something that I can rely on when working on various projects. I wanted a PSU that:
• provides 12v, 5v, and 3.3v outputs
• provides variable voltage outputs
• has an LCD monitor to show voltages
• doesn't cost too much
• looks good as well
Firstly, I have to have a disclaimer: PLEASE be careful when working with mains voltages. Keep all power disconnected whilst working with the power supply. I am not responsible for any damage, loss or any adverse effects that you may incur whilst doing this project.
All images are taken by myself, except the PSU pinouts which are from Google. The schematic diagrams are also mine, and so are the videos.
Now, on to the overall concept.
There will be multiple outputs on the terminals where you can connect patch cables, and there will also be banana sockets for easy hot swap of the modular cables we will be making, or for whatever you like. The LCD will monitor voltages and status of the power supply. There will also be 2 USB outputs which will be powered by the 5V standby so there is always USB power available (my 5vSB allows up to 2.5A so it is good enough for charging my phone). There will also have to be two potentiometers on the front panel to allow adjustment of the variable voltage modules. Four LEDs will indicate that each output rail is working properly, and finally there will be a big power switch.
Firstly I designed the control system based on an Arduino Nano v3 for the monitoring LCD to display voltages and status of the power supply. Next step was to design the circuit diagram to ensure all buttons and switches etc are in the correct places, including voltage dividers for measuring the voltages. I then designed the case for the project ensuring everything can fit on the size chosen, followed by building the case, marking out placement of all components, mounting all components, soldering them together, test running it all, and then the final steps.
Another thing which makes this design cool is that I will be making modular power connectors which can connect to any of the banana sockets for easy access to a variety of power outputs, and connectors.
(CHECK BILL OF MATERIALS EXCEL FILE FOR EBAY LINKS!)
Components you will need:
• ATX Power supply from old PC or brand new, your choice! (mine was 450W, depends on your requirements)
• 14-18 gauge wire, around 3-5m of it (I used thick speaker wire that I had lying around)
• 22/24 gauge wire (thinner one) for LEDs and switches
• Speaker terminals
• Banana post terminals
• Banana plugs
• Arduino Nano (or a variation)
• Arduino Nano terminal board
• 20x4 HD44780 LCD
• I2C module for LCD
• 120mm PC fan 12V
• DC step-up/down module (eBay)
• Momentary switch
Tools and materials you will need:
• Wire strippers
• Wire cutters
• Heatshrink tubing various diameters
• soldering iron and solder, obviously
• 5mm MDF wood (or your choice of wood)
• Small screws
• Hot glue gun! ;)
• Dremel for cutting out smaller holes/openings
• Sandpaper 120-200 grit, and a finer one 400 grit +
• Black spray paint
• MDF primer if using MDF
It is assumed you have a basic understanding of electronics and soldering, and basic experience with Arduino. I will try my best to help you if you have any questions. Sorry if I have missed out any steps or if something is not clear enough!
So let's begin!
Step 1: Create Design and Wiring Diagram
I used Microsoft Publisher to design the front, side and back panels of the final product. I chose to have 4 x 4 way speaker terminals, and 6 banana posts. I also added a grounding post for an ESD wrist strap for later use. The large angel eye momentary switch allows the PSU to power up and down, and there are 4 LEDs to indicate that each voltage rail is working. Finally the LCD displays voltages and PSU status.
IMPORTANT: To power the ATX PSU without a motherboard being connected, we need to cross the green wire with ground (black wire) on the 20/24 pin connector. The green wire senses if it's OK to power all rails, so this needs to be connected to ground in order to power on. Read on...
Attached are the schematic files which I designed in ExpressSCH, and there are also images of the schematic.
The Arduino detects changes on the interrupt pin D2, which come from the momentary switch, and then sends a high signal to pin D6 which activates a transistor, that connects the GREEN POWER_ON wire to GROUND on the PSU to allow it to power up. When the switch is pressed again, a change is detected on interrupt pin D2 so pin D6 outputs low, breaking the connection to ground and turning the PSU off.
Once I had this completed, I figured out the entire circuit diagram. The idea is to gather all the same coloured wires from the output cables and group them together, but leave one of each colour cable separate for extras, such as the USB power and ground for the Arduino, and most importantly for the input to read voltages. The 5V standby cable is the PURPLE one which will power the Arduino and the LCD, and also the USB ports, so even when the output rails are turned off, the monitoring system will still be active and looking for an input on the interrupt pin (for the power on button), and you can charge your phone without having the entire power supply turned on.
The Arduino has analog input pins capable of reading a maximum voltage of 5V - since we have 12V and possibly more, we will be using voltage dividers to allow a safe input to the Arduino. See the diagram for the values that I used - I was able to get an accuracy of +-0.05V on all rail readings. This is because of the 10-bit resolution of the Arduino's ADC - I noticed that the higher the resistor values you use, the less accurate your readings, so I tried to choose resistor values that were in between and gave me the best readings I could get. Feel free to experiment with different values, but be sure NOT to input more than 5V on any of the Arduino pins as this will more than likely damage your Arduino!
Voltage dividers do what they say - they divide voltage. For more information on this, check out this link: Voltage Dividers tutorial and calculator I used this calculator for aiding with choosing the correct resistor values.
Since there will be 4 LEDs for each rail, measure the voltage on each rail and then calculate the resistor value required to have all 4 LEDs light up at the same brightness. I chose 10mA for all LEDs (I chose blue 3V forward voltage). Calculator: LED Calculator
In my case, my power supply required that I connect a 3.3v (orange) wire to the brown wire, which I believe is the 3.3v sensing rail, as I used an older PSU. But until I did this, the power supply wouldn't stay on - it would turn on for a split second and then power down. So try connecting the green wire to ground, and if it doesn't stay on then you may need to cross a brown and orange wire, if you have a brown wire. Else it should power up. I soldered the orange wire to the brown wire.
Also, there is a gray wire which will output 5V when the power supply is turned on i.e when you connect the green wire to ground. This gray wire connects to the Arduino's pin D4 and the software detects an input on the pin, and displays 'POWER ON' on the LCD if it detects 5V or 'POWER OFF' if it detects 0V. That is how we monitor the status of the PSU. I also designed a rotating square block which shows that the Arduino is running and voltage monitoring is being updated. You will see this in the video.
You may need a load resistor across 5V to keep the power supply on - I tried this on mine but as mentioned, I was required to connect the orange and brown wires, and the load resistor was not an issue. If you do need a load resistor, please make sure it is rated for at least 10W, and 10ohm. I personally would recommend you add it anyway, but I didn't add one. I will probably add one after having completed this Instructable.
In the third picture, you see a protoboard with terminal blocks - I used this protoboard to solder the voltage divider resistors on to, and wired them to the terminal blocks such that all the different rails could connect to it with a common ground for measuring the input. Unfortunately I do not have a picture of this, but the protoboard simply has the voltage divider resistors on there. Wires come out from the middle point of the voltage dividers and go to the respective Arduino pin (refer to the schematic).
Once you know how you will be wiring it all, upload the code to the Arduino, the connect it all up and give it a test run before you go on to build the case. Feel free to modify the case as you require. I left a space on the base on the left hand side as I want to add an LED tester, which I haven't done yet, but I will be doing.
PLEASE NOTE: before uploading the Arduino code you need to change some parameters in the code - see the next step.
The video shows how the control system works; this was before I built the case.
Step 2: Editing and Uploading the Code
So firstly to get accurate readings we need to measure the output voltage of the PURPLE 5V standby cable, as this will be powering the Arduino and the LCD. When we will be calculating the voltage within the code, we must try to have accurate measurements as possible to try and increase accuracy of the readings. This can be changed at the top of the code file, as shown in the first picture.
Secondly, we need to setup the voltage dividers. The schematic on this page shows how to connect them up to the Arduino; it is an extension of the previous schematic. Voltage dividers do what they say - they divide voltage. For more information on this, check out this link: Voltage Dividers tutorial and calculator I used this calculator for aiding with choosing the correct resistor values.
The 3.3v line can be connected directly to the A0 PIN since it should never exceed 5v anyway, but can fluctuate sometimes up to 3.5v from my experience. When wiring the other lines through the voltage dividers, you must measure the resistance of each resistor with a multimeter, and change their respective values in the code - the value must be entered in Ohms. So for me, my R2 resistor was 1.8K for all the voltage dividers, and somehow every single one of the 1.8k resistors was 1770Ohms on my multimeter - in contrast, when I used a 12k resistor for the R1 resistor on the two variable voltage inputs, one of the 12k resistors was 11890Ohms, and the other was 11920Ohms - your mileage may vary. But it is really important to change the values of them.
To calculate the real input voltage from the PSU lines, we first calculate the pin votlage as follows:
The analogRead(PIN) function will give a value between 0 and 1023 since it is a 10-bit ADC (Analog to Digital Converter), so the formula we use to convert this to voltage is:
voltage = ( analogRead(PIN) * Vpower) / 1024
where Vpower is the 5VSB value (5.22 in my case)
For example, if analogRead(PIN) was 600, then the voltage would be (600*5.22)/1024 = 3.058V
We then take this voltage and use the following formula to finish off the calculation:
volts = (voltage) / (R1 / (R2 + R1))
where voltage is calculated from about, and R1 and R2 are the resistor values in Ohms
So if we continue from the above calculation, we would have 3.058 / (1770 / (4650+1770) ) = 11.09V.
This is the measurement for a supposedly 12v input, although this may not reflect 12v it is just an example.
And there we have the code modification done! You can now upload the code to the Arduino. Attached in the .ino file - simply open it with the Arduino IDE, edit the values as described above, and upload it!
Step 3: Building the Enclosure and Component Placement Preparation
Firstly I cut out the side walls for the basic structure of the case, then marked out where all the terminals and mounting holes will be need to cut or drilled out. Also cut out a panel for the PSU backplate for the mains input, and a cooling fan hole on the left panel.
Make sure you know exactly where you need to cut out holes for cooling or input/outputs as it will be much more difficult later on.
Attached are the Microsoft Publisher files containing my design - feel free to make changes yourself as you require.
For cutting out largers areas I drilled a few holes slightly bigger than my jigsaw blade, and then cut them out using the jigsaw with a wood blade. The LED bezel holes were simply drilled out, and the switch required a 16mm spade drill bit. Once the component holes were cut out I sanded and filed them down to try and get a perfect fit as possible - the LCD hole was the hardest one as the alignment on my jigsaw was offset, so I had to sand and file it a fair bit.
After you are happy with this, give all the panels a light sanding with a coarse sandpaper, and a light sanding with a fine one for a smooth finish. Then you are ready to paint the panels.
Since MDF is a big problem when it comes to painting, you will definitely need an MDF primer. I used a brush to paint it on and that is why you can see streaks on the final coat. You should use a roller for a much smoother finish, something I did not have available at the time, unfortunately. The MDF primer will be dry within a couple of hours, then give it 2 coats of black spray paint, or anything of your choice. I would recommend 24 hours drying time before you begin to assemble it.
After it has all dried, screw the fan into place as this will be quite difficult to do later on. After this, temporarily place the panels as you would like them to be fixed, possibly using tape to hold them or clamps - I marked each one to indicate which panel goes next to each other, then used a clamp to hold them in place whilst I drilled pilot holes for the screws. You can also use wood glue, or a combination of both. It is entirely up to you, but screws were good enough from my experience. You want to screw the side and back panels to the bottom base at this point, and leave the top and front panels out for now.
The front panel still needs the components and terminals mounting on so we will not screw it in yet. At this stage you DO want to drill pilot holes for the front panel though, so once everything is mounted you can simply screw it in without struggling. I drilled 3 pilot holes for each side to screw into, but you can choose to use wood glue or anything you prefer.
Step 4: Placing the Components and Terminals
So I added the terminals first, ensuring I could see the solder tabs on the inside of the panel to solder wires from inside. Then I added the LCD, mounted it on and ensured a nice fit. I added the switch, the LEDs and the banana scokets (I actually added them when the project was near completion as they took a while to be delivered, which is why you cannot see them in the 1st picture on this step).
I cut a few lengths of the thicker cable, ready to solder on to the speaker terminals - these will be soldered to the corresponding voltage rails. For the variable voltage regulators, I unsoldered their potentiometers, and extended them to be on the front panel so I can adjust the voltage from the panel. Make sure you remember the correct orientation for them!
I soldered the resistors for the LEDs on at this stage, and connected the common grounds all together for everything, so I only need one ground cable. I wired the variable voltage modules to their terminals, and had their power inputs ready to connect to GND and 12v.
The Arduino terminal requires these inputs for the voltage readings: 3.3v (orange), 5v (red), 12v (yellow), voltage regulator 1 and voltage regulator 2. And it also requires ground, and 5v standby (purple) for powering it up.
Please check the pictures to see how I've connected the terminals for voltage reading inputs. The bottom stripboard has the voltage dividers on there, which are connected to the respective terminals on the Arduino. So basically, on the stripboard under the Arduino terminal board, I soldered the voltage dividers, which have the wires going to the Arduino terminal board. And then I added another terminal block on the stripboard to which the power lines connect from the PSU, making everything easily connectable.
Add the USB ports, and wire them to 5VSB and ground, or normal 5V - it's up to you!
Also you must extend the potentiometers so you can control the variable voltage modules from the front panel!
Step 5: Testing and Final Steps
So this is nearing completion now and requires some testing. I used a voltmeter to confirm all voltages were displayed as accurately as possible on the LCD screen, and as mentioned before, it was accurate to within +- 0.05v for almost everything. I noticed that with the variable voltage modules, the accuracy was very precise within the 3v - 7v range.
I didn't screw the top on, but I used industrial double sided tape - this is because I need to add the load resistor, and extend a 12V wire for the LED tester module which will be on the outside of the case.
Double check that all the voltages are correct on your voltmeter, and are to an acceptable accuracy on the LCD. Turn it on and off a few times to see it it responds!
I found that my momentary switch had a lot of bounce - the interrupt would ignore it. So in order for it to work properly, I would have to press the button firmly, and not quickly, if that makes sense.. Your mileage may vary!
Alternatively you could add a hardware debounce, or a software debounce - when I get a chance I will update the code to have a software debounce.
Step 6: Making the Modular Power Cables
I managed to make the modular power cables and so far I've made 3 - two for breadboards, since I use them a lot, and the third one is a DC barrel plug for various items.
I used a small piece of stripboard and soldered 3 x 2 header pins to plug into the breadboard power line. The other end of the 2 wires goes to the banana plugs which will go into the banana sockets on the power supply 5V line. I made two of these so I can use one for 3.3v or for 12v, whilst still having one cable available for 5v power.
The DC barrel plug was a ready made patch one, so I just stripped the wires and screwed them into the banana plugs.
The unfinished project you see on the breadboard is something I'm working on, which you will see completed in the coming weeks. Keep an eye out on my page! :)
Step 7: Final Thoughts and Discussion
You have successfully built a Bench Power Supply!
There were a couple of things which I thought maybe I could have added, or I could possibly add later on with a new improved version.
- Current sensing modules, to show the current consumption on each rail. This would require multiple modules and would increase the complexity of the Arduino code - also, all the data would not fit on the 20x4 LCD so we would probably require another 20x4 LCD purely for current, or a larger screen. That may require a re-design of the front panel, increasing complexity overall. In my design, since I have a longer base on the left side, I could probably add another LCD and have that display current although it would probably not look right, but it's a thought.
- Adding a load resistor! I should have done this at the early stages but I haven't had any problems yet. I will probably add one anyway.
- Adding an LED tester - I am going to add this on the left side of the case where I have left a space.
Please leave comments and let me know how you think I did. The feedback would be greatly appreciated. Also please take a look at my personal website, where I have started to blog about my recent projects, and I will be adding more content slowly but surely!
I am more than happy to assist anyone - please leave a comment!
Thank you very much for taking your time to read this Instructable!