Python code usage and first steps

20 April 2014

In this article, we aim to make a compilation of the different ways there are to control openDAQ from a PC, under different approaches. 

We will refer only to material created in Python for openDAQ. There is also a repository for LabVIEW programs, with similar features, although it is still in an alpha stage of development. 

First of all, remember that currently the applications available for openDAQ are: 

  1. A low level library, with unitary functions that allow detailed control of every different option in the device. 
  2. Some GUI applications, created as demo programs, that allow users to test the main functions and characteristics of the system.

Downloading the binaries of the GUI programs

Of course, the easiest way to start using openDAQ is downloading the binary executables for Windows of the two main demo programs: openDAQ and DAQControl. These programs can be used directly, and you will only eventually need to install the USB driver to start making experiments with the device.

 

Installing the control library

If you want to use other features beyond the options offered in these demos, then the first step should be installing the low-level control library, daq.py. 

The steps are as follows: 

• Install Python 2.7.6 by downloading it from www.python.org 

• Download "opendaq" package from github (https://github.com/openDAQ/opendaq-python) and install it by running "python setup.py install" command 

• Install "pyserial" package by downloading it from "pyserial.sourceforge.net" 

Or, simpler, if you have installed "pip", just install the package from the Python package index: "pip install openDAQ" 

In either case, and especially if you want to develop source code, it is useful to get a virtual environment system for Python, like "virtualenvwrapper".

Installing the source code for the GUI demos

To install the sample GUI programs available in the repository ( https://github.com/openDAQ/opendaq-gui) the procedure is more or less the same, although these programs have some additional dependencies, which complicates manual installation:

• Install "opendaq" package by following the steps above.

• Install "setuptools" package by downloading it from "pypi.python.org/pypi/setuptools"

• Install "wxPython" package from "www.wxpython.org"

• Install "numpy" package from "www.numpy.org"

• Install "matplotlib" downloading from "matplotlib.org" 

• Install "dateutil" from "labix.org/python-dateutil"

• Install "pyparsing" package downloading it from "pyparsing.wikispaces.com"

In Windows, you will need to include the route "C:\Python27\Scripts" into the system "Path" variable, if it does not exist (System->Advanced Settings).

In any case, and much easier, you can always perform the installation by running the "setup.py" available in the repository root .