Skip to main content
Skip table of contents

DAQConnect (App Note)

DAQConnect is a common Internet of Things (IoT) service provider which can be used to monitor and control a LabJack device over the internet. Figure 1 demonstrates the connection path to an off-site platform. This app-note explains how to write basic software that interacts with DAQConnect, but the principles can be applied to virtually any IoT service with the same TCP connection model. We maintain a list of 3rd party Modbus libraries that can be easily expanded to interact with an IoT service using basic TCP communications.

Figure 1. LabJack via internet, using DAQConnect as the IoT service

TCP connection model

In general, TCP communications can be quite complicated, however for this application it can be simplified a lot.  In order to send/receive one piece of information with the DAQConnect servers you need to first establish a connection over port 80, send it a request, receive the response, and then close your connection. The program connects to "www.daqconnect.com" over port 80, sends a large string starting with a GET or POST command (before while loops), starts listening for a TCP response (inside a while loop), and finishes by closing the TCP connection. In the attached LabVIEW examples, the "DAQConnect Get Value" or "DAQConnect POST value" VIs show the TCP packet structure, and the while loops.

What does a HTTP packet look like?

If you wish to learn about HTTP packets in general you can refer to the following web page:

http://www.jmarshall.com/easy/http/

This AppNote focuses specifically on an HTTP packet that works for DAQConnect. The primary information is in the first two lines of the string:

GET %s HTTP/1.1
Host: %s

or:

POST %s HTTP/1.1
Host: %s

The first %s is where you include all of the information regarding the API key, tag name, and any data for a POST command.  The second %s is simply "www.daqconnect.com".

In the end you will end up with a packet like:

GET /daq/storage.rest?o=getTagDetail&connUuid=1D2294B8-21A0-4503-80AA-7AE11DFD972E&tag=ain0 HTTP/1.1
Host: www.daqconnect.com
Connection: close
Content-Length: 0
Accept: text/html,text/json
Vary: Accept-Encoding
Content-Type: application/json; charset=utf-8\r\n\r\n

At the end of the packet being sent make sure that two return carriages are being sent, otherwise you will get a time out error.

UTF time

The UTF time converter included in the .zip file "get UTF time" and "parse UTF time" aren't fully implemented but are in a functional state. "get UTF time" read's the system clock and returns a string of the UTF time.  The "parse UTF time" is the incomplete part and doesn't return a completed time stamp that LabVIEW uses.  It only returns hour:minute:second:decimal value of seconds, day of year, and year.  The other information wrapped up into a date can be derived from this information if desired.

LabVIEW Examples

The LabVIEW VIs attached at the bottom of this page use only the native TCP ability of LabVIEW.  To interact with DAQConnect, use the "get example" and "post example" VIs.  You can also read the information located on the front page of "DAQConnect Get Value" and "DAQConnect POST value".

Files

DAQConnect.zip

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.