Using DAQ Devices in LabVIEW
Using DAQ Devices in LabVIEW
Faculty of Technology, Postboks 203, Kjlnes ring 56, N-3901 Porsgrunn, Norway. Tel: +47 35 57 50 00 Fax: +47 35 57 54 01
PREFACE
In this lab you will learn basic Data Acquisition (DAQ) and how to use a DAQ unit in LabVIEW. We will use the USB-6008 DAQ device from National Instruments. NI USB-6008 is a simple and low-cost USV based multifunction I/O device from National Instruments. The device is well suited for training and education purpose. The purpose of data acquisition is to measure an electrical or physical phenomenon such as voltage, current, temperature, pressure, or sound. PC-based data acquisition uses a combination of hardware, software, and a computer to take measurements.
ii
TABLE OF CONTENTS
Preface ..................................................................................................................................................................... ii Table of Contents .................................................................................................................................................... iii 1 2 3 Introduction to Data Acquisition ....................................................................................................................4 Measurement and Automation Explorer (MAX) ............................................................................................8 Using the DAQ Assistant ...............................................................................................................................10
iii
In this task we will learn basic Data Acquisition in LabVIEW. We will use the USB-6008 DAQ device.
Background information for this task is described in detailed in the Tutorial Data Acquisition in LabVIEW. The Tutorial consists of a pdf document, videos, example code, additional resources and web links.
http://home.hit.no/~hansha/?tutorial=daq
The purpose of data acquisition is to measure an electrical or physical phenomenon such as voltage, current, temperature, pressure, or sound. PC-based data acquisition uses a combination of modular hardware, application software, and a computer to take measurements. While each data acquisition system is defined by its application requirements, every system shares a common goal of acquiring, analyzing, and presenting information. Data acquisition systems incorporate signals, sensors, actuators, signal conditioning, data acquisition devices, and application software. So summing up, Data Acquisition is the process of: Acquiring signals from real-world phenomena Digitizing the signals Analyzing, presenting and saving the data
5 The DAQ system has the following parts involved, see Figure:
The parts are: Physical input/output signals DAQ device/hardware Driver software Your software application (Application software)
In LabVIEW, the NI-DAQmx Driver software is the layer of software for easily communicating with the hardware. It forms the middle layer between the application software and the hardware. Driver software also prevents a programmer from having to do register-level programming or complicated commands in order to access the hardware functions. Below we see the DAQmx palette in LabVIEW:
The DAQ Assistant, included with NI-DAQmx, is a graphical, interactive guide for configuring, testing, and acquiring measurement data. With a single click, you can even generate code based on your configuration, making it easier and faster to develop complex operations. Because DAQ Assistant is completely menu-driven,
Lab Work: Using DAQ devices in LabVIEW
you will make fewer programming errors and drastically decrease the time from setting up your DAQ system to taking your first measurement.
NI USB-6008 is a simple and low-cost multifunction I/O device from National Instruments.
The device has the following specifications: 8 analog inputs (12-bit, 10 kS/s) 2 analog outputs (12-bit, 150 S/s) 12 digital I/O USB connection, No extra power-supply neeeded Compatible with LabVIEW, LabWindows/CVI, and Measurement Studio for Visual Studio .NET NI-DAQmx driver software
The NI USB-6008 is well suited for education purposes due to its small size and easy USB connection.
Measurement & Automation Explorer (MAX) provides access to your National Instruments devices and systems. With MAX, you can: Configure your National Instruments hardware and software Create and edit channels, tasks, interfaces, scales, and virtual instruments Execute system diagnostics View devices and instruments connected to your system Update your National Instruments software
In addition to the standard tools, MAX can expose item-specific tools you can use to configure, diagnose, or test your system, depending on which NI products you install. As you navigate through MAX, the contents of the application menu and toolbar change to reflect these new tools.
Measurement & Automation Explorer (MAX) provides access to your National Instruments devices and systems. With MAX, you can: Configure your National Instruments hardware and software Create and edit channels, tasks, interfaces, scales, and virtual instruments Execute system diagnostics View devices and instruments connected to your system Update your National Instruments software
Task 1: MAX
Connect you USB-6008 Device and open the Measurement and Automation Explorer (MAX) . See if you can find you DAQ device in MAX and make sure it works properly. Run a Self Test and open the Test Panels in order to test your device. Perform a so-called Loopback test.
Use a multi-meter to check if the voltage levels on the output and input channels are correct according to your settings.
[End of Task]
Note! Read the USB-6008 DAQ device Lab Equipment document before you start! The document and additional information is available from: http://home.hit.no/~hansha/?equipment=usb6008 Connect your USB-6008 DAQ device to your computer and make sure it works. Use the Measurement and Automation Explorer (MAX) to configure and test your device. Use also a Volt meter to check that the voltage is correct.
DAQ Assistant:
The DAQ Assistant, included with NI-DAQmx, is a graphical, interactive guide for configuring, testing, and acquiring measurement data. With a single click, you can even generate code based on your configuration, making it easier and faster to develop complex operations. The NI-DAQmx Driver software is the layer of software for easily communicating with the hardware. It forms the middle layer between the application software and the hardware.
10
11
12
Use an ordinary Numeric Control on the Front Panel in order to write data between 0 and 5 [V] to the DAQ device.
Write different values between 0 and 5 [V] and use a multi-meter in order to check if the program works as expected. [End of Task]
13
Run the Analog Output.vi and the Analog Input.vi in parallel in order to check that the program works as expected. See the example below.
[End of Task]
14
Using the DAQ Assistant Do some calculations on the input signal and send the calculated result to the analog output. Put the calculation code into a SubVI. Plot the different values on the screen. Use the Project Explorer in LabVIEW for your application. Create an Executable File (.exe) of your Application.
In order to use the Project Explorer, you will have to create an Empty Project:
Below we see how we can use the Project Explorer to create an .exe (executable) file:
15
[End of Task]
Telemark University College Faculty of Technology Kjlnes Ring 56 N-3914 Porsgrunn, Norway www.hit.no
Hans-Petter Halvorsen, M.Sc. Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics
Phone: +47 3557 5158 E-mail: hans.p.halvorsen@hit.no Blog: http://home.hit.no/~hansha/ Room: B-237a