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
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.
tar zxvf libphidget.tar.gz
move in the decompressed folder, in this example
From the main unpacked libraries directory, run:
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
tar zxvf phidgetwebservice.tar.gz
move in the decompressed folder in this example
From the unpacked WebService source code directory, run:
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