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:
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
Soldering iron & solder
Lighter to shrink the heat-shrink
An ATX power supply
A 5V microcontroller such as an Arduino
High power transistors etc to control stuff.
Step 2: 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
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
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:
To turn the main power back off, use:
Equally, to turn off, you could simply set it to:
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
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.
WillA25 made it!