NI myDAQ
NI myDAQ
NI myDAQ
NI myDAQ
HANS-PETTER HALVORSEN, 2012.01.20
Faculty of Technology, Postboks 203, Kjlnes ring 56, N-3901 Porsgrunn, Norway. Tel: +47 35 57 50 00 Fax: +47 35 57 54 01
Table of Contents
Table of Contents .....................................................................................................................................ii 1 2 3 4 5 6 7 Introduction to myDAQ .................................................................................................................. 1 System Description ......................................................................................................................... 3 Installation and Configuration ........................................................................................................ 4 Using myDAQ as a Multimeter ....................................................................................................... 5 Using myDAQ as a Scope ................................................................................................................ 7 Using myDAQ as a Function Generator .......................................................................................... 8 Using myDAQ in LabVIEW............................................................................................................... 9 7.1 NI-DAQmx ................................................................................................................................ 9 DAQ Assistant .................................................................................................................. 9 Using DAQmx functions ................................................................................................. 16
NI-ELVISmx ............................................................................................................................ 17
ii
1 Introduction to myDAQ
NI myDAQ is a simple and intuitive DAQ device from National Instruments. NI myDAQ have Analog Inputs (AI), Analog Outputs (AO), Digital Inputs (DI) and Digital Outputs (DO).
In addition to traditional I/O, the myDAQ have a built-in Digital Multimeter. The myDAQ can also be used as a Power Supply. Using the built-in software the myDAQ can also be used as an Oscilloscope and Function Generator. When you plug in the device in the USB connection on your PC, the following will pop-up automatically (NI ELVISmx Instrument Launcher):
Introduction to myDAQ
If you click on the DMM button, the built-in Digital Multimeter will appear:
If you want to use the myDAQ inside LabVIEW for Data Acquisition, you either use the traditional NI-DAQmx features or you may use NI-ELVISmx features. Both will be shown in this Tutorial.
Lab Equipment: NI myDAQ
2 System Description
Below we see an overview of the NI myDAQ device:
Specifications: Two Differential Analog Input and Analog Output Channels (200 ks/s, 16 bit, +/- 10 Volts) Eight Digital Input and Digital Output Lines (3.3 Volt TTL-Compatible) +5 , +15, and -15 Volt Power Supply Outputs (up to 500m Watts of Power) 60 Volt Digital Multimeter (DMM) for Measuring Voltage, Current, and Resistance
If you click on the DMM button, the built-in Digital Multimeter will appear:
If you click on the Scope button, the built-in Scope will appear:
If you click on the FGEN button, the built-in Function Generator will appear:
7.1 NI-DAQmx
In order to use the myDAQ device in LabVIEW you need to use the DAQmx functions. Below we see the DAQmx palette in LabVIEW (Measurement I/O NI-DAQmx)
7.1.1
DAQ Assistant
We will create a very simple example with 2 VIs, one VI for writing (Analog Out) and one for reading (Analog In). Analog Out: In this simple example we will use AO0 (Analog Out, Channel 0). We use the DAQ Assistant (DAQ Assist) which we find in the DAQmx palette.
10
When dragging this VI to the Block Diagram, the following Wizard appears:
We shall write data, so we need to select Generate Signals. Since we are going to write data to AO0, we select Analog Output and Voltage:
Finally we set properties for Min and Max values, Timing Settings, etc.:
In addition to the DAQ Assistant we a While Loop, a Wait (ms) function. On the Front Panel we need Numeric Control and a Stop Button:
Analog In: In this simple example we will use AI0 (Analog In, Channel 0). We use the DAQ Assistant (DAQ Assist) which we find in the DAQmx palette.
13
When dragging this VI to the Block Diagram, the following Wizard appears:
We shall read data, so we need to select Acquire Signals. Since we are going to read data from AI0, we select Analog Input and Voltage:
Finally we set properties for Min and Max values, Timing Settings, etc.:
In addition to the DAQ Assistant we a While Loop, a Wait (ms) function. On the Front Panel we need Numeric Indicator and a Stop Button:
In order to test the applications, we can wire AO0 and AI0 together (a so-called Loopback text). If we write 3V in the Write Analog Out.vi, we should be able to read 3V in the Read Analog In.vi.
16
7.1.2
Analog Out:
Another approach is to put the DAQ Assistant outside the loop for better performance.
In this example we have used the DAQmx functions DAQmx Start Task.vi, DAQmx Write.vi and DAQ Clear Task.vi from the DAQmx palette. Analog In:
In this example we have used the DAQmx functions DAQmx Start Task.vi, DAQmx Read.vi and DAQ Clear Task.vi from the DAQmx palette. The applications will work exactly the same as in the previous example, but the performance will be slightly better, especially for larger applications.
17
7.2 NI-ELVISmx
Below we see the NI ELVISmx palette in LabVIEW (Measurement I/O NI ELVISmx)
Oscilloscope:
Function Generator:
Telemark University College Faculty of Technology Kjlnes Ring 56 N-3918 Porsgrunn, Norway www.hit.no
Hans-Petter Halvorsen, M.Sc. Telemark University College Faculty of Technology Department of Electrical Engineering, Information Technology and Cybernetics