Interfacing openDAQ in a Linux O.S.

11 October 2013

In recent articles we have seen how to configure a Raspberry Pi to work together with openDAQ. Now, we will see a couple of things more about how to connect the openDAQ with a computer running a Linux (UNIX) OS.

Using a desktop GUI, like Gnome, we will be able to use not only the low-level library, "daq.py", but also the graphical demo programs EasyDAQ and DAQControl. 

As you know, these applications were created using Python (although there is also a version created in LabVIEW). Then, the first thing that you will need, in order to run those programs in Linux, is to have Python 2.7 and the correct libraries installed. You can use the apt-get utility:

  • Install Python (remember, it must be 2.X)
  • Install Numpy
  • Install Matplotlib dependencies (apt-get build-dep matplotlib)
  • Install Matplotlib

Most UNIX systems will automatically detect CP2102 USB bridge and enumerate openDAQ, so you will not need to download any driver. Like with the Raspberry Pi, you can check which ttyUSB* port is associated with openDAQ using the command dmesg. In our case it was the ttyUSB0.

To access to that port, you should have the appropriate permissions. You can use the command "ls-l / dev / ttyUSB0" to check if that port file is writable and readable. Try something like this: "sudo chmod 666 / dev / ttyUSB0" if you need to change permissions.

user@users-desktop:~$ dmesg

[ 9176.944026] usb 3-1: new full-speed USB device number 5 using uhci_hcd

[ 9177.164076] cp210x 3-1:1.0: cp210x converter detected

[ 9177.276026] usb 3-1: reset full-speed USB device number 5 using uhci_hcd

[ 9177.423133] usb 3-1: cp210x converter now attached to ttyUSB0

user@users-desktop:~$ ls -l /dev/ttyUSB0

crw-rw---- 1 root dialout 188, 0 oct 10 11:44 /dev/ttyUSB0

user@users-desktop:~$ sudo chmod 666 /dev/ttyUSB0

user@users-desktop:~$ ls -l /dev/ttyUSB0

crw-rw-rw- 1 root dialout 188, 0 oct 10 11:44 /dev/ttyUSB0

user@users-desktop:~$ cd /path/to/directory/

user@users-desktop:~$ python EasyDAQ.py

 

From this point, once you have the Python modules installed, and the appropriate permissions to access the device, everything is pretty straight forward. You just need to execute the demo scripts and the programs will behave  almost the same than in Windows:

user@users-desktop:~$ python DAQControl.py