Introduction: Arduino Controlled ATX Power Supply

Picture of Arduino Controlled ATX Power Supply

Can a microcontroller control its own power?  Well nearly!

An ATX power supply, either new or from an old PC, is a great way to power Arduino and other microcontroller projects.  That is covered in several 'ibles such as this one.  However, because of some of the special features of an ATX, we can use it as a "smart" supply that's even better.

This is a very simple 'ilbe that will allow you to make a lead that will allow you to control an ATX power supply from your microcontroller.  That way you can use your old ATX as a silent, low-waste power supply for low current microcontroller applications and switch it under firmware control to a high-current monster supplying tens of amps at 5V and/or 12V.

A video showing the idea in action is embedded in the final step.

Total cost of the control lead is a few pounds and you will not damage your power supply in any way so it can be used for other applications later if you wish.

Step 1: Things You Need:

Picture of Things You Need:

This project requires:

An ATX motherboard extension cable (£2 inc delivery from e-bay)
3 jumper leads
A 1K resistor (value not critical)
Some heat-shrink tube

Tools:

Soldering iron & solder
Clippers
Lighter to shrink the heat-shrink

For use:

An ATX power supply
A 5V microcontroller such as an Arduino
High power transistors etc to control stuff.

Step 2: Background

Picture of Background

An ATX supply is a wonderful thing!

Looking at the sticker of this supply that I picked up new for £15, we see that it can supply a well-regulated:

20A at 3.3V
30A at 5V
30A at 12V

Plus a stand-by current of:

2A at 5V

Now 2A at 5V is ample to run nearly any 5V microcontroller, while 30A at 5V or 12V is enough to power pretty much anthing short of an aluminium plant.

All we need to do is tap into the 5V standby power to run our controller board and then switch on the high-current supply when we need it.

Step 3: Making Up the Connector

Picture of Making Up the Connector

The ATX power connector is well known and the pinout is available online, such as here:

What we need is the stand-by 5V power (purple), the control wire (green) and any of the black ground wires.

Start with the female end of the connector (well, I take that to be the female end - the one in the first picture) and clip off everything we don't need close to the connector.  Then clip off purple, green and black close to the other end.  Slip some hear-shrink over these three and strip these wires and the jumper wires we are connecting to.

We are going to add a 1K resistor to the control wire just because we can and it avoids any risk of excess current flowing when we pull it low with the microcontroller.  So, solder the resistor to the green jumper lead and then to the green wire from the ATX extender.  Solder the purple and black wires to the corresponding jumpers (in my case red and black).  Finally, heat your heat-shrink.

Step 4: Controlling and Using Your Arduino ATX

Picture of Controlling and Using Your Arduino ATX
Using Arduino as an example, all you need to do to use and control your ATX supply is:

