NI Linux Real-Time Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Web-Based Thin Client for Embedded UI

Overview

 

This example demonstrates creating a web-based thin client to be used on CompactRIOs with Embedded UI capabilities. It showcases using web technologies and the Current Value Table Reference Library to easily create a flexible user interface for your LabVIEW code. This example involves installing Firefox onto your CompactRIO. The instructions to accomplish this are listed below. The user interface is a simple HTML document that uses AngularJS as a mechanism to communicate with a LabVIEW Web Service.

 

This example uses the CVT Web Add-On which allows users to read and write tags in the Current Value Table through LabVIEW Web Methods. An AngularJS service tagweb.js has been made to make communication between LabVIEW and the web thin client easy. Additionally, several AngularJS directives have been made in this example that make placing basic controls such as numerics and strings very easy.

 

Benefits of this Solution

  1. Multilingual Support by using Unicode characters
  2. Single UI that can be accessed over the network
  3. Enables the use of any web-based UI technology

 

20150418143042.png

 

Installation

 

You can download the CVT Web Add-On from the CVT Web Add-On and Thin Client Reference Design page. To use that you'll also have to have the Current Value Table Reference Design installed. You can download that reference design from this link: White-Paper: Current Value Table (CVT) Reference Library.

 

Installing Firefox if your cRIO has an Internet connection

 

You can use wget to download the latest release of Firefox from their site with the following line:

admin@NI-cRIO-903x-abcdefg:~# wget download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/firefox-37.0.1.tar.bz2

In order to extract the package, you'll need to install bzip2. To run Firefox you'll also need libasound2. You can install these packages, and extract Firefox to /usr/lib with the following commands:

admin@NI-cRIO-903x-abcdefg:~# opkg update

admin@NI-cRIO-903x-abcdefg:~# opkg install bzip2 libasound2

admin@NI-cRIO-903x-abcdefg:~# tar jxf firefox-*.tar.bz2 -C /usr/lib

At this point, you'll have firefox installed and can launch it with the command:

admin@NI-cRIO-903x-abcdefg:~# ./usr/lib/firefox/firefox

 

Installing Firefox if your cRIO doesn't have an Internet connection

 

You can download Firefox at their website. You'll want the Linux 64-bit version and can select any language you'd like. You can extract it using a program like 7-zip it and place it into the /usr/lib directory on your cRIO via WebDAV, FTP, or a USB drive. To install libasound2, Firefox's dependency, place the two files in the attached firefox-dependencies.zip file into a temporary folder such as your /tmp directory and enter the following command:

admin@NI-cRIO-903x-abcdefg:~# opkg -cache /tmp install libasound2

At this point, you'll have firefox installed and can launch it with the command:

admin@NI-cRIO-903x-abcdefg:~# ./usr/lib/firefox/firefox

 

Steps to Run Example

 

Note: If you don't have a Linux RT CompactRIO, this can be run on the devlopment machine instead of a real-time target.

 

  1. Open the attached example project
  2. Add your CompactRIO to the project
  3. Migrate the VI and Web Service to your target
  4. Start the tagweb web service
  5. Run the RT Main.vi

 

You can view the thin client on the embedded ui or from any computer on the network by navigating to hostname:8001/tagweb where hostname is the name or IP address of your CompactRIO

 

Requirements

 

LabVIEW 2014 or greater

LabVIEW Real-Time Module

A cRIO with NI Linux Real-Time

 

Licensing

 

Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

Comments
Active Participant BradM
Active Participant

Very cool application, an excellent use of the environment available through the Linux ecosystem. This is just the sort of thing that I like seeing.

Member NikitaProrekhin
Member

Hi,

 

I don't have NI Real-Time module installed. Is it possible to have another project example with web services hosted on a PC?

Nikita Prorekhin
CLA
Member Y.Kwon
Member

The command to install firefox seems to be outdated. I get 404 Page Not Found error. 

I used this Linux command to download firefox 55.0 and it worked. 

 

wget https://ftp.mozilla.org/pub/firefox/releases/55.0/linux-x86_64/en-US/firefox-55.0.tar.bz2 

Contributors