MEAM.Design - Phidgets



The Phidget Interface Kit 8/8/8


Shown above is the Phidget 8/8/8 USB interface board, which gives you 8 digital inputs, 8 digital outputs, and 8 analog inputs (the manual for the board can be found here: Phidget 8/8/8 Manual (1.9MB PDF), and if you want to run this in a computer outside of the GM or Towne 205 labs, you'll need the drivers from here).



Getting Started with Matlab


To start using the Phidget, you'll need to download and extract this zip file, which contains the low-level code that Matlab will use to communicate with the Phidget board over the USB port. Once you've extracted this somewhere, create a new Matlab script in the resulting folder. Within the script, you can use the following commands to interact with the Phidget board:

startIK; - Initialize the Phidget (you MUST do this before anything else with the Phidget). If told that no compiler is selected, type "mex -setup", and select either of the Visual Studio compilers. Then type "clear all" to remove all variables from the workspace and try "startIK" again.

stopIK; - Release the Phidget (you MUST do this when you're done with the Phidget).

getAIN(n); - Read an analog input value, where 0<n<7 corresponds to the analog channel. The value returned will be between 0 (0V) and 831 (5V).

getDIN(n); - Read a digital input, where 0<n<7 corresponds to the digital channel. The return value will be 0 (0V) or 1 (5V).

setDOUT(n,s); - Set a digital output, where 0<n<7 corresponds to the digital channel, and s must be either 0 (0V) or 1 (5V).



Analog Connections


We have a large collection of pre-made analog cables which look very similar to what is show below. The RED wire is +5V, the BLACK wire is ground, and the WHITE wire will be your analog signal.

If you need to build your own connector, the necessary parts are available in the GM mechatronics mini store.



The Phidget Servo Controller


Shown above are the Phidget 1066 (single motor) and 1061 (eight motor) Advanced Servo controllers (the manuals for the boards can be found here: 1066 Manual, 1061 Manual, and if you want to run this on a computer outside of the GM or Towne 205 labs, you'll need the drivers from here, unless you've already installed them for the Interface Kit 8/8/8).

To start using either of these servo controllers, you'll need to download and extract this zip file, which contains the low-level code that Matlab will use to communicate with the Phidget servo controller board over the USB port. Once you've extracted this somewhere, create a new Matlab script in the resulting folder (this can be the same folder as used for the IK). Within the script, you can use the following commands to interact with the Phidget board:

servoConnect; - Initialize the servo controller (you must do this first - note that the board must be connected to the computer before you execute this script)
servoRelease; - release the servo controller (you MUST do this when you're done with the board)
servoRun(channel); - enable the output for a particular servo channel
servoPause(channel); - disable the output for a particular servo channel (default)
servoTarget(channel,position); - set the target position for a particular servo channel. Position can be anywhere between -22 and 233.
servoCurrent(channel); - receive an analog value corresponding to the current draw for a particular servo channel (we believe this is in Amps).



Phidget Troubleshooting


  • Make sure you're running "mex -setup" as detailed on the wiki and using "clear all" afterwards.
  • Check connection on a number of different USB ports on the computer. You can check to see if the Phidget is actually connected to the computer by using the "Phidget Control Panel" under the "PACE" programs folder. Many of the front USB ports do not work in Towne 205.
  • Make sure you're not shorting power to ground. If your red cable is touching a black cable, that's really bad. It causes the USB port to try to shoot a lot of amps into the circuit, but it will eventually reach the limit where the USB port is shut off and won't recognize your device any more.


\\