A Practical Guide For Connecting LabVIEW To The Industrial IoT - National Instruments

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

7/22/2017 A Practical Guide for Connecting LabVIEW to the Industrial IoT - National Instruments

A Practical Guide for Connecting LabVIEW to the Industrial IoT


Publish Date: Jun 23, 2017

Overview
In this white paper, learn about the three most prevalent communication protocols to connect to cloud-based development
platforms for Internet of Things (IoT) applications. You can also find information on some of the most common IoT cloud
development platforms such as Amazon Web Services, IBM Bluemix, PTC ThingWorx, and Microsoft Azure. Plus, learn how to
connect an NI embedded system, such as CompactRIO, to these cloud platforms through the LabVIEW open graphical
development environment.

Table of Contents
1. The IoT Will Change the World
2. MQTT
3. AMQP
4. DDS
5. Amazon AWS IoT
6. IBM Watson IoT for Bluemix
7. PTC ThingWorx
8. Microsoft Azure IoT Suite

1. The IoT Will Change the World


The world economy will greatly change in the next decade as new Internet-enabled applications are rolled out. Some of
these applications are likely to be disruptive and innovative as well as have a large economic impact. This will affect
many industries and sectors, as already seen in consumer sectors like hotels (Airbnb) and taxis (Uber).
This trend is also noticeable in the industry, for example, Germany’s Industry 4.0 initiative. Within Industry 4.0 or the
Industrial IoT (IIoT), the focus is on integration and better use of existing technologies. In this sense, industry, machines,
products, and people are all digitally connected. Manufacturers are mass producing bespoke products in quantities of
one. Intelligent software in the cloud connects enterprise IT systems with the operational world, machines, devices, and
sensors to control and optimize production flow.

