data acquisition and labviewdsclab/leks/1c_dsc_daq_labview.pdf · data acquisition and labview...

19
Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at Austin June 2015 ME 144L Dynamic Systems and Controls Lab (Longoria)

Upload: vudien

Post on 13-Feb-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

Data Acquisition and LabVIEW

Prof. R.G. Longoria

Department of Mechanical EngineeringThe University of Texas at Austin

June 2015

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 2: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

Lab Objectives

1 Become familiar with the National Instruments myDAQ data acquisitionhardware

2 Begin/continue learning to program in LabVIEW, especially for dataacquisition

3 Develop a LabVIEW program to measure sensor signals using myDAQ

4 Calibrate rotational potentiometer for angle measurement

5 Write LabVIEW programs that analyze signals to generate useful data

6 Run experiments with the compound pendulum and save angular positionmeasurements over time as the pendulum comes to rest after being released.

7 Use measured data to answer questions about the system (e.g., estimatesystem parameters, system energy stored or dissipated, etc.)

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 3: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

Most modern voltage measurements are made using A/Dconverters

Most basic electrical measurementsrely on an analog-to-digital (A/D)converter, which are even included aspart of modern microcontrollers.

In a DMM, signal conditioners inferother electrical quantities from ameasurement of voltage.

Note the signal conditioners needed toallow measurement of current andresistance.

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 4: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

For more general purpose measurement andinstrumentation applications, data acquisition devices offermore functionality

Analog Output (AO)I Generate DC VoltagesI General waveforms (Function Generator)

Digital I/OI General low (0V) and high (5V) pulsesI Read digital pulses

Timing I/OI Generate pulse trains (square waves)I Read frequency, time values

Always critically evaluate DAQ specifications to determine if your needs can bemet by a particular DAQ device.

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 5: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

The NI myDAQ connects via USB

Form factor: Connections:

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 6: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

What should you know about A/D conversion?

General concepts:

Resolution and range

How fast to sample

How many times to sample

Hardware specific:

Device and configuration(using NI MAX)

Connecting signals the rightway

What channels to sample

How to deal with the data

There are many different types of software and hardware commercial products for

DAQ. National Instruments products have seen increased application and

adoption in industry, research, etc., including areas that were once considered the

domain of very ‘high-end’ systems.

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 7: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

Analog-to-Digital (A/D) Conversion

The A/D converter (ADC) converts an analog voltage into a binarynumber through the process of quantization.

The ADC will have a full-scale voltage range (VFS) over which it canoperate.

Example: For the NI myDAQ device, there are two analog inputs withdifferent FS range. What is difference between DC and AC coupled?

The number of bits dictates how many discrete levels will be used torepresent measured voltages.

Example: An 8-bit converter with a VFS = 10 V gives a resolution of10V/256 = 39.1 mV.

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 8: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

A/D Conversion: Quantization

A signal entering a computer must be discretized in amplitude and time(sampling). Amplitude quantization depends on the number of bits in the A/Dconverter.

Comparing A/D resolution for n = 3 vs 16:∆n=3 = VFS/23 = 1.25 V compared to ∆n=16 = VFS/216 = 0.15 mV

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 9: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

Choosing a sampling or scan rate (scans/sec, or Hz)

The ADC samples according to a scan rate.

How fast you sample should minimally satisfy the Nyquist samplingtheorem.

Nyquist: the sampling rate should be at least two times the highestfrequency present in the signal.

Satisfying the Nyquist criterion helps ensure the signal can bereconstructed properly.

You need to balance how fast you sample, how many samples youstore, etc.

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 10: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

In selecting a sample rate, think about time resolution also

Depending on your objective, you might choose scan rate to satisfy Nyquistcriterion, but remember accuracy in time measurements.

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 11: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

“All grounds are not the same the world ’round.”

Understanding grounds is important in making proper signal connections.

Can you connect them?

Circuit or signal common

Earth ground

Chassis ground

Ground symbols:

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 12: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

Types of signal sources

Grounded source:

Referenced to system ground(e.g., earth, building)

Share a common ground with aDAQ board, oscilloscope, etc.

Some signal generators, power supplies

Floating source:

Isolated from absolute referencesuch as earth or building ground

