wjUL - Python UniversalLibrary for Linux

wjUL is a Python wrapper for Warren Jasper's mcclibhid library. wjUL runs on Linux, but endeavors to be compatible with PyUniversalLibrary, which runs on Windows. Eventually, wjUL may support more devices than the USB devices supported by the mcclibhid library.

Andrew Straw is the author of wjUL.

Release history

(See the Download and install section to download.)

wjUL - the Python package
  • 2007-12-04 - released version 0.2.1 (fixes minor packaging bugs)
  • 2007-11-26 - released version 0.1
mcclibhid - the Ubuntu package of Warren Jasper's code
  • 2007-11-26 - released version 1.21-0ads4

Download and install

1. Install Warren Jasper's mcclibhid library. On Ubuntu Gutsy (7.10) i386, this is available at libmcclibhid_1.21-0ads4_i386.deb. You can test this program, and your USB1208FS device, by typing "testusb1208FS" at the command prompt. You should get a text-based menu system that allows you to blink the light, perform analog output and input.
2. Install the wjUL library. On Ubuntu Gutsy (7.10) i386, this is available at python-wjul_0.2.1-0ads1_all.deb. The source code, containing example programs, is python-wjul_0.2.1.orig.tar.gz.

Usage Notes

You may need to unplug and re-plug the USB device to get permissions to access it.

Simple Usage Example

Here is an example program (included with the source as examples/analog_input_scan.py). After downloading and installing wjUL, numpy, and matplotlib, run this Python script:

import wjUL.UL as UL
import numpy
import pylab

BoardNum = 0

LowChan = 0
HighChan = 0

Count = 1000
Rate = 1000

ADData = numpy.zeros((Count,), numpy.int16)
Rate = UL.cbAInScan(BoardNum, LowChan, HighChan, Count,
                    Rate, Gain, ADData, Options)

ADData_volts = [ UL.cbToEngUnits(BoardNum, Gain, adc_unit) for adc_unit in ADData]

time = numpy.arange( ADData.shape[0] )/float(Rate)

pylab.plot( time, ADData_volts )
pylab.xlabel( 'time (sec)')
pylab.ylabel( 'ADC input (V)')

Work in Progress

I have only tested the analog input and output capabilities of the USB1208FS device. I do not expect other devices or components of this device to work, although I don't anticipate adding support would be particularly difficult.

Page last modified Wed Oct 1 17:56:14 2008.