Anda di halaman 1dari 20

Telemark University College Department of Electrical Engineering, Information Technology and Cybernetics

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

7.1.1 7.1.2 7.2

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):

Note! You need to install the NI ELVISmx driver software first

If not, you find it in the National Instruments folder:

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

The following are included in the package:

3 Installation and Configuration


You need to install the NI-ELVISmx software that comes with the device. The NI-ELVISmx software installs the DAQmx driver software as well as the Measurement and Automation Explorer. You use MAX (Measurement and Automation Explorer) for configuration.

Perform a Self-Test to make sure everything works as expected:

4 Using myDAQ as a Multimeter


When you plug in the device in the USB connection on your PC, the following will pop-up automatically (NI ELVISmx Instrument Launcher):

If you click on the DMM button, the built-in Digital Multimeter will appear:

6 Make sure to connect the applied digital multimeter probes:

Using myDAQ as a Multimeter

Lab Equipment: NI myDAQ

5 Using myDAQ as a Scope


When you plug in the device in the USB connection on your PC, the following will pop-up automatically (NI ELVISmx Instrument Launcher):

If you click on the Scope button, the built-in Scope will appear:

6 Using myDAQ as a 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):

If you click on the FGEN button, the built-in Function Generator will appear:

7 Using myDAQ in LabVIEW


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 explained in detail below.

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

Using myDAQ in LabVIEW

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:

Lab Equipment: NI myDAQ

11 Next we select AO0:

Using myDAQ in LabVIEW

Finally we set properties for Min and Max values, Timing Settings, etc.:

In our case we set 1 Sample (On Demand).


Lab Equipment: NI myDAQ

12 Next, we need to finish our LabVIEW application as follows:

Using myDAQ in LabVIEW

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.

Lab Equipment: NI myDAQ

13

Using myDAQ in LabVIEW

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:

Lab Equipment: NI myDAQ

14 Next we select AI0:

Using myDAQ in LabVIEW

Finally we set properties for Min and Max values, Timing Settings, etc.:

In our case we set 1 Sample (On Demand).

Lab Equipment: NI myDAQ

15 Next, we need to finish our LabVIEW application as follows:

Using myDAQ in LabVIEW

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.

Lab Equipment: NI myDAQ

16

Using myDAQ in LabVIEW

7.1.2
Analog Out:

Using DAQmx functions

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.

Lab Equipment: NI myDAQ

17

Using myDAQ in LabVIEW

7.2 NI-ELVISmx
Below we see the NI ELVISmx palette in LabVIEW (Measurement I/O NI ELVISmx)

The NI ELVISmx palette consists of different Express Vis. Digital Multimeter:

Oscilloscope:

Function Generator:

Lab Equipment: NI myDAQ

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

E-mail: hans.p.halvorsen@hit.no Blog: http://home.hit.no/~hansha/

Anda mungkin juga menyukai