Figure 1 – Common Architecture of the Industrial IoT: Intelligent Edge Nodes Connect Sensors, Actuators and Devices
to IT Systems
Because of the decrease in cost of connectivity, processing devices and sensors adoption of IIoT has grown
tremendously. Sensor data can be captured and preprocessed close to the machines by a smart edge device such as a
CompactRIO or a PXI automated test system. The edge device can send the data in real time to the virtual world (IT
cloud platform) where it can be stored, monitored, and analyzed or trigger an action.
The value of the IIoT is not in the connectivity of the devices, but in what a company unlocks from the stream of data the
smart devices supply. Cloud computing platforms and their services help provide this insight.
Many significant challenges need to be taken into account when implementing an IoT solution. Challenges such as
standardization, interoperability, Big Analog Data™ handling, security, and privacy. It is important to be aware of these
challenges and give special care to security. Security is a crucial component for any IoT application. IIoT devices should
enforce a strong security policy and be updated regularly with the latest security patches. To learn more about best
practices for security on CompactRIO and receive the latest security announcements from NI, visit
ni.com/support/security (http://www.ni.com/support/security). All cloud computing platforms securely send and receive
data, use strong authentication and authorization methods, and use encryption. The majority also have audit capabilities.
Cloud Computing
Cloud computing refers to a flexible way of delivering hardware, software, or data resources via the network on a user’s
request. This is opposite to the use of running a software application on a local computer.

http://www.ni.com/white-paper/53954/en/ 1/7
7/22/2017 A Practical Guide for Connecting LabVIEW to the Industrial IoT - National Instruments

Figure 2 - Overview of Cloud Computing Elements (image source: Sam Johnston


https://commons.wikimedia.org/wiki/File:Cloud_computing.svg)

The table below shows three service levels of cloud computing that are commonly encountered.

SaaS Software as a Service Provides a full business service. The service provider runs and manages
the complete platform. Examples: Gmail, Salesforce.com

PaaS Platform as a Service Provides a platform. You need to build and deploy your own cloud applic
ation, leveraging the run time and services the vendor provides. Exampl
es: IBM Bluemix, Microsoft Azure, AWS IoT

IaaS Infrastructure as a Service Provides the basic building blocks such as server hardware, storage, an
d network capabilities. You may need to install the OS and applications.
Examples: Amazon EC2 (a virtual machine that Amazon provides to yo
u), IBM SoftLayer

Clouds can be deployed as public—all services run in a secure environment hosted in the cloud, where servers may be
shared with others—or private, which is available only to the user’s organization and may exist on or off premises. In
addition, clouds can be deployed as hybrids, where parts are on premises and other services are in the cloud.

IoT Application Protocols


Communication protocols are responsible for the network connectivity to the server. Protocols like Wi-Fi, Ethernet,
cellular, and LoRaWAN are all communication protocols that provide this level of connectivity. Application protocols sit on
top of them to communicate application-specific messages.
Multiple standards handle the communication between devices and the cloud. As application requirements differ, specific
IoT protocols have been developed and therefore the confusion is understandable. Protocols may even have multiple
implementations and IoT platforms may have proprietary IoT solutions. To provide a universal solution, devices,
applications, and platforms need to be interoperable. NI embedded systems provide an excellent solution by being open
and flexible. This is achieved through the NI Linux Real-Time OS, support for LabVIEW graphical and Eclipse C
programming environments, as well as several Linux packages available through the vibrant ecosystem.
At a high level, there are three main use cases for the application protocols: device to device (D2D or M2M), device to
server (D2S), and server to server (S2S) communication. IoT application protocols have different levels of real-time
behavior and other characteristics. The table below provides an overview.
Common Application Protocols for IoT Connectivity
http://www.ni.com/white-paper/53954/en/ 2/7
7/22/2017 A Practical Guide for Connecting LabVIEW to the Industrial IoT - National Instruments
Common Application Protocols for IoT Connectivity

HTTP/HTTPS WebSocket DDS MQTT AMQP

Description Transmit data ove Transmit data ove Communication b Lightweight protoc Queue system to
r Internet from ap r Internet from ap us to connect intel ol for collecting da reliably transfer m
plications, website plications, website ligent machines ta and publishing i essages between
s, and so on s, and so on t to servers and s applications and p
ubscribers rocesses (server
s)

Typical Use Cas Web Web D2D D2S S2S, (D2S)


e

Real-Time Behav No No Yes, us–ms range No, ms–s range No, seconds rang
ior e

Messaging Request/Respons Request/Respons Databus Publish/Subscribe Publish/Subscribe


e e

Transport TCP TCP TCP, UDP, shared TCP TCP


memory, and so o
n

Security Yes: HTTPS (SSL Yes: wss:// (SSL/T Yes Possible: SSL or Yes: TLS or SASL
or TLS) LS) TLS (Simple authentic
ation and Security
layer)

LabVIEW Suppor Yes, native Yes, via VI Packa Yes, via VI Packa Yes, Implementati Implementations
t ge Manager (Medi ge Manager (RTI) ons on VI Packag on VI Package M
aMongrels) e Manager, LabVI anager (LabbitM
EW Tools Networ Q) and GitHub
k, and GitHub

Quality of Servic No No Yes, over 20 level Yes, 3 levels Yes


e s

The next section describes the most common protocols, MQTT, AMQP and DDS, in further detail.

2. MQTT
Message Queueing Telemetry Transport (MQTT) is an IoT connectivity protocol. MQTT is used in applications with
thousands of sensors, including power usage monitoring and oil pipeline monitoring. MQTT is efficient in terms of
bandwidth, battery, and resources. MQTT uses a publish/subscribe model. The IoT devices publish data to an MQTT
broker over TCP as a topic. An authorized client can subscribe to any topic and receive the value from the broker as
they arrive from the publisher. The publisher (device) does not need to know about any of the subscribers, which makes
the management easier at the device level. The broker can support multiple concurrent connections from many devices.
A topic is a simple string that can have hierarchical levels and supports also wildcards. An example of a topic is
GothamCityPlant/Building1/Pump7/Power. The message data is transmitted in JSON format and may be specific to the
cloud platforms’ IoT service.

http://www.ni.com/white-paper/53954/en/ 3/7
7/22/2017 A Practical Guide for Connecting LabVIEW to the Industrial IoT - National Instruments
Figure 3 – Edge Devices Sent MQTT Messages over the Internet to a Central Broker Which Distributes the Messages to
Authorized Subscribers
MQTT supports three quality-of-service levels:
QoS 0—At most once
QoS 1—At least once
QoS 2—Exactly once

MQTT can be implemented using standard HTTP calls within LabVIEW. NI Alliance Partners as well as community
versions of such implementation exist on the LabVIEW Tools Network
(http://www.ni.com/np/app/main/p/bot/no/ap/lvtn/lang/en/pg/1/sn/n25:software,n21:28/sb/default/?q=mqtt) and GitHub.
One open-source version that implements TLS/SSL is available here (https://github.com/Indie-Energy/AWS-IoT-
RESTful) on GitHub.
To debug MQTT communications, a MQTT client can be installed on a local computer. A popular free MQTT client is
MQTTfx, available at mqttfx.org/ (http://www.mqttfx.org/).
Several MQTT brokers to test communication are on the Internet. One of the most popular is mosquitto. To test the
communication, you can publish topics to test.mosquitto.org. The mosquitto broker is open source and can also be used
in-house for sandbox testing or production use of MQTT communication.
3. AMQP
Advanced Message Queuing Protocol (AMQP) is an open message protocol that can send transactional messages
between servers and from devices to servers and vice versa. Advantages of AMQP are the reliable communication (data
is received reliably exactly once at the receiving end) and interoperability. AMQP uses a broker to receive data from a
client. The client (or publisher) then publishes the message to the broker, where it is processed and routed to a queue.
From the queue, the message is sent to any client who has subscribed to this data. AMQP focuses on tracking all
messages and ensuring each is delivered as intended, even if a device is temporarily offline. Devices that generate
loads of data can stream to AMQP servers, which is then consumed by receivers to perform monitoring and analytics.
An example application for AMQP is the analysis of automotive driving behavior at the data center. Some cloud
development platforms support device connectivity to AMQP or AMQP over WebSocket. Popular open-source AMQP
brokers you may come across are RabbitMQ, ActiveMQ, and Kafka.
LabbitMQ is an AMQP library for LabVIEW that can be installed from the VI Package manager. An open-source AMQP
client implementation in LabVIEW is available on GitHub (https://github.com/tweeto/AMQP-Client).

4. DDS
The Data Distribution Service (DDS) main use case is to distribute data directly to other devices, although it can also
distribute data to enterprise systems and mobile devices. Applications are found in wind farms, automotive test, asset
tracking, and defense and big physics. Devices often need each other’s data in real time measured in milliseconds. All of
this needs to happen reliably and usually with large data streams. DDS offers a detailed quality of service control, with
configurable reliability, redundancy, and filtering, and selects exactly which data goes where. To do so, DDS uses a
device-to-device bus communication, which can deliver the data to thousands of devices.
LabVIEW support for DDS can be installed through the VI Package Manager. RTI provides an excellent tutorial
(https://community.rti.com/static/documentation/connext-
dds/5.2.3/doc/manuals/labview/RTI_DDS_Toolkit_for_LabVIEW_GettingStarted.pdf) on the use of DDS with LabVIEW.

Cloud Development Platforms


Disclaimer: National Instruments does not endorse any cloud platforms. The intent is to give a brief introduction to the
major platforms. You should make a thorough investigation before deciding which platform is most suitable for your
application.
5. Amazon AWS IoT
Amazon Web Services (AWS) offers IT infrastructure as cloud computing, database storage, content delivery, and more.
AWS IoT is a managed cloud platform that enables devices to connect and interact with other AWS cloud applications
and services through a rules engine. AWS IoT also provides a device gateway and device shadows. The device gateway
is the service that manages the device connectivity to AWS IoT and supports MQTT, WebSocket, and HTTP protocols.
Device shadows can create a virtual device that retain the device’s latest state, even when it is offline. Applications
within AWS can publish to the virtual device and when the device is back online, the state is synchronized. AWS
provides open-source IoT SDKs to help connecting hardware devices with AWS IoT.
AWS uses an IoT rules engine that applies an SQL-like syntax to select data received from a device and perform
actions. The rules engine makes it possible to build IoT applications that can gather, analyze, process, and act on the
data received from the device. The rules engine can route the message to AWS endpoints like AWS Lambda (a compute
service to run your uploaded code), Amazon Kinesis (to process a large stream of data in real time), Amazon S3 (simple
storage service), Amazon Machine Learning, Amazon DynamoDB, and many more.
NI provides a free toolkit through the LabVIEW Tools Network to connect your LabVIEW applications to AWS S3
(http://sine.ni.com/np/app/main/p/ap/lvtn/lang/en/pg/1/sn/n25:software,n21:28/), SNS, SQS, and IoT services directly to
enable cloud storage, push notifications, and more.

http://www.ni.com/white-paper/53954/en/ 4/7
7/22/2017 A Practical Guide for Connecting LabVIEW to the Industrial IoT - National Instruments

6. IBM Watson IoT for Bluemix


Bluemix, IBM’s cloud development platform, is a PaaS. With Bluemix, you can access IBM software for services like “big
data” analytics, storage, databases, security, IoT, cognitive applications, and more.
Watson IoT for Bluemix lets an application communicate with the connected devices and consumes data received from
those devices and device gateways. MQTT is used to communicate with the devices and gateways. Devices can
securely connect to Watson IoT using MQTT over TLS.
The device needs to be registered with IBM Bluemix before an MQTT connection can be established with the Watson
IoT MQTT broker. Rules and logic to handle the data can be defined in any of the languages that IBM Bluemix supports,
such as node.js (Node-RED), Java, Python, and more.
The LabVIEW Tools Network contains an example to connect CompactRIO and a detailed description for IBM Watson
IoT for Bluemix (http://sine.ni.com/nips/cds/view/p/lang/nl/nid/213661).

7. PTC ThingWorx
ThingWorx is a model-based IoT application development platform that provides a complete application design, run time,
and environment. ThingWorx provides components for connectivity, analytics, collaboration, and visualization including
augmented reality. The core development features of the platform are:
Composer—An application modeling environment to model the “things,” logic, visualization, data storage, and
security
Mashup builder—A web page is called a mashup with ThingWorx, and visualization of web pages can be created
using the mashup builder tool
SQUEAL—A search feature that allows searching through all data in a model
Execution engine and storage—Event-driven platform for execution and storage to store, relate, and expose big data
to make it valuable and actionable
ThingWorx supports device connectivity in several ways: direct network connections, MQTT and AMQP, third-party
device clouds, and OPC-UA connectivity through PTC Kepware software.
NI released an IoT Education beta (http://forums.ni.com/t5/NI-Labs-Toolkits/NI-IoT-Education-Beta/ta-p/3610067)
program featuring connectivity from the myRIO Student Embedded Device to the ThingWorx platform during NIWeek
2017.
8. Microsoft Azure IoT Suite
The Azure IoT Suite allows data collection from devices and provides a set of services like data analysis, data storage,
real-time and historical data visualization, and integration with back-office systems. The Azure IoT hub receives the data
from IoT devices. The device data can then be stored or passed on for further processing, analytics, and management.
Devices can communicate with the IoT hub over HTTP, MQTT, or AMQP protocols. Microsoft offers a set of Azure IoT
device SDKs through GitHub.
Other cloud platforms are available, such as Google Cloud Platform, GE Predix, and many more. For more information,
see the vendor’s specific product pages.

Appendix A: Overview of 4 Major IoT Cloud Platforms

AWS IoT IBM Watson IoT for Blu PTC ThingWorx Microsoft Azure IoT
emix

Free Evalu 1-year free trial 30-day trial, then free Lit 30-day trial IoT Hub free trial for unli
ation e version mited time

Pricing Usage basis, no minimu Pay per device, data exc Subscription, then pay d Usage based (No. of IoT
m fees hanged, data stored epending on usage Hub messages)

Deployme Public cloud Public or private Private or hybrid Public, private, or hybrid
nt Options

Getting St Yes Yes Yes Yes


arted Mate
rials (Tutor
ials, White
Papers, an
d Videos)

Platform A GUI, CLI GUI, CLI GUI GUI, CLI


ccess Opti
ons

MQTT Sup Yes Yes Yes Yes


port
http://www.ni.com/white-paper/53954/en/ 5/7
7/22/2017 A Practical Guide for Connecting LabVIEW to the Industrial IoT - National Instruments

MQTT Web Yes Yes Not Specified Yes


Sockets

AMQP Use SQS instead or 3rd Through 3rd party Yes Yes
party

AMQP We – Through 3rd party Not Specified Yes


bSockets

Data Form JSON JSON JSON JSON


at

Storage S3 (files), DynamoDB (N Cloudant (NoSQL datab Data tables, streams, an SQL storage, Document
oSQL database), Redshi ase), Mongodb, and oth d value streams DB (NoSQL), blob stora
ft (database), and others ers ge (files), and table stora
ge

LabVIEW Yes, LabVIEW Cloud To Yes, MQTT Yes, MQTT/AMQP Yes, MQTT/AMQP
Connectivi olkit for AWS; MQTT
ty

Device SD Yes Yes Yes Yes


Ks Availab
le

Rules Engi Yes, rules engine acts o Yes, that is, node.js appli Yes, Expression Widget Yes, Azure Stream Analy
ne n the data and routes on cation tics
to other services

Visualizati QuickSight or custom de Yes, Watson IoT Real-Ti Yes, ThingWorx SQUEA Via Azure web apps, po
on of Data velopment me Insight L, widgets, Vuforia, and wer BI, and notifications
Mashup

Platform R Amazon Kinesis IoT Real-Time Insights, I Yes Stream Analytics


eal-Time S BM Streaming Analytics
treaming
Analytics

Platform M Amazon Machine Learni IBM Predictive Analytics Predictive Analytics Azure ML
achine Lea ng
rning

Security TLS/SSL TLS TLS TLS/SSL


The table features out-of-the-box capabilities. Often features can be added by installing additional services.

Appendix B: Sources
AWS https://aws.amazon.com
IBM http://www.ibm.com
Intel http://www.intel.com
PTC http://www.ptc.com/internet-of-things/technology-platform-thingworx
NI http://www.ni.com/nl-nl/innovations/industrial-internet-of-things.html
Electronic Design—Understanding the protocols behind the internet of things
http://www.electronicdesign.com/iot/understanding-protocols-behind-internet-things
Internet of Things (IoT) Development Platforms—A case of IBM Bluemix, P Kumar, Univ. of Koblenz-Landau
https://kola.opus.hbz-nrw.de/frontdoor/index/index/docId/1373 (https://kola.opus.hbz-nrw.de/frontdoor/index/index/docId/1373)
IoT Standards and Protocols https://www.postscapes.com/internet-of-things-protocols/
Industrial Internet of Things Platform Comparison https://www.mandsconsulting.com/industrial-iot-platform-comparison

Books:
Internet of Things, W. Vermeend, J.W. Timmer, 2016, ISBN 97890821993-4-5
Enterprise IoT, Naveen Balani, 2016, ISBN 9781535505642

http://www.ni.com/white-paper/53954/en/ 6/7
7/22/2017 A Practical Guide for Connecting LabVIEW to the Industrial IoT - National Instruments

The registered trademark Linux® is used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of
the mark on a worldwide basis. A National Instruments Alliance Partner is a business entity independent from National
Instruments and has no agency, partnership, or joint-venture relationship with National Instruments.

http://www.ni.com/white-paper/53954/en/ 7/7

You might also like