Introduction: BeagleBoneBlack PHP-GPIO
Before you start with this tutorial download this list:
• Putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
• WinSCP (http://winscp.net/eng/download.php)
• Editor (http://notepad-plus-plus.org/download/v6.5.html)
• 7-ZIP (http://www.7-zip.de/)
• Win32-DiskImager (http://sourceforge.net/projects/win32diskimager/)
• Debian Image (http://elinux.org/BeagleBoardDebian#eMMC:_BeagleBone_Black)
• 4GB microSD-card
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Flash Your BeagleBoneBlack
Extract the debian_flasher.img.xz with 7-ZIP
Select the extracted .img with Win32-DiskImager and copy it to your SD-card
Flash your beaglebone:
• insert the microSD-card into the slot on the back of the BeagleBone Black
• now click the User-Button. It’s located on the same side of the BBB as the microSD card slot.
• Hold the "User Boot" button down, and then plug in the power (USB or 5V adaptor). Keep holding down the button until you see the bank of 4 LED's light up for a few seconds. You can now release the button.
• It will take some minutes to flash the image to the on-board chip. (15-50mins)
• Once it’s done, the bank of 4 LED’s will all stay lit up at the same time. You can now remove the power and the microSD-card.
Step 2: Install the Webserver
Power on your BBB and connect with putty.
If you don’t know the IP-address of your BBB connect to the Web interface of your router and you will find it under connected devices.
Install the webserver:
• apt-get install apache2
• apt-get install php5 libapache2-mod-php5
• /etc/init.d/apache2 restart
Step 3: Add Your First Php-script
edit the etc/rc.local example for gpio 30:
• echo 30 > /sys/class/gpio/export
• chmod 666 /sys/class/gpio/gpio30/value
• chmod 666 /sys/class/gpio/gpio30/direction
• echo out > /sys/class/gpio/gpio30/direction
• exit 0
To power on a gpio30 you can use this php-command:
shell_exec("echo \"1\" > /sys/class/gpio/gpio30/value");
The default path of the webserver directory is: /var/www/
Now you can connect with winscp and the root user (user:root, pw:root) to this directory and add some of your php-scripts.
If you have any further questions, do not hesitate to contact me: