RaspberryPi real-world control with REST API

Finally found some time playing with a RaspberryPi and an attached PiFace Interface board to control some garden pumps and potentially an Aquaponics setup in the near future. Requirements Raspberry Pi (Model B in my case, but any will do) PiFace Interface board (http://www.piface.org.uk) Base Raspian (Debian Wheezy) Install (I prefer the clean minimal install via https://githutb.com/hifi/raspbian-ua-netins). Configure the base system as per my previous base install. Install Apache & PHP sudo apt-get install apache2 php5 php5-dev php5-cli php5-mcrypt curl raspi-config Ensure mod-rewrite is enabled sudo a2enmod rewrite Install PHP SPI Extension More info: https://github.com/frak/php_spi git clone https://github.com/frak/php_spi.git cd php_spi ./phpize ./configure --enable--spi make make test make install Install PiFace REST API cd /var/www/ git clone https://github.com/natefanaro/piface-rest-api cd piface-rest-api curl -sS https://getcomposer.org/installer | php php composer.phar install Thanks to Nate Fanaro for the excellent work on the API. Make sure SPI is enabled on the RPi raspi-config Advanced Options --> A5 SPI --> yes Install PiFace Modules sudo apt-get install python3-pifacedigitalio python-pifacedigitalio sudo usermod -a -G gpio www-data sudo usermod -a -G spi www-data For more info visit http://www.piface.org.uk/guides. Apache2 API Configuration Enable SPI extension sudo vim /etc/php5/apache2/php.ini #add the following extension extension="spi.so" Apache VHost config sudo vim /etc/apache2/sites-available/piface Paste the following VHost config <Virtualhost *:80> ServerName HOSTNAME ServerAdmin webmaster@domain.com DocumentRoot /usr/share/piface-rest-api/public_html ErrorLog /var/log/apache2/piface_error.log CustomLog /var/log/apache2/piface_access.log combined <Directory /> AllowOverride All Order allow,deny Allow from all </Directory> </Virtualhost> Enable the newly created VHost a2ensite piface service apache2 restart Testing curl http://HOSTNAME/led/test/ Next up will be some modification for securing access to…

Continue Reading