Friday, January 20, 2017

Connecting Phidgets on Linux


To get up and running Artisan under Linux using Phidgets is not completely trivial (but doable). While the installation of Artisan should not pose any problem if the installation instructions are followed, getting Artisan to read data from connected Phidgets needs some preparation.

To allow an app to accessing data from a Phidget requires the installation of a device driver on for the corresponding OS platform. Additionally, most modern Linux configurations restrict the access to USB devices to the root user by default. Here are instructions on how to install the Phidgets device driver and allow any user to access Phidgets connected via USB.


Phidgets driver installation


On Linux the phidgets driver has to be installed from source code. The compilation of this source requires the libusb-1.0 development libraries to be installed.

Install the libusb development package


Type the commands after the sharp sign into a terminal shell.

  • on CentOS/Redhat
# sudo yum install libusb-devel
  • Ubuntu/Rasbian/Debian
# sudo apt-get install libusb-1.0-0-dev

Install the Phidgets libs 


Download the libs from http://www.phidgets.com/downloads/libraries/libphidget.tar.gz

# cd /tmp 
# wget http://www.phidgets.com/downloads/libraries/libphidget.tar.gz

Compile and install the libs

# cd libphidget-*
# ./configure
# make
# sudo make install


Extend the USB access rules


Next we install the udev rules file for Phidgets to allow access to USB devices for non-root user. Note that this is documented in some detail in the Phidgets documentation for Linux under Advanced Uses.

# cd /tmp/libphidget-*
# sudo cp udev/99-phidgets.rules /etc/udev/rules.d

Now we have to either reboot or enter the following commands to restart the udev system respecting those new rules.

# sudo udevadm control --reload

EDIT: on some systems the udevadm command seems not to be enough to establish the new rules. A reboot should work in any case.

Configure Artisan


Finally, we need to select the Phidget type (here a 1048 module) as main device in Artisan via the Device Assignment dialog (menu Config >> Devices).


Thanks to Rob Gardner for his support on this!

No comments:

Post a Comment