Projects

EZ-ATX Workbench Power Supply Part 1

Liam Davies

Issue 66, January 2023

Transform any old computer power supply into an absolute workbench beast with this project.

Nearly five years ago, we published our original “Feel The Power” project in Issue 7, where we used a PC power supply to build an incredibly simple but powerful lab bench supply. Fun Fact: It’s still operational and runs quite happily in the office workshop! However, that’s not to say we can’t make improvements on the design. Since then, we’ve been gathering feedback both from readers and our own staff, and we’re finally ready to build a brand-new version!

Our ol’ faithful ATX power supply from all the way back in 2018!

This version has many more features, clever power management, and is also much more compact than the original design. The PC power supply sits on its side on your workbench, and, with its sleek PCB front panel, looks super professional!

In this Part 1 of the project, we’re building a prototype to show off how the project works and then designing a PCB for the project. Next month, we’re putting together the project and doing the final touches!

Plenty O’ Power

The binding posts on each power rail can be used to connect any circuit you desire. There is tons of current capability available, with even the cheapest power supplies available on the PC market creating up to 30 or 40 amps of current at 12V!

However, very few of us are using that much current on the regular - we’re much more interested in creating a stable, reliable and repeatable power supply that can deliver more current than its DIY competitors. The supply we’re building can supply 12V, 5V and 3.3V all with great current capability, as well as -12V with a lower current limit.

Integrated Arduino

Our ATX power supply now uses an Arduino chip to smartly monitor and control each channel on the PSU! The included LCD screen displays the current draw of each channel, and can be used to configure the limit on each before it is automatically shut off. While a full short-circuit will likely trip the power supply’s internal overcurrent protection, we can also set a current limit that is useful for small projects.

For example, working with small 555-Timer based circuits rarely draws more than a few hundred milliamps - if a circuit ends up drawing a few amps, we know something has gone haywire and it’s time to disable the circuit. The LCD screen also displays the statistics of each channel, so if you’re doing power-monitoring of a circuit, it’s easy to see what's using up all your precious Joules!

The Arduino also runs off the special “5VSB” rail on the power supply, which means it always stays on, even if no channel is enabled. No need to manually turn the power supply on and off, as it’ll be in low-power mode until it’s needed!

Plug-And-Play

The big issue with many ATX power-supply projects we’ve seen online is that they require irreversible modification of the power supply itself. Not only is this dangerous - as it usually involves opening the power supply, exposing the high-voltage capacitors - but it also makes upgrading, replacing or repurposing the power supply very difficult.

Mini-Fit Jr. 5566 (MOLEX) - Element14

So, this project proudly wears our official DIYODE “No Modification Needed” badge! We’ve designed the EZ-ATX to accept a regular motherboard connector that can be connected and disconnected whenever needed to swap out the PSU. No need to open the PSU, hack off the factory-standard connector or hot-wire in new cables to the power supply. This also means that if you have a modular power supply (i.e. the connectors can be removed or added as necessary), this whole build can be incredibly compact!

The 3D printed case we’re using snugly fits around the circuit board, wiring and power supply, while still allowing everything to get fresh air and stay cool.

Custom PCB

We opted to make a custom PCB to really streamline the whole project. While it’s not essential, it makes it much more compact than having a forest of wires strung around the ATX power supply. We’ll be showing you how to build this PCB according to your needs - you don’t even need the Arduino if all you want is the four voltage rails.

This also means that if you’re not a whiz with circuit design, it really is as simple as popping in a few resistors and transistors as the schematic describes - no need to worry about soldering finicky wires into a perfboard.

Obviously, running wires through a PCB will reduce how much current the power supply can deliver, at least without heating up the traces. As long as you’re okay with having a bit of voltage drop under very heavy (10A+) loads, this shouldn’t be a problem.

How It Works

If you’ve investigated Lab Bench power supplies built from ATX PSU’s, then there’s already a good chance that you know how the basics of this project works. For those who don’t, full-size power supplies mostly used in desktop computers are extremely beefy power supplies that can deliver stable, high amperage power on multiple channels.

