datalogd.plugins.picotc08_datasource module

class datalogd.plugins.picotc08_datasource.PicoTC08DataSource(sinks=[], interval=1.0, mains_rejection='50Hz', probes=[[1, 'Channel_1', 'K', 'C'], [2, 'Channel_2', 'K', 'C'], [3, 'Channel_3', 'K', 'C'], [4, 'Channel_4', 'K', 'C'], [5, 'Channel_5', 'K', 'C'], [6, 'Channel_6', 'K', 'C'], [7, 'Channel_7', 'K', 'C'], [8, 'Channel_8', 'K', 'C']])[source]

Bases: datalogd.DataSource

Obtain readings from a Pico Technologies TC-08 USB data logging device.

The drivers and libraries (such as libusbtc08.so on Linux, usbtc08.dll on Windows) from PicoTech must be installed into a system library directory, and the picosdk python wrappers package must be on the system (with pip install picosdk or similar).

On Linux, read/write permissions to the USB device must be granted. This can be done with a udev rule such as:

/etc/udev/rules.d/51-picotc08.rules
# PicoTech TC-08
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="0ce9, ATTRS{idProduct}=="1000", OWNER="root", GROUP="usbusers", MODE="0664"

where the idVendor and idProduct fields should match that listed from running lsusb. The usbusers group must be created and the user added to it:

groupadd usbusers
usermod -aG usbusers yourusername

A reboot will then ensure permissions are set and the user is a part of the group (or use udevadm control --reload and re-login). To check the permissions have been set correctly, get the USB bus and device numbers from the output of lsusb. For example

lsusb
Bus 001 Device 009: ID 0ce9:1000 Pico Technology 

the bus ID is 001 and device ID is 009. Then list the device using ls -l /dev/bus/usb/[bus ID]/[device ID]

ls /dev/bus/usb/001/009 -l
crw-rw-r-- 1 root usbusers 189, 9 Mar 29 13:19 /dev/bus/usb/001/009

The middle “rw” and the “usbusers” indicates read-write permissions enabled to any user in the usbusers group. You can check which groups your current user is in using the groups command.

Note that you may also allow read-write access to any user (without having to make a usbusers group) by changing the lines in the udev rule to MODE="0666" and removing the GROUP="usbusers" part.

The interval parameter determines how often data will be obtained from the sensors, in seconds. The minimum interval time is about 0.2 s for a single probe and 0.9 s for all eight.

The mains_rejection parameter filters out either 50 Hz or 60 Hz interference from mains power. The frequency is selected as either "50Hz" or "60Hz".

The probes parameter is a list of probe to initialise. Each element is itself a list of the form [number, label, type, units], where probe numbers are unique integers from 1 to 8 corresponding to an input channel on the device. Probe labels can be any valid string. Valid probe thermocouple types are "B", "E", "J", "K", "N", "R", "S", "T", or "X", where "X"" indicates a raw voltage reading. Units are one of Celsius, Fahrenheit, Kelvin, Rankine specified as "C", "F", "K" or "R". For the "X" probe type, readings will always be returned in millivolts.

If the device cannot be found or initialised, or the device is unplugged during operation, regular reattempts will be performed. Note that this means that an exception will not be raised if the device cannot be found.

Parameters:
  • interval – Time interval between readings, in seconds.
  • mains_rejection – Mains power filter frequency.
  • probes – List of probes and configuration parameters.
close()[source]

Close the connection to the Pico TC-08 device.