Introduction to NI LabVIEW and Computer-Based Measurements
Elias Nicolas
Applications Engineer National Instruments
Today, Well Explore:
The Challenges of Making Measurements Introduction to LabVIEW Fundamentals of Data Acquisition
Characteristics of Mixed-Measurement Systems The National Instruments Approach Architecture of a Measurement System History and Philosophy of LabVIEW Gaining LabVIEW Proficiency Essential Data Acquisition Concepts The Basics of Signal Conditioning The Value of National Instruments Hardware Platforms
Break
Enjoy Coffee and Networking With Peers
Uniting Software and Hardware
ni.com
Architecture of the NI-DAQmx Driver Measurement Services and Utilities Exploring and Using the NI-DAQmx API
2
The Challenges of Making Measurements
Exploring the Traditional Approach to Measurements
ni.com
The Origin of Automated Measurements
Traditional pen-and-paper approach Redundant circuitry between instruments (e.g., displays) Manual data recording and analysis Error-prone processes Difficult to reproduce or redo
ni.com
Mixed-Measurement Applications Are Diverse
Vibration Torque Displacement
Pressure
Temperature
Force
Strain
ni.com
Example Application: Air Quality Measurements
Potential Sensors Needed:
Context
GPS
Timestamp Position
Attitude Altitude Range Finder Temperature Oxygen Carbon Dioxide Ozone Nitrogen
Environmental
Sensors, Interfaces, and Signal Conditioning
Sensor GPS Interface RS232 Conditioning? No
Attitude, Altitude
RS232
No
LiDAR
Ethernet
No
Temperature
Analog Voltage
Required
O2, CO2, O3, NH3
Analog Voltage
Required
ni.com
Software Provided With Sensors
Sensor GPS Software
Attitude, Altitude
LiDAR
Temperature
O2, CO2, O3, NH3
<No Software Provided>
ni.com
With a System Like This, How Do You Accommodate
changes in requirements? mixed measurements in a single system? varying connectivity? signal conditioning for sensors? adding or replacing measurements or sensors? incorporating timing, triggering, or synchronization? leveraging emerging technology trends? multiple disparate software environments and APIs?
ni.com
The Human Body A Wonderful Sensing System
ni.com
10
The Human Body A Wonderful Sensing System
Analysis and Decisions
ni.com
11
National Instruments Strategy: Graphical System Design
Your Investment in a Platform-Based Approach to Measurements Scales Across
Test Monitor Embedded Control Cyber Physical
Industries and Applications
Hardware and I/O Devices
Desktops and PC-Based DAQ
PXI and Modular Instruments
NI CompactRIO
Open Connectivity With Third-Party I/O
ni.com
12
Top Benefits of an Integrated Measurement Platform
1.
Accelerated Productivity
2. 3.
ni.com
Proven Performance and Accuracy
Scalability, Adaptability, and Flexibility
13
Architecture of an Integrated Measurement System
Today, well learn about three key differentiating components of a National Instruments data acquisition system:
Sensor
Measurement Device
Software
Signal Conditioning
Analog-to-Digital Converter
Driver Software
Application Software
ni.com
14
Architecture of an Integrated Measurement System
LabVIEW is system design software that provides engineers and scientists with the tools needed to create and deploy measurement and control systems through unprecedented hardware integration.
Sensor
Measurement Device
Software
Signal Conditioning
Analog-to-Digital Converter
Driver Software
Application Software
ni.com
15
The Foundation of LabVIEW: Virtual Instrumentation
Automation through software led to a realization about fixed-functionality instrumentation
Redundancy: Power Supplies Each separate instrument requires its own power supply to run measurement circuitry that captures the real-world signal.
Redundancy: Memory PCs can quickly capitalize on a performance boost from a memory upgrade from readily available RAM. Redundancy: Displays Instrument vendors provide a limitedquality display per instrument, even though monitor technology is far more advanced.
Redundancy: Storage Each instrument duplicates onboard storage even though PC hard drives are plentiful and cost-effective. Redundancy: Processors Chip manufacturers rapidly enhance processors according to Moores law, but instruments have fixed processing power.
ni.com
16
The Foundation of LabVIEW: Virtual Instrumentation
By leveraging COTS PC components, the software becomes the instrument
LabVIEW unlocks the power of instrument and data acquisition hardware by capitalizing on the PC industry and abstracting redundant circuitry.
ni.com
17
The Fundamentals of Data Acquisition (DAQ)
The Basics of Making PC-Based Measurements
ni.com
What Is Data Acquisition (DAQ)?
Data acquisition (DAQ) is the process of measuring an electrical or physical phenomenon such as voltage, current, temperature, pressure, or sound with a computer. Compared to traditional measurement systems, PC-based DAQ systems exploit the processing power, productivity, display, and connectivity of industry-standard computers providing a more powerful, flexible, and cost-effective measurement solution.
ni.com
19
All Measurements Are Technically Inexact
Electronic components naturally drift over time and require calibration
Manufacturers specification of measurement uncertainty
Effect of Environmental Drift
? Measurement Error
Measured values
Time 24 Hrs 90 Days 1 Year
error + error - error
Input value
Effect of Aging Drift
ni.com
20
Signals Come in Two Forms: Digital and Analog
Digital
Analog
ni.com
21
Digital Signals
Digital signals have two states: high and low Digital lines on a DAQ device accept and generate transistor-transistor logic (TTL) compatible signals
+5.0 V
High State
+2.2 V
Indeterminate Low State
State
+0.8 V 0V
Rate
ni.com
22
Digital Terminology
0 1
Bit
The smallest unit of data. Each bit is either a 1 or a 0.
A binary number consisting of eight related bits of data.
Byte
0110100 1 1010110 0
Line
One individual signal in a port. Bit refers to the data transferred. Line refers to the hardware.
A collection of digital lines (usually four or eight).
Port
ni.com
23
Signals Come in Two Forms: Digital and Analog
Digital
Analog
ni.com
24
Analog Signals
Analog signals are continuous signals that can be any value with respect to time.
ni.com
25
Analog Terminology
4.71 V
Level
The instantaneous value of the signal at a given point in time.
Shape
The form that the analog signal takes, which often dictates further analysis that can be performed on the signal.
Frequency
The number of occurrences of a repeating event over time.
ni.com
26
The Three Rs of Data Acquisition: Resolution
Resolution
6-Bit Resolution
Range
Rate
Original Signal 3-Bit Resolution
ni.com
27
The Three Rs of Data Acquisition: Range
Resolution Range Rate
Original Signal
Range of -10V -2V to to 10V 2V 3-Bit Resolution
ni.com
28
The Three Rs of Data Acquisition: Rate
Resolution Range
Original Waveform (10 Hz)
Rate
Sampling SamplingRate Rate= =100 25 11 Hz Hz
ni.com
29
Sampling Rate Considerations
An analog input signal is continuous with respect to time.
Sampled signal is series of discrete samples acquired at a specified sampling rate. The faster we sample, the more our sampled signal will look like our actual signal. If not sampled fast enough, a problem known as aliasing will occur.
Actual Signal
Sampled Signal
ni.com
30
Aliasing
Sample rate: how often an A/D conversion takes place Alias: misrepresentation of a signal
Adequately Sampled
Amplitude
Frequency
Aliased Due to Undersampling
Amplitude
Frequency
ni.com
31
Following the Nyquist Theorem Prevents Aliasing
Frequency
To accurately represent the frequency of your original signal
You must sample at greater than 2 times the maximum frequency component of your signal.
Shape
To accurately represent the shape of your original signal
You must sample between 510 times greater than the maximum frequency component of your signal .
ni.com
32
The Nyquist Theorem in Action
Aliased Signal 100 Hz Sine Wave
Sampled at 100 Hz
Adequately Sampled for Frequency Only
100 Hz Sine Wave
Sampled at 200 Hz Adequately Sampled for Both Frequency and Shape
100 Hz Sine Wave
Sampled at 1 kHz
ni.com
33
Conditioning Signals for Quality Measurements
Signal conditioning improves a signal that is difficult for your DAQ device to measure Signal conditioning is not always required
Signal Conditioning
Noisy, Low-Level Signal
Filtered, Amplified Signal
ni.com
34
Common Signal Conditioning Examples
Transducer/Signals
Thermocouples RTD (Resistance Temperature Detector) Strain Gage
Signal Conditioning
Amplification, Linearization, Cold-Junction Compensation
Current Excitation, Linearization Voltage Excitation, Bridge Configuration, Linearization Isolation Amplifier Electromechanical Relays or Solid-State Relays Low-Pass Filters
35
Common Mode or High Voltage Loads Requiring AC Switching or Large Current Flow High-Frequency Noise
ni.com
Examining Common Signal Conditioning for Voltage Measurements
Amplification
Attenuation
Filtering Isolation
ni.com
36
Amplification
Used on low-level signals Maximizes use of analog-to-digital converter (ADC) range and increases accuracy Increases signal-to-noise ratio (SNR)
Amplifier
ni.com
37
Example: Amplification and the Signal-to-Noise (SNR) Ratio
10 mV Signal 1 mV Noise
1000x Amplifier
ADC
SNR = 10
1 mV Noise
10 mV Signal
1000x Amplifier
ADC
ni.com
SNR = 10,000
38
Attenuation
Decreases the input signal amplitude to fit within the range of the DAQ device Necessary when input signal voltages are beyond the range of the DAQ device
Attenuator
ni.com
39
Filtering
Filters remove unwanted noise from a measured signal and block unwanted frequencies
Time Domain
Lowpass Filter
Time Domain
Frequency Domain
Frequency Domain
ni.com
40
Filtering
Passband
Ripple
Gain (dB)
Frequencies the filter lets pass Filters effect on the signals amplitude Frequency where the filter begins blocking the signal How sharply the filter cuts off unwanted frequencies
Ripple
Corner
Corner
Passband
Rolloff
Rolloff
fc
Frequency
Example Bode Plot
A filters attributes are typically described using Bode Plots
ni.com
41
Isolation
Isolation helps to pass a signal from its source to a measurement device without a direct physical connection Blocks high common-mode signals Breaks ground loops Protects your instrumentation
Electromagnetic
Isolation
Capacitive
Optical
ni.com
42
Architecture of an Integrated Measurement System
NI CompactDAQ hardware combines a 1-, 4-, or 8-slot chassis with over 50 measurement-specific NI C Series I/O modules and can operate stand-alone with a built-in controller or connect to a host computer over USB, Ethernet, or 802.11 Wi-Fi.
Sensor
Measurement Device
Software
Signal Conditioning
Analog-to-Digital Converter
Driver Software
Application Software
ni.com
43
NI Data Acquisition Hardware Families
PXI Optimized for high channel counts and tight synchronization
System
NI CompactDAQ Customize with a variety of chassis and module types
Desktop DAQ Install in a desktop PC slot for maximum data throughput
Portable DAQ Easily connect to any laptop or desktop with simple setup
Single Device
ni.com
44
NI CompactDAQ Is an Integrated, Modular Solution
Sensors/Signals
C Series Modules
Thermocouple
Accelerometer
Strain Gage
Solar Cell
(etc)
ni.com
45
C Series I/O Modules
Over 100 NI and Partner Modules
Analog Input Analog Output Digital I/O Relay Output Counter, Pulse Generation Communication
o o o
CAN LIN PROFIBUS
Motion Control Wireless Engine Control
Signal Conditioning Rugged Mechanicals Signal Conditioning/Filtering Isolation Barrier
ni.com
46
ni.com
47
Combining Software and Hardware Into an Integrated System
Automated Measurement Solutions With LabVIEW and NI DAQ
ni.com
Architecture of an Integrated Measurement System
NI-DAQmx is free driver software that can be used in conjunction with several different programming languages to control thousands of different data acquisition devices with a consistent API.
Sensor
Measurement Device
Software
Signal Conditioning
Analog-to-Digital Converter
Driver Software
Application Software
ni.com
49
Bridging the Hardware and Software Gap with NI-DAQmx
NI-DAQmx is a single, free hardware driver that supports various development languages and hundreds of NI data acquisition hardware platforms.
The mark LabWindows is used under a license from Microsoft Corporation. Windows is a registered trademark of Microsoft Corporation in the United States and other countries.
ni.com
50
Comparing Basic DAQ Drivers to NI-DAQmx
Basic DAQ Driver Architecture NI-DAQmx Driver Architecture
Application Software DAQ Assistant Driver Engine Configuration Manager API Driver Engine DAQ Hardware
ni.com
51
Measurement & Automation Explorer (MAX)
Free, unified configuration management utility for NI hardware
Task and Channel Creation
Configuration and Connection Management
Simulated Devices
Built-In Signal Connection Diagrams
Test Panel Windows
ni.com
52
Exercise 1: Using Measurement & Automation Explorer
Become familiar with the Devices and Interfaces section of MAX and explore the test panel functionality.
ni.com
53
NI-DAQmx API: Configuration-Based DAQ Assistant
Enables quick, configurationbased measurements Usable across multiple channels, multiple devices Maximum ease of use with some sacrificed flexibility
Supported across multiple programming languages
Automatically generates lowerlevel code
ni.com
54
Exercise 2: Generate Code by Using the DAQ Assistant in LabVIEW
Implementing a code on LabVIEW for temperature measurement using the DAQ Assistant Express VI.
ni.com
55
NI-DAQmx API: Low-Level LabVIEW VIs
Maximizes flexibility and enables low-level control The basic flow:
Configure Channel
Configure Timing
Configure Start Triggering Acquisition
Read Data
Clear Task
ni.com
56
NI-DAQmx C API
DAQmxCreateAIVoltageChan( taskHandle, Dev1/ai0, , DAQmx_Val_Cfg_Default, -10.0, 10.0, DAQmx_Val_Volts, NULL );
Configure Channel
DAQmxCfgSampClkTiming( taskHandle, , 10000.0, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, 1000 );
Configure Timing
DAQmxStartTask( taskHandle );
Start Acquisition
DAQmxReadAnalogF64( taskHandle, -1, 10.0, 0, data, 1000, &read, NULL ); printf( Acquired %d samples. %d, read );
Read Data
DAQmxClearTask( taskHandle );
Clear Task
ni.com
57
NI-DAQmx Channels
NI-DAQmx channels encompass:
Measurement type, sensor/signal type Terminal configuration Physical connection settings Name Min/Max Value
o
Used to determine amplification level Ex: thermocouple generates a mV signal; NI-DAQmx upscales to C
58
Custom Scaling
o
ni.com
Timing
Allows you to configure acquisition timing Set sample clock, rate of acquisition, and number of samples to acquire or generate Timing Option Description
Acquire or generate a configurable number of samples at a configurable rate. Acquire or generate samples continuously, until explicitly stopped by the API. Acquire or generate samples continuously on the edge of a hardware clock.
Finite Samples
Continuous Samples
Hardware-Timed Single Point
ni.com
59
Triggering
Produces an action based on a stimulus
Ex: generate a waveform after receiving a digital pulse
NI-DAQmx supports several different action types:
Advance
Switch to the next device in a list
Pause
Pause when a trigger is low Resume when a trigger is high
Reference
Acquisition starts with software Circular buffer is used until reference trigger is received Returns pre- and posttrigger samples
Start
Begin acquisition Begin generation
ni.com
60
Triggering
Event-driven acquisition or generation Valid for finite or continuous operations Example: acquire 5 samples on a start trigger:
Start Trigger
Clock
1 2 3 4 5
Start of Acquisition
ni.com
61
Trigger TypesDigital Edge Triggering
Accepts TTL/CMOS-compatible signals
0 to 0.8 V = logic low 2.2 to 5 V = logic high
Trigger on rising or falling edge of signal
Trigger on Rising Edge Trigger on Falling Edge
Begin Acquisition
Begin Acquisition
ni.com
62
Trigger TypesAnalog Edge Triggering
Trigger off signal level and slope Slope can be rising or falling
Rising Slope with Level 2.7
Captured data
Falling Slope with Level 2.7
Level and slope initiate data capture
2.7 0
Level and slope initiate data capture
2.7 0
Captured data
ni.com
63
Exercise 3: Generate Code Using the DAQ low-level VIs
Implementing a code on LabVIEW for vibration measurement using the DAQmx low-level VIs.
ni.com
64
Family Highlight: Stand-Alone NI CompactDAQ
Embedded Measurements and Logging
>50 I/O modules Up to 24-bit, Up to 1 MS/s Dual-core processor 32 GB nonvolatile storage
0 to 55 C Operating Temp 5g shock, 30g vibration Windows or Real-Time OS LabVIEW and NI-DAQmx
ni.com
65
Utilizing Technology Trends With an Integrated Platform
Data Dashboard for LabVIEW
Control and visualize data from LabVIEW systems on an iPad
ni.com
66
NI LabVIEW Certifications
Certified LabVIEW Architect
Certified LabVIEW Developer
On May 16th, FREE Certified LabVIEW Associate Developer!!
Certified LabVIEW Associate Developer ni.com
67
Thank You!!
ni.com
68