Reader small image

You're reading from  Data Acquisition Using LabVIEW

Product typeBook
Published inDec 2016
PublisherPackt
ISBN-139781782172161
Edition1st Edition
Right arrow
Author (1)
Yik Yang
Yik Yang
author image
Yik Yang

Yik Yang  is a test engineer living in Chicago who has specialized in automation and data analysis. Having worked in multiple fields such as semiconductor, automotive, and power, he has experience with different types of automation and understands what are the industries' needs.He started his career after receiving his Bachelor's and Master's degrees in Electrical Engineering at Virginia Tech. In his career, he worked on automation projects that used CompactDAQ, PXI, FPGA, and so on in LabVIEW. He has also spent a lot of time with Lean Six Sigma and statistical analysis with JMP. He is a certified Professional Engineer (PE) in North Carolina and a Certified LabVIEW Developer (CLD).
Read more about Yik Yang

Right arrow

Chapter 2. Most Common Communication Buses

In this chapter, we will discuss the most common and practical ways we may communicate with external devices and collect data using LabVIEW. Device connections are dependent on at least two parameters-the communication bus (serial, USB, GPIB, I2C, and so on) and the connection medium (single wire, a cable).

Wired connections and drivers


Automatic data acquisition would require a complete or at least a partially functioning system. At best, according to IEEE guidelines, a device may only respond when it is asked to perform a task. While this may be the ideal case, we are often dealing with systems that are sending continuous streams of data. We use the word system to define a set of device(s) that include at least one sensor, or an instrument such as an oscilloscope, a power supply, and so on, which is connected to a computer running LabVIEW via a physical connector. Granted, on a more advanced systems, data acquisition may be accomplished through wireless connections (still, in almost all cases, a system would need an intermediate physical layer between a computer and a wireless communication device). But for all practical purposes, let us start with what is most commonly used in the industry or perhaps a university lab. Needless to say, any communications established within a system must be...

Serial communication


A 1-Wire®, or most probably a 3-wire (signal ground, receive, and transmit), serial over USB accounts for one of the oldest and still most common forms of communication between a device and a data acquisition subsystem (a computer running LabVIEW in our case). Do not forget power and ground wires also. Since data acquisition is our focus in this book, we will somewhat leap over a 1-wire connection but it is worth mentioning that an amazing amount of communication can be achieved on a 1-wire serial connection. For example, a 1-wire digital temperature sensor, DS18B20, will send a unique serial number along with the actual data requested every time a set of data is transmitted. So you may use several of these temperature sensors (even 50, if you need them all) and still distinguish the exact pair of data and serial number for each sensor, all by using only one digital serial bus pin. As simple and friendly serial communication is, it is one of the slowest forms of communication...

GPIB


During the 1960s, long before USB, USB2, and now USB type-C dominated the bus systems on most platforms and appeared as the built-in standard on all desktop computers and laptops, a digital communication standard, originally developed by HP, was registered as an IEEE 488.x standard. This standard, also called General Purpose Interface Bus (GPIB), is still widely used and well in existence (many were sold several years back) in the test and development industry and many university labs.

We will also use an NI GPIB-USB-HS, a GPIB to USB converter to connect a Tektronix TDS 2022 to the PC running LabVIEW. Don't forget that this particular converter, or similar products manufactured by other vendors, also needs special drivers. NI provides proprietary drivers for GPIB-USB-HS (found on http://www.ni.com/). A GPIB to UB converter is also available from HP (Agilent) that may be used directly in LabVIEW:

GPIB to USB converter

It's worth noting that Intel/Apple computers have been working...

SCPI commands sets


As more and more test instruments using different buses and protocols entered engineering and test labs, a need for standard and universal sets of commands, as well as syntax and data formats to program and automate these devices, became a necessity. In 1990, IEEE 488.2 completed the standard that started with IEEE 488.1. This standard covers classes of instruments as well of product-specific commands. Although this standard was originally designed to accommodate a GPIB bus using ASCII text strings, it can also be used in USB, Serial and RS232 and Ethernet other lesser known architectures.

As an example, if we look down in the lower levels of NI drivers and examples to automate a Tektronix TD 2022, we will find standard SCPI commands:

SCPI commands

Arduino for LabVIEW driver installation


Arduino and its compatible boards and shields are an open source class of products (hardware as well as software), the most common of which is a microcontroller called Arduino Uno. This microcontroller is built around an ATmega328 with plenty of digital and analog I/O pins. National Instruments (unofficially) supports Arduino and Arduino-compatible devices and shields through a special firmware and set of functions. To illustrate the power and ease of use of these microcontrollers, as an example, we will use an Arduino Uno. Please refer to https://www.arduino.cc/ and the instructions on http://ni.com under LabVIEW interface for Arduino toolkit using VI Package Manager (VIPM) to install all provided functions via the Internet. Go to http://vipm.jki.net/ to get VIMP (there is a free version).

Once properly installed, you should see a function plate such as the one depicted in the following screenshot in your function panel list. To emphasize the importance...

Arduino photo sensor board


We are now ready to go through an example. The purpose of this example is to illustrate that finding and installing libraries and drivers is a routine part of data acquisition. Arduino sensor kits provide about 40 boards and sensors for about $40 from Amazon (for example) but if you spend the required time and effort, you may buy the same sensor packs much cheaper on eBay or other resellers found on the internet. Complete source code and pictures of the Front Panel and Block Diagram are provided. The aim is to have the reader acquire and install the rest (IDE, drivers, and firmware) to emphasize the fact that nowadays most of the drivers and the latest instructions for almost any instrument reside on the internet and diver hunting and installing is an "art" that must be simultaneously acquired during learning data acquisition!!

In this example, we will use the following:

  • An Arduino Uno R3:

  • A photo resistor sensor board:

Hardware connection:

  1. Connect the center pin...

Summary


From a 1-wire® serial communication to a GPIB connection cable with at least 24 wires, to a USB to Serial connector, and so on, the choice of using one particular connecting wire or cable over another one or, on the other hand, the availability of certain bus on a computer or a standalone test system may vary depending on at what stage of development (R&D, development, or production) we may be. The choice of connection cable/adapter device will also will have a decisive effect on the data transfer rate. The data transfer rate could be the single deciding factor with which a connection bus may have to be used. Clearly, a GPIB data transfer rate is much higher than a simple serial data transfer rate. The format of the data acquired (numbers, text, wave form, and so on) is also fundamental to data acquisition. We will look at I2C, 1-wire or 3 wire Serial, RS232, GPIB and USB, and, in particular, virtual serial port(s) using a USB connection in upcoming chapters.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Data Acquisition Using LabVIEW
Published in: Dec 2016Publisher: PacktISBN-13: 9781782172161
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Yik Yang

Yik Yang  is a test engineer living in Chicago who has specialized in automation and data analysis. Having worked in multiple fields such as semiconductor, automotive, and power, he has experience with different types of automation and understands what are the industries' needs.He started his career after receiving his Bachelor's and Master's degrees in Electrical Engineering at Virginia Tech. In his career, he worked on automation projects that used CompactDAQ, PXI, FPGA, and so on in LabVIEW. He has also spent a lot of time with Lean Six Sigma and statistical analysis with JMP. He is a certified Professional Engineer (PE) in North Carolina and a Certified LabVIEW Developer (CLD).
Read more about Yik Yang