Power your Arduino with the purple (red in the picture) ATX wire to +5V (don't use Vin) and the black ATX wire to Gnd.

Connect the green ATX wire to any control pin.  I have used A0 (D14) because you can see it in the picture but a general digital IO pin works just as well.

Plug in your ATX and your Arduino will be powered bu the main power and probably the fan will stay off.

When you need full power just issue the command:

const int ctrlPin=14; // use whichever pin you wish.  I have used A0 which maps to D14.
pinMode(ctrlPin, OUTPUT);
digitalWrite(ctrlPin, LOW);

To turn the main power back off, use:
digitalWrite(ctrlPin, HIGH);

Equally, to turn off, you could simply set it to:
pinMode(ctrlPin, INPUT);

to set the pin to high resistance again.*

Now all you need to do is connect your high current load to any of the MOLEX type connectors from the ATX supply and control them with transistors, MOSFETs etc as you normally would.  When you reach the point in your sketch when you want full power, just issue the above command and fire up the 30A supply!

Note - you should be careful powering your Arduino direct to the +5V.  If you also connect the USB cable then you could get a current flowing to you USB port of your PC so take care to connect only one power source at a time.

The ATX specification suggests that you can either hold the line at +5V or disconnect (set high resistance) to turn off the main power: http://www.formfactors.org/developer%5Cspecs%5Catx2_2.pdf

Step 5: ATX Control in Action

Picture of ATX Control in Action
This short video is of a dawn-light alarm clock project (that I will write up sometime but there's a lot to it).

Edit - full dawn/sunrise alarm clock instructable now here: https://www.instructables.com/id/LED-Dawn-Sunrise-Alarm-Clock-Nightlight-Secur/

You can see that the Arduino controling the time display is powered the whole time but initially the fan on the ATX is not running.  That's because we are only using the standby power.

When I fire up the main LED lamp (about 9W of LEDs at the moment but will be more later), the Arduino powers them by switching on the main ATX power and you see the fan start to run.  When the main light goes off again, so does the main power.

For an alarm clock project it's very useful because you don't want the noise of the fan running all night.  There are many similar situations where the muscle of the main ATX power is only needed occasionally.


Hope you find it useful.

Ugi

Comments

dthompso (author)2016-09-30

does the green wire have any voltage on it that would damage the Arduino

thanks

Dwight

SvdSinner (author)dthompso2017-01-28

Some of them can source nearly 100ma from the PS_ON when connected to GND. That shouldn't hurt your Arduino during testing***, but it will not turn the PSU on, since the Arduino isn't rated to sink more than 40ma. See my comment above for details and how to fix the issue.

*** Trying to sink more current than your Arduino can sink will most definitely burn up the pin (or your board) if the current is high enough and you let it run long enough. The only reason this probably won't kill your board, is because it is only a bit over the max amperage spec, and because you would recognize a problem and unplug it before damage occured.

Ugifer (author)dthompso2016-10-02

The green wire should be a high-impedance "sensing" connection, like an Arduino "input" pin so should not be any threat to your Ardu'.

I put a 1K on that line out of an abundance of caution because that limits the current if there were any issues. However, it should be completely unnecessary.

My only caveat here is that there are many makes and builds of ATX power supplies and although they should all conform to similar standards I have not made any attempt to test them widely. It is therefore just possible that _your_ ATX supply is different to those I have tried. I think the chances are very small, but if in doubt, put a meter on the pin, then ground it and measure the current flowing.

Ugi

SvdSinner (author)2017-01-28

I was testing this on some old PSUs from my "closet of obsolete computers".

For some of them, I needed to use an NPN transistor to get the PSU to turn on, because they sent >90ma from the PS_ON to GND. (More than an Arduino can sink)

To solve the issue, I hooked the transistor up like below, and changed the code to be high for ON and low for OFF. Most any NPN you've got in your bin should work.

NPN Transistor connections:

Base <--> 2.2K resistor <--> ctrlPin

Collector <--> PS_ON

Emitter <--> GND

(These were PSUs that may or may not have been flaky enough to be the reason they ended up in my "closet of obsolete computers". Not PSUs that I would trust to run a computer well. PS_ON being low-impedance could easily because these PSUs were "bad". They all worked well enough for the non-computer destinations I planned for them. :) )

EdgarEstrada (author)2015-07-22

This is a great job!
Do you think its possible to connect an arduino and a raspberry pi to the 5v standby?

Gelfling6 (author)EdgarEstrada2016-08-17

Yes, you can, BUT..... I've heard a few saying if you try to connect some of the arduinos (R2 and back) +5V line, it can do damage to the circuit that switches from the USB +5V to the regulator +5V.. (haven't actually seen this myself.. Duiemilinova worked fine..) as long as you're not pulling too hard on the 2A standby (with an arduino? not likely.)

Ugifer (author)EdgarEstrada2015-07-22

That depends a lot on what you are using your RPi for and the spec's of your ATX.

The power supply I used was rated for 2A at 5v standby. Now we know a normal Arduino will run off a computer USB port which provides 500mA max, so providing you are not adding too many high-power devices to that, we'll say that needs 0.5A.

For normal use they recommend 5v 1.2A for the RPi: https://www.raspberrypi.org/help/faqs/#powerReqs

However, if you are using lots of USB ports on the RPi then you might need more.

For normal use, however, we need 0.5A for the Arduino and 1.2A for the RPi, which makes 1.7A, fitting nicely inside the 2A standby available. So looks like for a "normal" setup, it should work fine.

Ugi

EdgarEstrada (author)Ugifer2015-07-22

Thanks a lot for your valuable input.

PedroR78 (author)2016-05-15

Great job!

One question: can i boost the voltage from the atx +5vsb to 9v using a LM2577 DC-DC Step up Power Module Adjustable Voltage Power Converter Module so i can power the arduino using the power jack (7-12v) so i can also use the usb connection without having to hack the usb cable (power) nor use the 5v pin ?

Ugifer (author)PedroR782016-05-15

Hi - Thanks for your interest.

