AduHidTest USB Device Test Software Tutorial :   Part 2- Streaming

   

We recommend viewing AduHidtest Tutorial Part 1 before viewing this continuation of the tutorial.

For low speed applications where data is read at 500s/s or lower, a polling method of retrieval is suitable.  In polling applications a read command is sent each time data is to be retrieved from the ADU. Considering that USB bus specifications guarantee 1000 packets/second, the theoretical maximum polling speed is 500s/s because sending the read command, and then receiving the data, each take up one packet time. Polling applications send and receive, data and commands, on the device pipe.

Select ADU devices feature a streaming function where the user can send a Stream Start (SS) command on the device pipe and the ADU will send data on the separate Stream Pipe at rates up to 1000 packets per second.  The stream is stopped using the Stream Cancel (SC) command.

Note: The stream pipe is a read only pipe.

For this tutorial we will use an ADU73 Voltage Input to USB Interface and AduHidTest 4.0 to demonstrate the streaming function, and how Excel can be used to examine data. The ADU73 is a Voltage Input to USB interface that provides two isolated 0-5VDC analog voltage inputs with 24-bit resolution.

ADU73 Voltage Input to USB (Dual, 0-5VDC)

Getting Started:

We will follow the 4 steps below to demonstrate the streaming function using AduHidTest V4.0.

  1. Connect to the ADU73.
  2. Send Stream Start (SS) command to the ADU73 device pipe.
  3. Receive data from the ADU73 on the stream pipe.
  4. Send Stream Cancel (SC) command to the ADU73 device pipe.

 

STEP 1: Connect to the ADU73

We open AduHidTest and connect to our ADU73 using the By Serial# option.

ADU73 Voltage Input to USB Connected 

Figure 1: ADU73 Connected to PC

 

STEP 2: Send Stream Start command to the ADU73 device pipe.

We send the Stream Start command (SS) via the device pipe to the ADU73.  Note: ADU commands are not case sensitive.

ADU73 Voltage Input to USB Stream Start 

Figure 2:  Sending "SS" Command

Upon receiving the SS command, the ADU will begin sending data packets on the stream pipe at the configured rate.

The ADU73 default sampling rate is 100 samples per second, and with two channels, results in a packet rate of 50 packets per second. The ADU73 can be configured to sample at rates ranging from 2.5 to 1000 samples per second. Consult the user manual of your specific ADU device to determine available sample rates and configuration settings.

 

STEP 3: Receiving Data on the Stream Pipe

AduHidTest facilitates several methods of capturing data packets sent on the stream pipe, including capturing a single packet, and streaming to text or CSV files.

Clicking the Capture Single Packet button displays one packet of data in the viewing window.

In the case of the ADU73, a single packet of data is two 24-bit readings (00000000-16777215) representing the two 0-5VDC analog inputs (AN0 and AN1) on the ADU73, returned in ASCII format with a space delimiter. Analog channels that are disabled return "00000000".

ADU73 Voltage Input to USB caturing Data Packet 

Figure 3:  Capturing a Single Packet of Data.

The packet data indicates that AN0= (11184850/16777215) x 5 = 3.3333452V  and  AN1= (05595093/16777215) x 5 = 1.6746775V

The single packet of data can also be displayed in HEX format by clicking the HEX checkbox beside the Capture Single Packet button.

ADU73 Voltage Input to USB caturing Data Packet in HEX 

Figure 4:  Viewing the Packet Data in HEX Format.

Figure 4 shows our ASCII packet converted to HEX.  The unused bytes are padded with nulls.

Note: All packets sent on the stream pipe of ADU devices have 63 bytes of data. One additional byte is used by the DLL to identify the pipe selected (  01h = Device Pipe, 02h = RS232 Pipe,  03h = Stream Pipe). This byte is not displayed, nor is it received by the host application software when using the AduHid.dll.

Streaming data can also be captured to text or .CSV files for use with Excel or other spreadsheet software.

The file format of text or CSV is selected using radio buttons in the stream pipe section of AduHidTest. 

When the Begin Capture button is clicked, the streamed packets will be saved in a unique filename containing time and date. The filename is visible while streaming in the stream pipe section of AduHidTest.

ADU73 capturing data to text file. 

Figure 5:  Capturing Packet Data to a TXT File.

Once the data stream is stopped using the Stop Capture button, data can be viewed.

Note: The Stop Capture button does NOT stop the data streaming from the connected ADU. It only stops the capturing of packet data to the file type selected.

In text format, the file contains date and time capture started, and one line for each captured packet.

Each line shows time of capture in Hours:Min:Sec:Milisec format, followed by complete HEX data ( 63 bytes) and the ASCII representation of data.

USB Streaming Data Text File

Figure 6:  Data Captured  to a TXT File.

Packets can also be captured to a CSV file, which use comma as a delimiter, for use with Excel or other spreadsheet software.

The CSV file can be directly opened in Excel and contains time of capture and sample data conveniently arranged in columns.

Note: The time of capture data is truncated by Excel down to 100ms accuracy in its default settings.

USB Data in Excel File

Figure 7:  Data Captured  to a CSV File.

After data is imported into Excel it can be graphed for examination.

Excel data plot from USB device.

Figure 8:  Data graphed in Excel Spreadsheet to evaluate noise level.

In our example we select the data for AN0 and graph it to measure noise levels. From the graph we can see the noise level at 100 s/s is +/- 6 counts out of 16777215 counts giving a noise level of +/- 1.78uV on a 0-5V analog input. This is an exceptionally low noise level, and you should order one immediately!

STEP 4: Send Stream Cancel Command (SC) on ADU73 Device Pipe

To stop the connected ADU from streaming packets on the streaming pipe, a Stream Cancel (SC) command should be sent on the device pipe.

Cancel stream command

Figure 9:  Sending the Stream Cancel (SC) command to the ADU73 on the Device Pipe.

End of Tutorial 

 

DOWNLOAD AduHidTest Here:

Download AduHidTestV4.0 (64-Bit)  now, in ZIP Format ( 1.2MB ). ( Contains DLL Ver 2.2 )

Download AduHidTestV4.0 (32-Bit)  now, in ZIP Format ( 1MB ). ( Contains DLL Ver 2.2 )

 

 Back to Programming Page