TIO Tools

Twinleaf's tio-tools repository holds several useful tools written in C for establishing communication with your Twinleaf device. They employ the libtio library.

The files in tio-tools can be accessed on GitHub. libtio is an included submodule. The tools compile and run on standard POSIX systems. To get a build environment use:

After making sure you have these prerequisites, clone the tio-tools repository, clone the submodule, build, and install. To do this, type the following commands into terminal:

% git clone https://github.com/twinleaf/tio-tools.git
% cd tio-tools
% git submodule update --init
% make
% sudo make install

tio-proxy

The proxy program is recommended for managing the serial port and offering the data to TCP clients. Multiple clients can simultaneously connect to the sensor and use the data.

If the sensor is connected to your machine via usb, use the command

% tio-proxy /dev/[usb-path]

to start the proxy. The [usb-path] should be replaced by your specific usb type and serial number (It will be in the form /dev/cu.usbXXXXXX for macOS and /dev/ttyUSB0 or /dev/ttyACM0 for Linux). The proxy program will not run on Windows unless you are using WSL. If you are using WSL, the [usb-path] will be /dev/ttySX. Once you have run this, simply leave the proxy open and continue working in a new terminal window. With the proxy running, the tiomon and itio tio-python commands can be run without specifying the usb connection.

Python has slow serial port operations, so using the proxy is essential when interfacing high-data-rate sensors with python programs.

tio-autoproxy

Similar to tio-proxy, tio-autoproxy automatically guesses the serial port. This is handy if your system has just one sensor attached and also doesn't have other serial peripherals. This tool automatically connects to USB CDC devices where the CDC ports show Twinleaf as the manufacturer. Presently this tool also attempts to connect to FTDI devices.

tio-firmware-upgrade

Tool used to upload new firmware to devices.

tio-dataview

Shows a human-readable log of the raw data arriving from the sensors.

tio-record

Logs raw data to disk:

% tio-record log.tio

Can be parsed using tio-logparse.

tio-logparse

Converts raw tio files to CSV files:

% tio-logparse log.tio

Can be opened in data science applications.

tio-rpc

Issues RPC (commands) to devices. For example:

% tio-rpc coil.x.current f32:5.0
% tio-rpc therm.pid.enable u8:1

For queries, leave off the value. It does not know how to format the response, so it offers several common interpretations based on the length of the response.

% tio-rpc dev.name
'microsam'

tio-sensor-tree

Lists devices connected to a sensor hub.