Using Dracal Instruments under Linux

1) Obtaining the sources

At the moment, the linux version of the tools is only distributed as source code. They can therefore be compiled and used regardless of the linux distribution (eg: Debian, Ubuntu, Fedora...) and also regardless of the CPU architecture (eg: x86, amd64, arm, powerpc...).

The latest sources are available on the Software page. Please make sure you get the most recent version.

2) Compiling the command-line tool usbtenkiget

Even if you plan on mostly using the QTenki GUI, compiling the command-line tool first is recommended. Since this tool that will allow you to confirm your sensors are working properly.

Make sure your system has the following software/libraries installed:

  • gcc (The GNU C compiler)
  • make (GNU make utility)
  • libusb (install the development package. Under debian: libusb-dev)
  • pkg-config

Then extract the files where convenient and enter the client/ subdirectory. Simply type make. A few moments later, the usbtenkiget executable should have been created in the current directory.

3) Using usbtenkiget and usbtenkical

In order to allow you to quickly start using our command line tools, a complete documentation of usbtenkiget and a complete documentation of usbtenkical are available. As with most command line tools, help can be displayed using the -h option. Two other important options are shown below for the usbtenkiget tool.

Information about currently connected USB sensors can be displayed using the -l command, as shown below:

./usbtenkiget -l
Found: 'USBTenki', Serial: 'B10004', Version 1.2, Channels: 11
    Channel 0: Sensirion SHT1x/7x Temperature [Temperature]
    Channel 1: Sensirion SHT1x/7x Relative Humidity [Relative Humidity]
    Channel 2: MPX4115 Absolute air pressure sensor [Pressure]
    Virtual Channel 256: Dew point [Dew point]
    Virtual Channel 257: Humidex [Humidex]
    Virtual Channel 258: Heat index [Heat index]

Only one sensor Dracal (USBTenki) with serial number B10004 was connected when the above command was executed. This sensor has 3 real channels (measured data) and 3 virtual channels (values computed from the measured data). Each channel, real or virtual, has an ID that can be used to query its value.

Note: If no sensor is detected, a possible reason might be that the user you are running the tool as does not have the required access rights. Please consult the section on configuring access permissions for details.

The value for a channel is retrieved by passing the channel IDs to the -i command. When more than one channel is required, IDs are separated by commas as below. The returned values are also separated by commas and are outputted in the order they were requested:

./usbtenkiget -i 0,1,256
22.46, 39.55, 8.02

The above output can be redirected to a script where the values can then be split and processed. But if you are just displaying the values, try -p (pretty output) for a more human-friendly output with units. Speaking of units, have a look to the the documentation for how to change them.

4) Compiling QTenki

Make sure your system has the following software/libraries installed:

  • gcc (The GNU C compiler)
  • g++ (The GNU C++ compiler)
  • make (GNU make utility)
  • libusb (install the development package. Under debian: libusb-dev)
  • libqt (development package. Under debian: libqt4-dev)
  • qmake (QT Makefile generator tool. Under debian: qt4-qmake)

Then extract the files where convenient and enter the qtenki/ subdirectory. Type qmake to generate a makefile followed by make. A few minutes later, the qtenki executable should have been created in the current directory.

5) Common issue: Access permissions

A common reason for no sensors being detected even though they are connected properly is access permissions. If you just run the tools (Qtenki or usbtenkiget) as a regular user without performing any access configuration, this is what usually happens.

As a quick test to make sure the problem is not elsewhere, you can try running usbtenkiget as root. This working will confirm the issue is a simple permission matter. But unless you have your reasons to do so, just running usbtenkiget or qtenki as root is not recommended. Rather, the device should be assigned to a specific user or group as you deem appropriate.

A very convenient way of automatically configuring access permissions to your USB sensors is with udev, the Linux dynamic device manager. An example configuration file is supplied in the scripts/ subdirectory under the name 99-usbtenki.rules.

As-is, the file sets the group of Dracal sensors to plugdev with 664 permissions (User and group RW). On a Debian system, copying this file to /etc/udev/rules.d will allow users of the plugdev group to access the sensors.

Note that you may need to edit the file depending on your Linux distribution and/or your application.