- 'Download the GPIO JSON Server (Raspberry Pi & BBB)
- 'Connect to Host'
So, I went to the google machine, entered 'chilipeppr GPIO' into the search bar and came across this post from John Lauer. Basically, this feature will allow you to configure GPIO pins on the Raspi or Beagle Bone Black which can be controlled through the Chilipeppr interface. Sounds to me like we need a relay and we can remotely control our spindle (on/off, no speed) and vacuum!
Safety note: Do not mess with mains voltage! You can seriously shock yourself or even cause death. Please consult a professional.
Items used in this build: (purchasing through these affiliate links helps me to hack on)
- Raspberry Pi 2 Model B Project Board - 1GB RAM - 900 MHz Quad-Core CPU
- JBtek 4 Channel DC 5V Relay Module for Arduino Raspberry Pi DSP AVR PIC ARM
How to install GPIO JSON Server on a Raspi2
As with most of my raspi tutorials, please make sure download and install an OS for the Raspi. I chose Raspian - Here is an installation guide. Then make sure to update and upgrade your OS before continueing.
Step 1: Download and 'install' the server to your Raspi (<1 min)
To download the gpio-json-server directly on your raspi, type in:
wget https://github.com/benjamind/gpio-json-server/raw/master/gpio-json-server
Then to make the file executable...
sudo chmod +x gpio-json-server
And to run it...
sudo ./gpio-json-server
At this point you should be able to connect to your GPIO JSON server through chilipeppr by entering your Raspi-ip address into the GPIO widget.
Step 2: Automatically Start GPIO JSON Server on Boot (~2 mins)
If you followed step 3.1 from my X-Carve TinyG and Raspi post, you should have a file set up to start up the JSON server when your raspi boots up. If not, go back and look at that step first.
Now, we need to edit the auto-start script to include the GPIO JSON server as well.
First, we need to know the location you placed the gpio-json-server. Mine was located here:
/home/pi/gpio-json-server
Then we need to add this file location to the /etc/init.d/serial-port-json-server file:sudo nano /etc/init.d/serial-port-json-server
Within the file enter your gpio-json-server location from above after the '#do something" line as shown below in blue.
case "$1" in start) log_begin_msg "Starting Serial Port JSON Server service" # do something /home/pi/serial-port-json-server_linux_arm/serial-port-json-server -regex usb|acm & /home/pi/gpio-json-serverBe sure to add an '&' at the end of the line above the blue location to ensure both files are started. Then all we have to do is re-build the auto-start script.
sudo update-rc.d serial-port-json-server defaults
Step 3: Reboot Raspi and Enjoy (~2 mins)
Reboot your Raspi,sudo reboot
and enjoy GPIO control through Chilipeppr!Step 4: Hook up your relay
Go to the google machine and search 'Raspi relay' to learn how to wire up your GPIOs to a relay.Resources:
- https://github.com/benjamind/gpio-json-server/
- http://www.milbot.net/2015/09/x-carve-tinyg-and-raspi.html
- https://github.com/johnlauer/serial-port-json-server
- http://www.instructables.com/id/Web-Controlled-8-Channel-Powerstrip/