Integrating Dracal sensor data into LabVIEW using command-line tools

dracal-sensgate-get

1. Introduction

This page presents a simple method for using Dracal Technologies 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 DracalView data logger, in fact all our USB sensors, can be readily used from LabVIEW through a command-line tool supplied with DracalView version 2.1.1 or newer. If you'd like to integrate data from your VCP products communicating via the COM protocol, a LabVIEW integration tutorial with this protocol is also available here.

2. Prerequisites

3. Our installation

This tutorial is based on a precision all-in-one air pressure, temperature and relative humidity sensor VCP-PTH450-CAL whose unique serial number is E21833. The operating system on which the model has been built is Microsoft Windows 11.

 

4. Identifying your sensor and the available channels

The first step is to install DracalView. After installation, you can connect your sensors and start DracalView to confirm that everything is working, but be sure to close DracalView afterwards. For example, below we've opened DracalView to quickly see which channels are available and if the data is as expected:


To integrate the data into our LabVIEW VI, we will use the command-line tool dracal-usb-get.exe that was installed with DracalView. We will execute dracal-usb-get with the -l option to display a list of available sensors:

C:\Program Files (x86)\DracalView>  dracal-usb-get -l
Found: 'VCP-PTH450-CAL', Serial: 'E21833', Version 2.10, Channels: 7
    Channel 0: MS5611 Pressure [Pressure]
    Channel 1: SHT31 Temperature [Temperature]
    Channel 2: SHT31 Relative Humidity [Relative Humidity]
    Virtual Channel 256: Dew point [Dew point]
    Virtual Channel 257: Humidex [Humidex]
    Virtual Channel 258: Heat index [Heat index]
    Virtual Channel 262: Altitude [Height]

 

Besides the sensor unique serial number, the above excerpt also contains other vital information: The channel list with their respective number and function. In the present situation, our sensor E21833 offers 7 channels. For instance, Channel 0 is an atmospheric pressure reading, Channel 1 is a temperature reading, Channel 2 is relative humidity and so on. 

IMPORTANT: Note that virtual channel numbering differs between DracalView and command-line tools, and this is this last one we need to use in our model. For instance, the DewPoint virtual channel number is #03 in DracalView but #256 in dracal-usb-get.

Write down the channel numbers as returned by dracal-usb-get that you need for your LabVIEW application.

With dracal-usb-get, 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 serial number 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. For more information, consult the comprehensive documentation of dracal-usb-get.

Here is an example where our sensor with serial number E21833 channel 0 (atmospheric pressure) is displayed:

C:\Program Files (x86)\DracalView>  dracal-usb-get -s E21833 -i 0
101.80

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 are fetched:

C:\Program Files (x86)\DracalView>  dracal-usb-get -s E21833-i 0,1,2
101.79, 24.20, 46.83

The above list of the 3 real channels is what we will display in our model.

5. The model

Download Icon  Downloadable file corresponding to the model below: Dracal_CLI_Example.vi 

Here are the block diagram and front panel of the model:

 

Block Diagram

 

Front Panel

 

The step-by-step reconstruction of this model is illustrated below. Click on any image to enlarge it:

 

6. Other considerations

The points below should be taken into account during use and design:

  • To prevent errors, DracalView should not be used when the LabVIEW application is running.
  • To prevent errors, more than one (1) instance of dracal-usb-get.exe should never be used. If this is a limiting factor, we advise you to consider a product with the COM protocol (VCP) communication option and follow this guide.
  • 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.