New to Linux, Python, and Labjack ADCs | LabJack
 

New to Linux, Python, and Labjack ADCs

5 posts / 0 new
Last post
nieuwenhout
nieuwenhout's picture
New to Linux, Python, and Labjack ADCs

I am constructing a remote magnetometer station to be deployed in the field so I need to create a low power system to read the values coming off of the magnetometer and save them to a file.

I have set up the LabJack software on Windows to familiarize myself with the ADC but now I have to set up a command-response program on Linux Python that requests values from AIN 0,1 and 2 at Resolution=12 on the LabJack U6-Pro.  I have looked through the documentation for installation of the LabJackPython, however, I am still not sure how to set it all up.  I'm sure there are other people wondering this and I was wondering if someone knew a step-by-step process to install the needed software and maybe some common python commands for retrieving from the AIN and changing the resolution. 

It is a lot to ask but thank you in advance.

LabJack Support
labjack support's picture
For Linux installation you

For Linux installation you first need to install the Exodriver, the Linux / Mac OS X USB library, and then install LabJackPython. Requirements and installation instructions can be found on their pages:

https://labjack.com/support/software/installers/exodriver
https://labjack.com/support/software/examples/ud/labjackpython

If using Ubuntu or Debian based Linux distribution we have a step by step Exodriver and LabJackPython installation instructions here:

https://labjack.com/support/software/installers/exodriver/mac-and-linux/...

Installation is similar in other distributions, though you need to find the equivalent apt-get calls to install required software.

Examples are in the LabJackPython download. In particular, u6allio.py reads multiple analog inputs in a loop. The LabJackPython page mentions how to get Python documentation. For example, for documentation on AIN24 used in u6allio, use Python help like so:

import u6
help(u6.AIN24)

If you run into issues, please describe where you are running into issues during installation or in Python show code what you have tried.

LabJack Support
labjack support's picture
Here's a simple example that

Here's a simple example that reads AIN0-AIN2 with resolution index 12 on a U6-Pro.

File Attachment: 
plasticsrob
grupoplastics4.0's picture
For a T7 what would be the

For a T7 what would be the difference in the code???

LabJack Support
labjack support's picture
The T7 uses the LJM library

The T7 uses the LJM library/interface, and code will differ from using the U6 with the LabJackPython interface. Refer to the LJM Python examples here:

https://labjack.com/support/software/examples/ljm/python

In particular, refer to its Examples\More\AIN\dual_ain_loop.py example which configures and reads from AIN0 and AIN1 in a loop, and is easy to modify for 3 analog inputs.