Phidgets Stepper Motor controller install for Python

Related: Phidgets Matlab install

1. Python Phidgets Driver install

Phidgets Prereqs are distinct for Linux, Mac and Windows.

Linux

sudo apt install autoconf gcc libusb-1.0-0-dev make

Mac

brew install gcc

Windows

Install MinGW-W64 compiler (GCC, GFortran) using options:

Architecture Threads Exception
x86_64 posix seh

2. Install Phidgets libraries for Python

  1. Download Phidgets Libraries
  2. Install Phidgets Libraries. For Mac and Windows just run the installer. For Linux:

     tar xf libphidget22*.tar.gz
     cd libphidget22*
    
     ./configure
     make -j4
     sudo make install
    
  3. Download Phidgets Python API, extract and then install Phidgets Python API with command

     python setup.py install
    

    Note that currently PyPi has Phidgets 2.1.x, which is obsolete.

  4. reboot

Test Python API

Phidgets Python Examples

Troubleshooting

THESE COMMENTS ARE FOR OBSOLETE Phidgets 2.1.x. I have not yet updated the text below for Phidgets 2.2.x.

RuntimeError: Platform not supported

The Python Phidgets 2.1.8 library was last updated in 2014, and so it’s a little out of date. For Linux systems, fix this by editing in the following places under your Python install’s site-packages/Phidgets/

  • PhidgetLibrary.py line 23, change from sys.platform == 'linux2': to

      elif 'linux' in sys.platform:
    
  • Devices/Stepper.py line 61, change the end from or sys.platform == 'linux2': to

      or 'linux' in sys.platform:
    
  • PhidgetException.py line 32, change from sys.platform == 'linux2': to

      elif 'linux' in sys.platform:
    
  • For Linux only, copy udev rule so that you don’t have to use sudo for all programs using the Phidget controllers:

      cp udev/99-phidgets.rules /etc/udev/rules.d/
    

Reference

Phidgets Python Install

Leave a Comment