They’re specifically designed for long-time use in computers (who knew!) and, as it turns out, they make great candidates for lab bench power supplies too.

The 24-pin connector that all ATX power supplies is usually used for the computer’s motherboard and has both the power and control signals necessary for using the power supply.

There are four power rails, 12V, 5V, 3.3V and -12V as is present on the vast majority of power supplies. There are also a bunch of ground pins for allowing the return current to pass through with minimal voltage drop. However, if you just connect a power supply to the wall socket and flip the switch on, nothing spins up! Normally, a computer motherboard will use the PS_ON pin (Usually green-coloured) to turn on the power supply, by pulling the pin to ground. This can be done in a solid-state way, such as with a transistor, or just with a simple switch to bridge the contacts. We’ll be using an NPN transistor to turn on the power supply automatically.

This is also a handy way of testing if a power supply is dead, by shorting the green and black wires together with jumper wires. If it springs to life and the fans spin up, it’s okay to use!

There are also two other useful pins on the 24-pin ATX connector - the 5VSB rail and the PWR_OK pin. The 5VSB rail is always on regardless of whether the power supply is turned on or off - normally, this is used for charging phones and running the computer motherboard in standby mode, but we’re using it for constantly powering our Arduino chip. This makes the Arduino chip independent of any channels, which makes our life easier when dealing with shorts or over-current protection.

The PWR_OK pin, while not essential to use, will be pulled to 5V by the power supply once it deems all voltage rails are within specification after turning on. Since the onboard switching components need to charge and stabilise when the power supply first turns on, we shouldn’t feed those voltages straight to our circuit. The Arduino will monitor the PWR_OK pin, and once it goes high, it enables the outputs. If the pin takes more than a second or two to turn on, we know that the power supply is either failing or faulty.

Above is our wiring schematic for the output of our power supply connector. You may also notice we are using an additional resistor on the 5V output. Some power supplies require a small load to be connected otherwise they will turn off their output completely. If you find that this is the case, you can connect a resistor in this space to accomplish this.

The main feature we would’ve liked to include in our build is an adjustable voltage supply - there just wasn’t enough space to fit it into the enclosure. By adjustable, we mean having the ability to output whatever voltage we want - which is something that one could consider important for a lab bench power supply.

However, we have a few good reasons for choosing not to include one. The most common way to add an adjustable voltage output to these ATX power supplies is to add an all-in-one adjustable power supply to the 12V line. This doesn’t require any advanced wiring besides simply wiring it into the 12V line, which can be done externally (i.e. just connecting it to the 12V output) and doesn’t require a lot of creativity in terms of building the project.

But, perhaps a better question would be, how often do we actually need an adjustable power supply? Here at DIYODE, the majority of the time, we’re working with 5V, 12V and occasionally lower-voltage rails like 3.3V and -12V. Sure, there are instances where an adjustable supply is invaluable - think battery, motor and LED testing - but for those instances, an adjustable unit can be added on the output.

We’re using MOSFETs to turn on and off the individual channels, which have been chosen with the lowest resistance possible so they don’t heat up or cause more voltage drop than is necessary. Because the channels are fully controlled by MOSFETs, the Arduino can quickly turn on and off any channel necessary, hopefully well before any short-circuit protection has kicked in on the power supply itself.

Interface

There are many different interfaces that we could have used for this project, however, we wanted to keep it simple and easily accessible - we’re sticking to a trusty 16x2 LCD display. These are extremely common and are included in many Arduino starter kits. We were considering using a much fancier OLED graphical display, however, these are significantly more expensive and physically much larger.

The main menu on the LCD display lets us monitor the real-time current output on each channel, and if the channel has been disabled. It’s a very simple menu but it’s easy to see the status of a channel at a glance. To do some initial tests and layout checks, we used the online Arduino simulator Wokwi to write some code and test the LCD screen - all without actually hooking anything up.

