But first I should mention that Felix reworked his circuit, replacing the relay with a power MOSFET, and dubbed it ATXRaspi R2.
The (discontinued) R1 had an issue with some (whimpy!) power supplies. When the relay closed, the immediate current draw by the R-Pi would sometimes cause the ATXRaspi to reset. When/if this happened, you'd need to hold the power button for a second or two, the relay would click on/off/on a few times, and then everything was fine.
The new ATXRaspi R2 completely solves that issue, by using a slightly slower turn on rate, via the MOSFET. On a related note, I posted a video about using power MOSFETs with Arduino or R-Pi, a while back.
OK, back to those build details I wanted to share. I wanted to keep all GPIO pins open and available for other projects, Pi-Cobbler, etc. So my solution was to use the P5 connector on the Raspberry Model B, Rev.2.
The P5 connector is "unpopulated" which simply means they didn't install the header pins. Which is fine by me, just made it easier to solder wires directly into the plated-through-holes.
Here's how I connected the ATXRaspi to the Raspberry Pi P5:
- Ground <-> P5-7
- +5V Output -> P5-1
- Input <- P5-4 (GPIO29)
- Output -> P5-3 (GPIO28)
And here's what it looks like:
(Observant readers might notice the ATXRaspi looks a little different. This was an R1 board, that I retro-fitted with a power MOSFET instead of the relay. You could call it R1.5 :-)
Note that the GPIO lines on P5 are different than any on P1, the main GPIO connector. Which is good, that's what I wanted. But that also meant I had to modify the shutdowncheck script:
#original from www.lowpowerlab.com
#modified by MikeT to use P5 on Rev 2 Pi
#instead of using any GPIO on P1
echo "ATXRaspi shutdowncheck script"
echo "(modified to use P5 on rev 2 Pi)"
echo "Setting P5-3 Input, Pull Down"
echo "Setting P5-4 Output, High"
gpio -g mode 28 in
gpio -g mode 28 down
gpio -g mode 29 out
gpio -g write 29 1
echo "If/when P5-3 goes high, SYSTEM WILL HALT"
while [ 1 ]; do
if [ "$(/home/pi/wiringPi/gpio/gpio -g read 28)" = "1" ]; then
echo "Pin P5-3 is High: SYSTEM WILL NOW HALT"
sudo sleep 0.5