Neither terminal is connected toa ground

Batteries and battery-powered sources, many sensorssuch as thermocouples, etc.

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 13: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

Types of Measurement Systems

You may see these connection options on DAQ hardware.

1 Differential measurement system

2 Referenced single-ended (RSE)

3 Non-referenced single-ended (NRSE)

Example: myDAQ analog input

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 14: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

Experimenting in the lab

Before closing, consider the what can be found out by use of thependulum setup, the sensor(s) provided, and DAQ measurement.

Here are some suggestions:

estimate pendulum moment of inertia

show that for large oscillations, the pendulum period depends onamplitude of oscillation - it is known that as amplitude increases, thenso must period

estimate stored energy, and how energy decreases after each cycle

estimate the total energy over time - this requires that you estimatethe potential energy as well as the kinetic energy. Estimating kineticenergy requires estimating the velocity from the measured position.

Any one of these motivates the need to analyze the signals and the data ina certain way.

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 15: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

Suggestions for lab practice

Make notes on how to connect power, sensors, and measured signalsproperly. Simple circuit knowledge is all that is needed, and it canhelp you make sure you collect the signals correctly and don’t damageequipment.

Keep separate issues of software from hardware, but understand theywork together. LabVIEW does not measure signals – instruments dothat. LabVIEW is software that controls hardware. The hardwaredoes the actual data collection.

Similarly, we’ll use LabVIEW to numerically solve equations, butLabVIEW does not “model a physical system”– you do that!

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 16: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

Summary

Use this lab to build experience using simple sensors

Use this known physical problem for purposeful learning of DAQusage, signal processing, etc.

Take opportunity to experiment with very basic LabVIEW VI for datacollection.

Experiment with myDAQ for quick data acquisition, testing, andmodel improvement

Data collected in this week’s experiments will be used in the followingweek and compared to results from simulation of the model

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 17: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

Appendix: NI myDAQ Specifications

Two Differential Analog Input and Analog Output Channels(200 kS/s, 16 bit, +/- 10 Volts)Access matched analog input and output channels in a +/- 10 volt rangethrough the screw terminal connectors or +/- 2 volt range through the3.5mm audio jacks.

+5 , +15, and -15 Volt Power Supply Outputs (up to 500m Watts of Power)USB powered for maximum mobility, myDAQ supplies enough power forsimple circuits and sensors.

Eight Digital Input and Digital Output Lines (3.3 Volt TTL-Compatible)Use software-timed digital lines for interfacing both Low Voltage TTL(LVTTL) and 5 volt TTL digital circuits. Each line is individually selectablefor input or output.

60 Volt Digital Multimeter (DMM) for Measuring Voltage, Current, andResistanceThe isolated DMM includes the capability to measure both AC and DCvoltage and current as well as resistance, diode voltage, and continuity.

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 18: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

Appendix: NI myDAQ block diagram

ME 144L Dynamic Systems and Controls Lab (Longoria)

Page 19: Data Acquisition and LabVIEWdsclab/leks/1c_DSC_DAQ_LabVIEW.pdf · Data Acquisition and LabVIEW Prof. R.G. Longoria Department of Mechanical Engineering The University of Texas at

Side bar – learning more about LabVIEW DAQ

Read about how data acquisition is accomplished using LabVIEW in GettingStarted with LabVIEW tutorial. Create a NI-DAQmx Simulated Device. Whendeciding on a type of device to simulate, choose E series (e.g., PCI-6025E).

Refer to and/or follow the following instructions:

1 Refer to online note that explains how:http://zone.ni.com/devzone/cda/tut/p/id/3698

2 If you did not install NI-DAQmx device drivers on your own computer, oryou prefer not to, then you need to use the METER lab for this purpose.The NI-DAQmx drivers are required if you will use LabVIEW to control DAQhardware.

3 Using a NI-DAQmx Simulated Device: study from page 4-1 to 4-6 ofChapter 4 in the Getting Started with LabVIEW tutorial. This exampleshould simulate collection of 2 channels of data; when the “while” loop isstopped the data should be saved to a LabVIEW measurement file. Here iswhat the menu sequence might look like.

ME 144L Dynamic Systems and Controls Lab (Longoria)