/UTIcode

Python code for interfacing with the Universal Transducer Interface evaluation boards from SmartTec

Primary LanguagePython

UTIcode

Python code for interfacing with the Universal Transducer Interface evaluation boards from SmartTec. This code has been tested extensively on Windows 10 and Windows 7, and briefly on Linux Mint.

Target Python version = 2.7 Python dependencies: numpy, time, os, io, serial

Description of files:

  • UtiClass.py: Lowest-level interface with UTI board over serial connection. Handles all reading and writing to/from the UTI board. Defines all methods and attributes of the Uti class object. This is general, and can be used with the UTI in any mode (though it has only been tested in the 5-capacitor mode).
  • LevelSensorClass.py: Interface between an executable python script and the Uti class object. This defines all the methods for the LevelSensors class object. This is specific to the 5-capacitor, 0-2 pF mode of the UTI, though could easily be adapted to other modes. If you are running in this mode, nothing needs to be changed in either of the class definition files.
  • RecordData.py: Example usage of the class objects. This is a simple wrapper for the LevelSensors class. In it you set the path where you want your data to be saved, and how to save the data. The code is capable of writing a CSV or binary file with the data, make this choice on line 7. You can also save either the 5 raw hex numbers that come from polling the UTI, or the capacitance data of the three level sensors (calculated from combinations of the 5 raw measurements), make this choice on line 6. You may also change the sampling rate, by defining the time in seconds between successive meaurements, make this choice on line 8.

Warning: Not all error modes have been tested, thus there may be error conditions which are not handled. Please submit a git issue if you find one of these cases.