Using Dracal products within LabVIEW

This page presents a simple method for using Dracal technologies inc. sensors within LabVIEW, a popular platform developed by National instruments which thanks to its simple but powerful visual programming language, greatly eases the creation of control and data acquisition systems. To learn more about LabVIEW, please visit the National instruments website.

All the products supported by our QTenki data logger, in fact all our USB sensors, can be readily used from LabVIEW through a command-line tool supplied with QTenki version 2.1.1 or newer.

1) Requirements:

  • QTenki version 2.1.1 ou newer
  • LabVIEW
  • Basic command-line usage knowledge.
  • Basic LabVIEW knowledge.

2) Identifying your sensor(s)

The first step is to install QTenki, which will also install the required USB drivers for communicating with our products. Following the installation you may connect your sensors and start QTenki to confirm everything works, but make sure to close QTenki afterwards.

Indeed, we will rather be using the "usbtenkiget.exe" tool that was installed with QTenki. From the start menu, type "cmd.exe" in the execute (or "search" if running Win7) box to open a command processor. Then navigate to the QTenki installation directory. Typical examples: « cd "c:\program files (x86)\QTenki" » (64 bit system) or « cd "c:\program files\QTenki" » for a 32 bit system.

You may then execute usbtenkiget.exe with the -l option to display a list of available sensors:

Two sensors were connected to the computer when the above screenshot was taken. Each sensor manufactured by Dracal technologies inc. has an unique ID which makes it possible to use as many as you need on the same system without ambiguity. In the example at hand, these are ID numbers "SE95_0" and "B10004". Take note of the (case sensitive) ID of the sensor(s) you intend to use.

3) Obtaining the channel ID for the data you need

Besides the sensor ID number, the screenshot above also contains other vital information: The channel list with their respective number and function. For instance, sensor "B10004" above offers 7 channels. Channel 1 is a temperature reading, Channel 2 is relative humidity and so on. Write down the channel numbers you need for your LabVIEW application.

With usbtenkiget.exe, a selection of channels can be read and their value displayed in a program-friendly format to be interpreted by another software (LabVIEW in this case). The sensor ID is specified using the -s option and the channel(s) to be fetched using the -i options. Other command-line options are available and can be used, for instance, to change measurement units or the display precision. Simply execute "usbtenkiget.exe -h" for more information.

Here is an example where sensor ID "SE95_0" channel 0 (temperature) is displayed:


To fetch and display several channels at once, simply specify them as a comma-separated list to the -i option. In the example below, channels 0, 1 and 2 from sensor ID "B10004" are fetched:


4) Executing an external program from LabVIEW

Once the data acquisition command based on usbtenkiget.exe is built and tested, our next goal is to have LabVIEW execute this command and interpret its output, making the data available in the block diagram. "System Exec.vi", found in the Functions panel->Connectivity->Librairies & Executables, is perfect for the task:


Here is a complete example. The command-line (in this case "c:\program files\QTenki\usbtenkiget.exe -B 10004 -i 0,1,2") is a parameter supplied to "System Exec" using a string constant. The command output is then split (using the comma string constant to specify the separator) and interpreted as a list of floating point values (Henre the "%f" format string), and finally placed in a table where each row contains the data for a single channel. In the example below, the data is then extracted from the table and routed to the appropriate graphic elements.

Block diagram:


Front panel:


5) Other considerations

The points below should be taken into account during use and design:
  • To prevent errors, QTenki should not be used when the LabVIEW application is running.
  • To prevent errors, more than one (1) instance of usbtenkiget.exe should never be used.
  • As each capture implies starting an external tool, the maximum sampling rate might not be very high. (More or less 1 second can be expected, but it ultimately depends on several factors such as the type of sensor(s), the sensor version and how many channels are being read.
  • Dracal technologies inc. products must never be used to build life-critical systems.

LabVIEW is a trademark of National Instruments. Neither Dracal Technologies inc., nor any software programs or other goods or services offered by Dracal Technologies inc., are affiliated with, endorsed by, or sponsored by National Instruments.