I was going to get panel-mounted connections for the ethernet and HDMI but those connectors alone would've easily been $10. I can't claim complete credit, I saw a video on YouTube where the guy essentially put the Pi in the back, right-hand corner and connected up to the Pi. Good enough for me.
I used the existing posts to hold down the Pi. It's balanced on two posts, using the screws to hold it in place. It's quite stable.
The USB ports and the ethernet port are exposed in the back. I also used the expansion port to feed out my power line and the USB connection for my wireless dongle.
The HDMI is a little rescinded but still accessible.
I did have some NES switches lying around. I hard-wired the Power button to the input power. This directly powers the Pi. I also wired up the Reset button to be connected to a GPIO pin. This enables me to sense the button being pushed and send a software command to reset the Pi. This is better than simply disconnecting and connecting the power. The schematic is below:
The script I used for the software reset, which is created at
/home/pi/scripts/button_reboot.py
:
import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN)
while True:
if(GPIO.input(17)):
os.system("sudo reboot -h now")
break
time.sleep(1)
Placed in /etc/rc.local on the line before “exit 0″
python /home/pi/scripts/button_reboot.py
I'm using the Raspbmc image, so the GPIO library wasn't built-in; I had to install it before my script could work:
sudo apt-get install python-dev
sudo apt-get install python-pip
sudo easy_install -U distribute
sudo pip install rpi.gpio
Source:
Shutdown Script: http://www.3cc.org/blog/2013/01/raspberry-pi-shutdown-switch-safely-turning-off-the-pi/
No comments:
Post a Comment