Using Dracal sensors under Linux

[Last Updater: 03/07/2023]

Linux logo

1) Obtaining the source code

Currently, the tools for Linux are only available in source code form. They can be compiled and used whatever your distribution, for example, Ubuntu (Debian) or Fedora, and whatever your architecture (e.g., x86, amd64, arm, powerpc...)

The latest version of the software is available from the Software page. Be sure to download it.

Procedure for Debian-based distributions (Raspberry Pi OS, Ubuntu, etc.)

2) Compiling the dracal-usb-get command-line tool

Even if you plan to use the DracalView GUI as your primary tool, we recommend you start by compiling the dracal-usb-get command-line tool. Because it has fewer dependencies, it is easier to compile and a good starting point to quickly confirm that your sensors are working correctly.

Using a terminal, make sure you have the most up-to-date software and libraries by typing commands:

sudo apt-get update && apt-get upgrade
sudo apt-get install build-essential pkg-config libusb-1.0-0-dev 

Unpack the archive to the location of your choice, then enter the client/ directory. There, simply run the make command. The /build folder thus created contains two others, including /bin which contains the executable file dracal-usb-get.

3) Using dracal-usb-get and dracal-usb-cal

To get you started quickly with our command-line tools, full documentation for dracal-usb-get and full documentation for dracal-usb-cal are provided. As with most command-line tools, help can be displayed using the -h option. Two other important options are shown below for the dracal-usb-get tool.

You can display information about currently connected USB sensors via the -l command, as shown below:

./dracal-usb-get -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]

In the above example, only one Dracal sensor (USBTenki) with serial number B10004 is present during the command execution. This sensor has three real channels (measured data) and three virtual channels (calculated data from the measured data). Each channel, either real or virtual, is identified by a number allowing its interrogation.

Note: If no sensors are detected, likely, your user account does not have the required rights. See the section on configuring access rights if necessary.

The value of a channel can be retrieved by submitting the corresponding number to the -i command. When more than one channel is required, the identifiers are separated by commas, as shown below. The returned values are also separated by commas and are displayed in the requested order:

./dracal-usb-get -i 0,1,256
 22.46, 39.55, 8.02

The above output text can be redirected to a script that can easily separate and process the data. If it's just for display, try the -p (pretty output) option for a more user-friendly display with units of measure. Speaking of units, if you need to change them, see the dracal-usb-get documentation for details.

4) Compiling DracalView

Make sure you have the required dependencies for the command-line tools, then complete the installation of the necessary libraries/software by typing:

sudo apt-get install qt5-qmake qtbase5-dev qtbase5-dev-tools qtscript5-dev 

Or, for versions before Ubuntu 22.04:

sudo apt-get install qt5-qmake qt5-default qtscript5-dev

Enter the dracalview/ directory. From there, run the qmake command followed by make. A few minutes later, the dracalview executable should have been generated in the same directory.

Then type

./dracalview

from the /dracalview/build folder to run it.

Then, the graphical interface is used as shown in these different videos or written tutorials.

5) Common problem: Configuration of access rights

When no sensor is detected, even though it is properly connected, it is often a permissions problem. This usually happens when the tools (DracalView or dracal-usb-get) are compiled and run without any permissions configuration.

A simple test to confirm that it is a permissions problem is running dracal-usb-get as root. If this works, it is a permissions problem. Unless you have reasons, using this software as a super user is not recommended. Instead, be sure to assign a specific group or user to the sensor, depending on the constraints of your application.

An effective way to ensure the automatic configuration of Dracal USB sensor access parameters is via udev, the dynamic Linux device manager.

To do this, you must assign the user to the plugdev group by typing these two command lines:

sudo getent group || sudo groupadd plugdev
sudo usermod -a -G plugdev $(whoami)

Next, you need to create a file named 99-usbtenki.rules placed here /etc/udev/rules.d (which requires administrator rights), which should contain the following information:

ATTR{idVendor}=="1781", MODE="0664", GROUP="plugdev"
ATTR{idVendor}=="289b", MODE="0664", GROUP="plugdev"

Finally, disconnect any Dracal instruments from your computer and restart the udev device manager by typing:

sudo service udev restart