Using Dracal sensors within LabVIEW

dracal-sensgate-get

1. Presentation

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. Requirements

  • DracalView version 2.1.1 or newer
  • LabVIEW
  • Basic command-line usage knowledge
  • Basic LabVIEW knowledge

3. Identifying your sensor(s)

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

Indeed, we will rather be using the "dracal-usb-get.exe" tool that was installed with DracalView. 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 DracalView installation directory. Typical examples: « cd "C:\Program files (x86)\DracalView" » (64 bit system) or « cd "C:\Program files\DracalView" » for a 32 bit system.

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

C:\Program Files (x86)\DracalView>  dracal-usb-get -l
Found: 'USB-PTH200-CAL', Serial: 'E16971', Version 2.1, 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]
Found: 'USB-SPECTRUM', Serial: 'E16415', Version 1.0, Channels: 8
    Channel 0: IR light intensity [IR light intensity]
    Channel 1: Green light intensity [Green light intensity]
    Channel 2: Blue light intensity [Blue light intensity]
    Channel 3: Red light intensity [Red light intensity]
    Channel 4: VEML6075 UVA [UVA]
    Channel 5: VEML6075 UVB [UVB]
    Channel 6: VEML6030 ALS [Ambient light]
    Channel 7: VEML6030 WHITE [White light]

Two sensors were connected to the computer when the above command has been sent. 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 "E16971" and "E16415". Take note of the (case sensitive) ID of the sensor(s) you intend to use.

4. 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 "E16971" 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 dracal-usb-get.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 "dracal-usb-get.exe -h" for more information.

Here is an example where sensor ID "E16415" channel 0 (IR light intensity) is displayed:

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

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

C:\Program Files (x86)\DracalView>  dracal-usb-get -s E16971 -i 0,1,2
101.09, 25.26, 59.30

5. Executing an external program from LabVIEW

Once the data acquisition command based on dracal-usb-get.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 (x86)\DracalView> dracal-usb-get.exe -s E16971 -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 (Hence 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:

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.