You can see it's quite a simple layout, showing the current draw of each channel if it’s enabled, and “OFF” if it isn’t.

To control the EZ-ATX and the options on the LCD menus, we’re using four illuminated pushbuttons connected to the ATmega328 chip. The buttons aren’t connected to the MOSFETS directly, for a few reasons. If we used latching pushbuttons, we wouldn’t be able to turn on and off the channels through software, and we also wouldn’t be able to control the other menus in the EZ-ATX.

Speaking of which, there are a few different options that we have implemented into the EZ-ATX to fully customise its functionality. By pressing and holding on any of the channel buttons, we are shown a menu where settings of the channel can be changed. We’ve added two main settings that can be changed per-channel: Max Current and Time Limit.

Max Current - The maximum current that can be drawn before turning off the channel's output completely.

Time Limit - The time limit that the maximum current can be drawn for before turning off the output. Ranges from instantaneous to 60 seconds.

Note that our power supply isn’t capable of supplying Constant Current output, because there are no variable voltage outputs.

Prototype Build

Our prototype isn’t so much of a fully-fledged circuit as it is a few separate circuit experiments to check the layouts we want to use will work properly.

To test the LCD interface, we used the popular XC4454 LCD module from Jaycar, which sits on top of a standard Arduino Uno as a shield. It also has a set of buttons that we’ll use as our channel buttons, so we can check everything we’re developing works correctly.

While it’s an awesome module for making quick work of a project requiring a LCD interface, there were a few quirks that we had to figure out before it cooperated with us properly. The LCD backlight is actually connected to the Arduino, which can be controlled by toggling Pin D9 high. By default, the backlight won’t illuminate at all. Additionally, you’ll need to use a screwdriver to adjust the contrast potentiometer, otherwise you simply won’t see anything on the display.

We’ll delve into the code much more in Part 2, but even in its current state it has nearly 1000 lines of code. There are a few menu systems, each with its own configuration options. It’s accessible using the same four channel control buttons for simplicity.

One other thing we wanted to experiment with before we order a PCB is ensuring that our MOSFETs will function as expected. MOSFETs can sometimes be finicky to work with because they have capacitive gates, which are in an unknown state when not pulled to fully saturate or turn off the MOSFET.

Additionally, they have specific threshold voltages that we need to use, otherwise we risk partially turning on the MOSFET - this will lead to it heating up and a large voltage drop at the output.

We’re using high-side switching for our circuit, which means the positive voltage for each rail is controlled, rather than the negative. This prevents different ground potentials from arising on each of the rails. For this reason, we’re using P-Channel MOSFETs. Unfortunately, many have a Vgs (Gate-To-Source voltage) that exceeds that of standard 5V logic used by our Arduino, so we actually need to use the -12V for switching our MOSFETs too. We set up a virtual -12V rail by putting our existing lab bench power supply outputs in series.

All we’re doing here is just throwing a 10Ω resistor into the circuit to simulate a load on the output of the power supply.

We’re using a lab bench power supply here rather than the actual ATX power supply because we want to measure the current outputs, ensuring that we don’t burn out a MOSFET by pumping a ton of current through it accidentally. MOSFETs don’t grow on trees!

To ensure the circuit was working as we expected, we simulated the circuit in Falstad’s circuit simulator (https://www.falstad.com/circuit/)

IMPORTANT!

The power supply rails on this power supply are NOT isolated! This means that it’s a very bad idea to connect a ground to a power rail, even if it’s on a different rail. With isolated supplies, this is often used to create a ‘virtual’ ground where -12V and 12V are present by simply stringing two 12V supplies in series. This power supply already includes a -12V rail, so we suggest using that if you wish to use positive and negative rails. Additionally, when probing any circuit powered from this supply with an oscilloscope or grounded multimeter, you MUST connect the negative probe to ground! If not, you can damage both the power supply, the circuit and the equipment measuring it!

Be aware that these power supplies can dump a huge amount of heat into any device connected to them. Never use this power supply to charge a Lithium Ion battery or power any devices needing specific voltages - it simply does not have the ability to regulate these voltages correctly.

Finally, while we encourage experimentation, please be aware that ATX PSUs have high-voltage capacitors, and will often remain charged for a long time after disconnecting power. Don’t go opening PSUs unless you know exactly what you’re doing!

Designing the PCB

Like many of the projects we do at DIYODE, a PCB is completely optional but helps significantly with managing a complex project, both with reducing the amount of errors in a circuit and the simplicity of actually wiring it up.

We opted to design one as the space we need to fit the electronics in the chassis is limited, and building a perfboard prototype would exceed that very easily. We used a free, open-source software called KiCAD to design our PCB.

The Schematic

Unlike perfboard projects where a lot can be done without a schematic - assuming you’re good at remembering circuits, of course - PCBs require a schematic if you want to make a reliable circuit free of errors. This helps visually communicate the circuit in terms of its functional capabilities, disregarding its physical layout.

KiCAD is excellent in that it includes nearly 20,000 individual component symbols and footprints information right out of the box. Of course, if the part you’re looking for isn’t available, you can always create your own by either importing them from websites like SnapEDA or building your own from scratch with the inbuilt part wizards. We have used other EDA packages in the past like EasyEDA, however we have found KiCAD to have a bit more customization in terms of its design features.

Every project you create in KiCad is automatically associated with a schematic and PCB, so there is minimal fussing around.

We first created the schematic for the ATmega328 chip. To insert a part in KiCAD, press the ‘A’ key on your keyboard and search for the part number you want to use. The included default parts are extensive, so you’re bound to find something close to what you want.

You can see in the photo above, we’re actually looking at the ATmega328-A model, which is a TQFP package (i.e. a flat chip) rather than the much more accessible DIP-28 version. Hence, we want the ATmega328P-P version. It’s worth noting that in PCB design, it’s not absolutely necessary to get the exact component that you’re going to use in the real world.

In the end, you’re going to get a manufactured board with a bunch of copper in it - it doesn’t know and doesn’t care what components you use. The exception to this is if you’re outsourcing the assembly process, where the board house will populate the board for you - in this case, you must get the exact component for them to use.

It is important to get the right footprint and pin layout, though. There is nothing more frustrating than picking the wrong footprint and having to make a component fit on a slightly mis-sized footprint. So, long story short, do your research and use the closest components you can find to your real-world part on your schematic.

Once the part is placed on your schematic, you can begin creating wires to connect to other components. For the ATmega328 chip, we need a couple other components to make it work. These are normally all included on the Arduino boards, but since we’re using the chip directly we have to manually add these components. We obviously need 5V and Ground power to the appropriate pins, which we added power symbols to.

The next step is to add a 16MHz oscillator crystal to the XTAL1 and XTAL2 pins, which provides the chip with its clock signal. The chip can actually run on its own internal 8MHz clock if desired, which can be configured in your programming IDE. The crystal also requires two 22pF capacitors connecting it to ground.

We also added a reset circuit (lower right) and an analogue reference voltage (upper left) that will provide the ATmega’s internal ADC with a stable 4.096V. The regular 5V reference is acceptable for most uses, but we used a dedicated reference diode to really help measuring the currents in our project to good precision.

You may notice that the ATmega isn’t connected to much else - where are all of the wires? Most modern PCB design softwares support ‘netlabels’, which describe different nets throughout the schematic connecting to each other.

For example, the top-right pin on the ATmega328 chip has a ‘POWER_ON’ label, which would be connected to everywhere else on the schematic that also has that label.

Here is the schematic for our LCD module - you can see many netlabels that were mentioned on the ATmega328 chip before, so we know which pins are connected to which. There are only a few extra components, including the contrast potentiometer and the transistor to control the display backlight from our ATmega328 chip.

Since our little ATmega328 is running out of pins managing all of these outputs quite quickly, we need to make sure we have space to connect our buttons. Fortunately, there is actually quite an easy trick for hooking up a bunch of buttons into one pin - use a voltage divider!

For those who haven’t seen this configuration, we’re essentially creating different analog voltages at the digital depending on which pins are pressed. Together with the 10kΩ resistor connected to the 5V pin, the resistors in series with each button cause an identifiable voltage to appear on the Arduino’s GPIO pin. Since the voltage will be the same each time a particular button is pressed, we can check if the required voltage appears within the ADC values we’re expecting. We chose the above values in particular because, when pressed, they generate 0V, 1.25V, 2.5V and 3.75V. When none is pressed, 5V is normally present on the Arduino’s pin.

MOSFET Circuits

This part of the circuit is arguably the most important part of our power supply - the MOSFET drivers. There are four different units of the circuit above, and they are responsible for turning on and off the 12V, 5V, 3.3V and -12V outputs of the power supply, as well as monitoring the output current. The circuit is almost identical to our prototype design, except that we’re now using a MOSFET with a much lower on-resistance (Rds) to reduce voltage drop when it’s turned on.

It’s worth noting that we’re still experimenting with this circuit, so the components or layouts may change between now and Part 2 as we continue to optimise it.

Component Layout

Now comes the fun part - laying out the PCB! The shape and size of the PCB will ultimately come down to the physical constraints of the project and the number of components you’re trying to include. If you’re using through-hole resistors as opposed to SMD resistors, the PCB must obviously be bigger to accommodate them.

We laid out the front panel of our project first, which has the mounting holes for the LCD screen, the labels for the power rails, and the edge cuts for the actual PCB shape. There isn’t any actual electronics on the board - it’s more of a front panel than anything.

Getting your PCB sent to a manufacturing boardhouse is much like getting something 3D-printed. While the process is human-supervised, when it comes down to it, the machines involved will simply follow whatever instructions you’ve given them. For this reason, double and triple check your dimensions! The grey lines on the PCB above show exactly where the PCB will be cut out.

The dimensions of our edge-cuts matched the dimensions of a standard ATX power supply, so it should fit within its physical footprint. You can use the inbuilt Measure tool to check it has the right dimensions.

After we were happy with the front panel, we moved on to creating the brains of the operation - the back PCB where all of the actual electronics are mounted. This won’t be visible at all from the front, but it’s still important to lay them out neatly to prevent a messy and confusing assembly process. We copy and pasted the edge cuts from the front panel, minus the LCD cutout. The rear of the buttons will protrude through the rear PCB so we’re keeping the holes for them there.

To import the components from the schematic into the PCB layout, press F8 on your keyboard. This process will gather footprints and annotations from the main schematic and dump them all into the PCB. At this point, it may be quite overwhelming as there will be a disorganised mess of components and a ton of unrouted lines - suitably called the ‘ratsnest’ - on your PCB.


It can be quite confusing to move all of these components to the best place, but our advice is first turning off the GND and possibly the 5V power nets in the PCB editor. In KiCAD, you can do this by simply clicking on the eye icon next to the nets you want to hide.

Now, we can drag the components into logical places on the PCB, starting with the biggest and mechanical pieces. Parts like mounting holes, displays or MOSFETs should be moved first as they have the greatest impact on the routing around them. It is absolutely worth spending as much time as possible creating a neat and logical layout. Routing is much easier if you place your components with forethought.

Although it’s not necessary, us electronic nerds at DIYODE are perfectionists and love to have everything exactly aligned. You can use the “Align/Distribute” tool to ensure your components are positioned correctly. The “F” key will also “flip” components to the other side of the PCB, if you have run out of space or physical constraints prevent the component from mounting on one side. The silkscreen text (the white markings on the board) will reverse automatically to account for the fact that it’s on the other side.

Routing Traces

Once we’ve laid out our components, we can start routing traces on our PCB. KiCAD has had some extensive development to make this process very simple, so it’s a breeze to connect one component to another. To start routing, hover over a pad and press ‘X’. KiCAD will attempt to draw a trace towards your mouse cursor in the most efficient way possible.

Normally, KiCAD will try to find a way around existing components and wires to accomplish the trace, however, you can permit it to shove other traces aside by using the ‘push-and-shove’ routing mode, which we used to make routing dead-easy.

Trace widths are also important, which are mostly dictated by the amount of current you want them to carry. The small traces on our board are associated with the ATmega328, which need to carry milliamps at best. The larger traces are 2-3mm wide, which help with carrying the current from the power supply without causing too much voltage drop and heating up. In KiCAD, you can also set these trace widths per net, so you don’t have to think about what trace widths belong to which part of the circuit.

Copper Pours

Once we’re done routing traces, and happy with the layout, we can then do a copper pour on our PCB. This is NOT an essential part of PCB design, and there are many instances where it’s not necessary. However, for us makers, a copper pour is quite useful and is typically created by connecting it to the ground net.

Essentially, a copper pour prevents us needing to manually route traces for a specific net and lets it fill the remaining unused areas of that board with that net, connecting to components where necessary. This is why we turned off the ratsnest for the GND plane earlier in the process, as it’s simply not necessary to route manually.

After drawing a polygon around the board, the Copper Zone dialog will appear, where we can select a net for it to connect to automatically. Once we click OK, and press ‘B’ to re-pour the zones, we can review the results.

The semi-transparent zones represent the top and bottom ground pours, where KiCAD has automatically generated the pour. Notice that ground pads are connected with ‘thermal relief’ pads to make soldering easier (i.e. heat won’t leech out of the joint as quickly). We’ve also manually added vias (Ctrl+Shift+V) between the top and bottom layers to connect the two ground pours.

Finishing Touches

Great, we’re done now, right? Sure, but we could’ve made an error somewhere, so it’s best to let the computer figure out if we have any issues on our board. Before exporting the board, we can run a “Design Rule Check” that does exactly what it says on the tin.

The DRC Control window will show you problems associated with your PCB and help you find their locations. Clearance problems, unconnected nets and overlapping components are automatically marked and can be fixed. Although real-world problems can still occur, DRC will reduce the chance of a ‘facepalm moment’ happening when you receive your PCB in the mail.

Ordering PCB

It’s time to order our PCB! Thankfully, PCB manufacturing is no longer an industry-exclusive process and now can be done by anybody with a credit card and a mailing address. There are many online boardhouses, although the most popular are businesses like JLCPCB and PCBway. These are both popular options and offer incredibly cheap manufacturing with a lightning-fast timeframe. The PCBs we ordered for this project cost us less than $20 AUD for a quantity of 10 excluding shipping. Many of these boardhouses also offer 3D printing, SMD stencils and placement services with huge discounts even for individuals.

These manufacturing services require Gerber files, which contain the manufacturing parameters for your PCB. There are specific steps to export your PCB in your design editor for your boardhouse of choice, and so we followed JLCPCBs exporting process to correctly plot our PCB.

The files can then be zipped and uploaded to the ordering page of the boardhouse. Fill out the parameters you want, such as how many boards and in what colour, and order! We ordered our PCBs from JLCPCB on a Friday, and they were on our desks the next Wednesday. Very impressive!

Next month, we’re putting together our PCB, assembling everything and giving it a final test. We’ll also show more of the final code and discuss how to modify the project to suit your needs.

Note that as we progress throughout the project, you may see changes in our circuit and PCBs as we make further revisions to the design. The first PCB we ordered had some issues we had to fix, and so the Gerber files we’ll be offering for download may appear slightly different than what you see in the project. Fear not though, as most of what we’ll be showing will be the same regardless of what PCB revision you order.

Stay tuned for next month to see how we finish off this awesome project!

NEXT MONTH: Part 2