Enable your Raspberry to control relay, led, sensor and digital input remotely with Phidget WebService. βThe Phidget WebService is a background process that broadcasts all events and data from a USB Phidget over the network: It uses link local addressing which allows you to use simple server names in your code. The link local addressing is provided by the programs Bonjour, avahi, or mDNSResponder, depending on your system, and the correct program is either installed already or with the Phidget libraries. You can listen to the Phidget data and control the Phidgets over the network using one or more computers.β More info
You need a Raspberry with Raspbian preinstalled, a Phidgets IO Board, I use a 1011_0 β PhidgetInterfaceKit 2/2/2, a small usb Dongle with 2 Analog Inputs, 2 Digital Inputs and 2 Digital Outputs, two analog sensor, in this tutorial I use a 1133_0 β Sound Sensor and a 1142_0 β Light Sensor 1000 lux, two led connected to digital output, one toggle switch and a Miniature Magnetic Contact Switch connected to digital input.
Step 1: Install Phidget Library
Update the packages with
sudo apt-get update
and
sudo apt-get upgrade
Install libusb (Library for programming USB applications without the knowledge of Linux kernel internals).
sudo apt-get install libusb-1.0-0-dev
download and install the Phidgets libraries.
wget http://www.phidgets.com/downloads/libraries/libphidget.tar.gz
then
tar zxvf libphidget.tar.gz
move in the decompressed folder, in this example
cd libphidget-2.1.8.20150410/
From the main unpacked libraries directory, run:
./configure
make
this takes a long time, you can go get a coffee
sudo make install
This will compile phidget21.h and place the library into your gcc path
Step 2: Install the WebService
Download the webservice
wget http://www.phidgets.com/downloads/libraries/phidgetwebservice.tar.gz
then
tar zxvf phidgetwebservice.tar.gz
move in the decompressed folder in this example
cd phidgetwebservice-2.1.8.20150410/
From the unpacked WebService source code directory, run:
./configure
make
sudo make install
This will compile the executable phidgetwebservice21 and place it into /usr/bin/phidgetwebservice21Create a file to manage start and stop for the webservice
sudo nano /home/pi/phidgetwebservice
For more detail: Remote control with Raspberry Pi and Phidget WebService