So long as you don't draw more current than your individual 5vsb allows then yes, certainly you can do that. You are burning power stepping up and then regulating back down, but it is formally a more "correct" way to power the Arduino. You could probably boost to 7-8v rather than 9v, however.

You should expect that to boost 5v to 9v, assuming a less than perfect efficiency, you would approx double the current drawn. Therefore, if your +5vsb is rated 2A on your ATX (that's what mine says) then you should not expect to draw more than 1A at 9V. I doubt you need to use more than that, bearing in mind that anything you need to power beyond the Arduino itself can always come direct from the +5Vsb.

Good luck with your project!

Ugi

PedroR78 (author)Ugifer2016-05-15

Thank you for your reply..

is mi intention is to only power the arduino from the 5vsb, so i can still control the psu, and remain with a active normal usb connection, all other devices will be powered from the psu 12v rails.

mfoster (author)2015-02-18

Great work. I am looking to do this with a Raspberry Pi. Any reason that it wouldn't work? The Pi uses 3.3v GPIO, but that shouldn't have a problem pulling down the 5v signal from the PSU provided that the unregulated ground ground on the Pi is connected to the GPIO ground. Let me know if you've tried it. Thanks,

Ugifer (author)mfoster2015-02-18

Not tried it but no reason I can think of why it shouldn't work. Just two points that occur to me (they are probably obvious):

You will need to switch by going from High Impedance (input) state to pulling low - I don't expect you can turn the power off reliably by pulling "high" to 3v3.

It makes me more inclined to put the resistor in the circuit to avoid any stray currents. I can't immediately see how the situation would be different but I would hate to see you "bake" your Pi!

Would be interested to know how it goes.

Ugi

mfoster (author)2015-02-18

Great work. I am looking to do this with a Raspberry Pi. Any reason that it wouldn't work? The Pi uses 3.3v GPIO, but that shouldn't have a problem pulling down the 5v signal from the PSU provided that the unregulated ground ground on the Pi is connected to the GPIO ground. Let me know if you've tried it. Thanks,

russ_hensel (author)2015-01-09

Just a note to let you know I have added this instructable to the collection:
Encyclopedia of ATX to Bench Power Supply Conversion
>> https://www.instructables.com/id/Encyclopedia-of-ATX-to-Bench-Power-Supply-Conversi/
Take a look at about 70 different approaches to this project.

Ugifer (author)russ_hensel2015-01-09

Great - sounds like a useful collection!

Ugi

Dashing Rainbow Dash (author)2014-10-26

I accidentally fried my arduino when I hooked it to the power supply. Oops...

La2g (author)2014-10-22

Guys i got a question, with this i can control when the psu is on or not, but can i use the psu to control a blinking led, the same way i do it with the arduino for example?

firefightertoddy (author)2014-09-28

Is there any issue with using an ethernet shield and power flowing back through? Or does that only affect the USB connector? Also would rigging a DC jack from the ATX 5v power supply be a safer way?

Ugifer (author)firefightertoddy2014-09-29

I have not used the ethernet shield but this should be exactly the same as using the shield with USB power. If the shield is safe to use from usb then it should be fine with direct 5v power.

Connecting to the Jack connector or Vin only works if you have around 7 to 12v . There is no 12v standby on an ATX as far as I'm aware.

Ugi

Demerzel8080 (author)2013-01-12

How would you set this up in paralell with the power button inside a pc?

(like to turn it on/off via IR or someting)

This has some awsome potential :)

ftantowi (author)Demerzel80802014-03-03

u realize that the motherboard is the one handling The power supply right?
well u can manipulate the power button logic of the PC though
like a short pulse for turn on, long pulse for forced-off

Ugifer (author)Demerzel80802013-01-12

I am afraid I have never tried to control an ATX while still inside the PC! I think you might struggle becuase the motherboard has control of the main power at that point.

My guess is that the power button just tells the motherboard that something is happening and the logic on the MB (powered by the standby power) pulls the control pin low when it's needed. I expect it's possible but I don't immediately see a way without causing trouble. Would love konw if you find one thou'.

Tachyon (author)2014-02-10

This is a nice conversion however AFAIR the Arduino should really be supplied with 7-9v because at less than 7v it's onboard regulator will have trouble supplying 5v to the board. This shouldn't put the microcontroller out of spec, but it may cause issues with anything you are driving/powering from the Arduino. IE anything TTL.

Ugifer (author)Tachyon2014-02-11

