In this instructable I will be showing you how to prepare a Raspberry Pi2 for use with a Phidgets Interfacekit 8/8/8
The Products from Phidgets allow you to connect sensors an actuators to your pc/pi/mac through the usb port. Most of the sensors do not require any soldering.
There are plenty of tutorials on how to prepare your Raspberry Pi, so I will skip that part.
I will be using the Raspbian – Debian Wheezy – Release date: 2015-05-05
I will assume that you have installed your Raspbian and know how to use the commandline.
I will be installing the phidgets libraries, the phidgets webservice and Nodejs. Finally I will show a very simple nodejs script to read an analog sensor, in my case a rotary encoder ( a potentiometer).
Step 1: Step 1: installing and compiling the Phidget Libraries
All Italic lines are commands in the shell.
First of all make sure that you have updated your pi2
sudo apt-get update
sudo apt-get upgrade
Because phidgets communicate via usb, libphidgets needs to have liubs-dev installed.
sudo apt-get install libusb-dev
make sure your are in your home-directory
make a directory where you will store some downloaded filee
now grab the libphidget libraries and unpack them
tar zxf libphidget.tar.gz
next we will configure the libaries , compile and install them
sudo make install
In theory your pi can now use the phidgetboards,
but we will go ahead and install the phidgetwebservice as well
The webservice will allow you to talk to your PhidgetBoards via the network.
First we get the needed files, unpack and compile and install them
tar zxf phidgetwebservice.tar.gz
sudo make install
Now lets start the webservice in the background
sudo phidgetwebservice21 -n myphidgetName &
Step 2: Step 2: Attaching the phidgetboard and sensor
Attach a PhidgetInterfaceKit 8/8/8 via usb and connect an analog sensor to it.
I am using a potentiometer that I had left. It has different wiring from the phidget sensors so be careful.
If you have a sensor from Phidgets just connect the cable to one of the black analog ports.
That’s it onto step 3
Step 3: Step 3: Installing Nodejs and writing a script to read values
We need to install NodeJs. You will need version 0.10.36
Here is how you can install it. First go back to your home dir.
now get the proper nodejs package, and install it
sudo dpkg -i node_0.10.36_armhf.deb
you can check that you have installed it correctly by running
it should output
now let’s make a directory for our project
and initialize a nodejs project, just hit return a couple of times to get de default values,
they are not important at this moment
In order to communicate with the webservice we need a node-module called phidgetapi,
let’s install it
npm install phidgetapi –save
For more detail: Using Phidgets on a Raspberry Pi 2