Hi Tachyon

Thanks for your interest in the project.

What you say is true, but only if you apply power to the barrel jack or Vin pin. If you apply directly to +5v then you bypass the regulator and there is no voltage drop. This is how the Arduino is powered from USB - direct to +5v rather than through the regulator. Of course you need nice smooth power but if an ATX is smooth enough for a PC it'll do for a little Arduino.

This powering direct to +5v is why you need to be careful not to apply other power at the same time - you could get power flowing to your USB port etc if they are connected simultaneously.

Tachyon (author)Ugifer2014-02-12

You're right of course. I missed that you were powering direct to the +5v rather than to Vin. My bad.

That said, you might want to add a brief explanation of the three power input options on the Arduino and why it's important to use the direct to 5v rail in this case. It could be confusing to new Arduino users which is which and why it matters. Especially since the 5v is not just an input.

Not that your instructable is lacking or should require that info as it's complete for the topic it addresses. But it would be a nice addition.

thewildman (author)2013-05-18

Thanks Ugi,

I managed to get the power on working fine by connecting an Arduino pin to the power button and pulsing it high then low. I may alter it by putting in a voltage divider since when I used a multimeter and read across the motherboard power button pins it is normally 2.5V, and Arduino is giving it 5V.


(http://s22.postimg.org/jvomu1iwx/20130513_221350.jpg)

I think a MOSFET is the way to go. I am building this for an arcade: using a coin slot to add credits which adds time, and this then the Arduino enables the joysticks and buttons. For the inputs I have hacked gamepads and connected buttons to them - each button connects to a common +ve (not a common ground) and the MCU. I'll just a P-type MOSFET to switch the common +ve on/off as per credit timer. I think this is better than controlling the USB connection itself. Each button draws less than a mA (i think they drew about 50uA each) so I think a MOSFET or Bi-pol should work should work.

Thanks for your help!

Ugifer (author)thewildman2013-05-23

Sounds like a cool project - thanks for the update. I'd be interested to see it when it's done.

Ugi

Ugifer (author)2013-05-13

Hi Wildman!

There should be no problem leaving out the 1K. I had it there because it worked fine for me and, particularly in development, it never hurts to be sure that you won't get a massive current flowing where you don't expect it. If it works without the 1K then leave it out, although you could always put a meter between the control line and ground and see how much current flows, just to be sure. Chances are it will be tiny but if I did that I don't now remember what reading I got.

You should be able to tell whether the main power is on from the grey "power good" line. The ATX pulls that high once the main power has stabilised at its assigned voltages. Might be easier and/or more reliable than the power LED.

As for controlling the power to devices, that may depend upon what you want to do. The voltage drop across a typical NPN transistor is probably a little too high for the 4.5V minimum standard on a USB port and most will only handle 100-200mA. If you are just taking about a keyboard/mouse then that's not likely to be an issue. Low current USB devices use up to 100mA, which should be fine.

For higher current and/or more sensitive devices you might have problems, however, in which case you could always use a low on-resistance MOSFET (the only one I have used recently being IRF540N, which is probably way over-spec'ed for what you need but still only around 75p each).

Good luck!

Ugi

Demerzel8080 (author)2013-01-14

I found a simpler solution to turn on the pc, maby tro this in te huture.

jporter23 (author)2012-12-15

Awesome Instructable, Ugi!

Just a quick question, as I'm not super familiar with ATX power supplies. I see from the ATX Wikipedia page (here) that the ATX's 20 pin mobo connector (that you modify in this guide) has +12V & -12V wires, and these don't explicitly appear to be stand-by. Will they go live when the Arduino activates the power supply, along with the other Molex connections?

I ask because, for applications that only require a single 12V feed, it seems like it might be "cleaner" to draw power from this main 20 pin connector, rather than plugging in a separate 4 pin Molex if it isn't necessary.

Thanks!

Ugifer (author)jporter232012-12-16

Thank! - and yes, yare are absolutely right.

All of the yellow wires go to +12V when you fire up the main power. The blue -12V is the same. Be aware, however, that the -12V is a very low current supply. I think you can take 0.5A from the -12V whereas the +12V is good for 10s of amps.

Ugi

vicvelcro (author)2012-12-12

This is fabulous. Thank you. I solemnly swear that I will only use my power for "GOOD".

Ugifer (author)vicvelcro2012-12-13

Thank you for your comment. I'm sure we are safe in your hands.

Ugi

WWC (author)2012-09-23

This is a great idea.
I would like to know is there more code for this than shown in step 4?
Thanks
W

Ugifer (author)WWC2012-09-24

The great thing about this is that once it's connected up you only need a few lines of code.

To turn on the main power, just set your control pin to OUTPUT and write it LOW.

To turn it off, either set to INPUT, or write it HIGH.

It really is as if an ATX supply was made to be controlled by an Arduino!

If it takes more than about 4 lines of code then you are over-complicating things!

Ugi

PS apologies for the deleted comment - I got the HIGH and LOW the wrong way around first time and I couldn't edit it.

WWC (author)Ugifer2012-09-24

This is for turning the power supply on, correct?

void setup(){
const int ctrlPin=0; // use whichever pin you wish. I have used A0 which maps to D14.
digitalWrite(ctrlPin, LOW);

}
void loop (){


Would this have the power supply behave the way you have in the video, on with a load attached and off with no load?

No need for the apologies friend!

W

Ugifer (author)WWC2012-09-24
That's the idea, only you want ctrlPin to be a global variable, so you need to define it outside of setup().  You should also probably explicitly set ctrlPin to OUTPUT, but otherwise yes, that would turn on the main power during the setup() routine. If you wanted to turn it off again during the loop() routine then you would write it HIGH or set the pin to INPUT, so if you had:
 

const int ctrlPin=0; // sets which pin to use.
void setup(){
  pinMode(ctrlPin, OUTPUT);
}
void loop (){
  digitalWrite(ctrlPin, LOW);
  delay(10000);
  digitalWrite(ctrlPin, HIGH);
  delay(20000);
}

you would set ctrlPin to OUTPUT in setup(), then you would turn on the main power for 10 seconds, followed by turning it off again for 20 seconds.  You would get a similar effect to that shown in the video - the fan and main power would come on for a while, then go off again but the Arduino would keep running.

Ugi
WWC (author)Ugifer2012-09-24

Ah i c i will remember that " global " now.

This sketch we define the on and off times.
It appears in the video it is " on demand " or are the on and off defined there also?

Thanks for your help. As you can probably see i am starting out with coding, so i appreciate you coaching me.

W

Ugifer (author)WWC2012-09-24
You could control it however you choose. In the video, I am reading a rotary encoder which controls the light that you see in the frame. When the sketch turns on the light, it also turns on the main power because it would take too much current for the standby power. If you look at the "button" example sketch for Arduino: http://arduino.cc/en/Tutorial/Button

You will see that it turns an LED on and off with a switch. You could use the same sketch to turn the power supply on and off at the press of a button. You would include the above definition of ctrlPin and set it to OUTPUT, then in the loop, you would use:

if (buttonState == HIGH) { // turn Main Power on:
  digitalWrite(ctrlPin, LOW);
}
else { // turn Main Power off:
  digitalWrite(ctrlPin, HIGH);
}

Ugi
WWC (author)Ugifer2012-09-24

OK

Thanks much.

Dominion-Network (author)2012-07-24

This will defo come in handy for when I make my own work bench power supply

Ugifer (author)Dominion-Network2012-07-25

Great! It seems such an obvious thing to integrate an ATX with a microcontroller - they are so well suited for each other - but I haven't seen it done before. Hope it proves useful. Would love to see the result.

Dominion-Network (author)Ugifer2012-07-25

I've got a fair few power supplies laying around gathering dust, I knew you could use them for bench supplies... but this will defo come in handy...

arnefl (author)2012-06-17

Thank you for this information! Not so much for the Arduino control, but for the info about the ATX.

I started right away changing one of my previous projects. Now I can use that powersupply on standby; 5v 1.2A. I can start it up to full power with an on/off switch, or it turns itself on if I connect anything that needs power from 12v, 5v or 3.3v. :-)

Ugifer (author)arnefl2012-06-17

Thanks!

That's the great thing about instructables - whatever you do others will find great applications for it that you either never thought of or never had time to pursue. Glad to be of help.

About This Instructable

82,436views

118favorites

License:

Bio: Call me Ugi. Special offer! Make something based on one of my instructables and post a picture for a free 3-month pro membership (while stocks ... More »
More by Ugifer:Handheld Pong & Invaders on the cheap (Arduino compatible)Kid's Science Project - Reusable Hand WarmersMake a High-Altitude Balloon Tracker (Arduino)
Add instructable to: