DAQ

advertisement
NCTU VBI Lecture
Step-by-Step Data Acquisition
Hsiang-Sheng Huang (黃翔鉎)
National Instruments Taiwan
Applications Engineer
1
National Instruments Confidential
課程大綱:
•
DAQ System Overview
•
DAQ Functionalities
–Analog Input
–Analog Output
–DIO
–Counter
•
Summary
2
DAQ System Overview
3
What is DAQ? = Data Acquisition
•An automatic collection of data from sensors,
instruments, and devices in a factory,
laboratory, or in the field.
•
To measure/convert a physical phenomenon
into a measurable electrical signal
Phenomenon
Data
DAQ
System
4
DAQ System Overview
Software
DAQ Device
Signal
Conditioning
Signal
Transducer
5
National Instruments Confidential
Computer-Based DAQ System
Plug-in
DAQ Board
PC&Software
Signal
Conditioning
Terminal
Blocks
I/O Signal
and
Sensors
6
What is a Transducer?
Physical
Phenomena
Signal
A transducer converts a physical
phenomena into a measurable electrical signal that a
DAQ system measures.
7
Types of Transducers
Phenomena
Transducer
Temperature
Thermocouples
Resistive Temperature Devices (RTDs)
Thermistors
Vacuum tube
Photo sensors
Microphone
Light
Sound
Force and Pressure
Position and Displacement
Fluid
pH
8
Strain gauges
Piezoelectric transducers
Potentiometers
Linear voltage differential transformer
Optical encoder
Head meters
Rotational flowmeters
pH electrodes
http://ni.com/sensors
9
Signal
Transducer
^
on
State
off
>t
Digital
Signal
Conditioning
^
Rate
1
>t
0
Signal
^
Hardware
0.75
Level
>t
^
Shape
Analog
>t
^
Frequency
>f
10
Signal
Software
Signal Conditioning
•
The process of measuring and manipulating
signals to improve the quality of measurement
Filtering
Filtering
Amplification
1 mV
Isolation
Amplification
500V
Voltage Spike
Isolation
etc.
Signal Amplification
•
Used on low-level signals such as thermocouples
•
Maximizes use of Analog-to-Digital Converter (ADC) range and
increases accuracy
•
Increases Signal to Noise Ratio (SNR)
Noise
+
_
Low-Level Signal
12
Instrumentation
Amplifier
ADC
Lead Wires
External
Amplifier
DAQ Device
Signal to Noise Ratio
•
Large Signal to Noise Ratio (SNR) is best
•
Put amplifier as close to signal source as possible
to prevent amplifying the noise
Amplify only at
DAQ Device
Amplify at Signal
Conditioning and
DAQ device
Amplify only at
Signal
Conditioning
13
Signal
Voltage
Signal
Conditioning
Amplification
Noise in
Lead
Wires
DAQ Device
Amplification
Digitized
Voltage
SNR
.01 V
None
.001 V
x 100
1.1 V
10
.01 V
x 10
.001 V
x 10
1.01 V
100
.01 V
x 100
.001 V
None
1.001 V
1000
Signal Amplification
Amplifier
•Increases Signal-to-Noise Ratio (SNR)
10 mV
signal
1 mV
noise
SNR = 10
14
12-bit
Digitizer
Signal Amplification
Demo
Amplifier
•Increases Signal-to-Noise Ratio (SNR)
X 1000
10 mV
signal
10 V
signal
1 mV
noise
SNR = 10,000
15
12-bit
Digitizer
http://ni.com/signalconditioning
Front-end Signal Conditioning
SCC
SCXI
Integrated Signal Conditioning
SC-Series DAQ
CompactDAQ
DAQ Device Key Features
•
Analog Input
•
Analog Output
•
Digital I/O
•
Counter
Multi-function DAQ Device
Transducer
MUX
ADC
DAC
Cable
Digital
Counter
Your Signal
Signal
Condition
18
Computer I/O
RTSI
DAQ Device - NI solutions
•
E-Series : (Low Cost/Full-Featured Multifunction DAQ)
•
M-Series : (Next-Generation Multifunction DAQ)
•
S-Series : (Simultaneous Sampling Multifunction DAQ)
•
SC-Series : (DAQ with Signal Conditioning)
•
B-Series : (Basic Multifunction DAQ)
•
Portable DAQ : (USB, FireWire or PCMCIA)
19
NI Software Solution
Diagnostic Tool:
Measurement &
Automation Explorer
NI-DAQmx
Driver
Software
(*.DLL)
NI-DAQmx
VIs
LabVIEW
DAQ Device
Configuration Tool:
Measurement &
Automation Explorer
20
What is NI-DAQmx?
•
Driver level software
–Compatible with more than 250 DAQ Devices
–High performance driver engine, full-featured driver
software for Windows and Linux
•
Supports the following software:
–LabVIEW
–Measurement Studio
–Signal Express
–LabWindows/CVI
–Real-Time Module
21
–
Microsoft Visual Basic
.NET
–
Microsoft Visual C/C++
–
Microsoft C# .NET
–
ANSI C
Benefits of NI-DAQmx
•
DAQ Assistant
–Reduces development time with its interactive features
•
Increased performance –faster single point I/O and
multithreading
•
Simple and intuitive API
–Similar API for all programming languages
•
DAQ property nodes and waveform support
•
Run NI-DAQmx programs and Assistant without the
hardware!!
22
DAQ Assistant
23
What is MAX?
•
Measurement & Automation EXplorer
•
Used for configuring and testing devices
24
Test Panels
•
Utility for testing
–Analog Input
–Analog Output
–Digital I/O
–Counter I/O
•
Great tool for
troubleshooting
Demo
25
DAQ Signal Accessory
•3 Connectors
•Quadrature Encoder
•Relay
•Digital Trigger
•4 LEDs (reverse logic)
•Counter I/O
•Function Generator
•Function Generator Frequency Control
•Temperature Sensor
•Temperature Sensor Noise Control
•Analog Input
•Analog Output
26
How to choose the right
products?
27
How to find the right products? http://ni.com/daq
28
http://ni.com/advisor/
29
中場休息
Hsiang-Sheng Huang (黃翔鉎)
National Instruments Taiwan
Applications Engineer
30
Analog Input
31
Analog Input Operation
Onboard FIFO Memory
DATA
Input
Rate
PCI Bus
Transfer
Rate
PC
Buffer
ADE (Application)
Memory
RAM
LabVIEW
32
DAQ Device Architectures
•One amplifier and
A/D Converter for
ALL channels
Channel 0
ADC
AMP
MUX
–Cost effective
Channel n
–Used on most Eseries and M-Series Interval and Round-Robin Sampling Architecture
devices
•One amplifier and
A/D Converter for
EACH channel
Channel 0
AMP
ADC
–More expensive
–Used on most SSeries devices
Channel n
AMP
ADC
Simultaneous Sampling Architecture
33
Measuring Analog Input Signals
Factors to consider:
•Sampling rate
•Resolution
•Range and amplification
•Noise and filtering
34
Analog I/O: Sampling Rates and Update Rates
•Undersampling may result in the misrepresentation of
measured signal (aliasing).
•Once a signal is aliased, it is impossible to reconstruct
original signal.
•Sample at least twice as fast as the highest frequency
signal being measured.
35
Nyquist Theorem
•
You must sample at greater than 2 times the
maximum frequency component of your signal
to accurately represent the FREQUENCY of your
signal.
•
NOTE: You must sample between 5 - 10 times greater
than the maximum frequency component of your signal
to accurately represent the SHAPE of your signal.
36
AIO Terminology - Sampling Rate
Aliased Signal
100Hz Sine Wave
Sampled at 100Hz
Nyquist
Adequately
Sampled
forTheorem
Frequency Only
100Hz Sine Wave
Sampled at 200Hz
Adequately Sampled
for Frequency and
Shape
100Hz Sine Wave
Sampled at 1kHz
Aliasing Example
Signals before
acquisition
Signals after
acquisition
Demo
38
Alias frequency =
|(closest integer multiple of sampling frequency signal frequency)|
AIO Terminology - Resolution
•
The resolution on a DAQ
device is similar to the
marker on a ruler.
•
The more marks a ruler has,
the more precise the
measurements are.
39
16-bit versus 12-bit Measurements
40
Resolution
•
3-bit resolution can represent 8 voltage levels
•
16-bit resolution can represent 65,536 voltage levels
16-Bit Versus 3-Bit Resolution
(5kHz Sine Wave)
10.00
111
8.75
Amplitude
(volts)
7.50
110
6.25
101
3-bit resolution
100
5.00
011
3.75
010
2.50
001
1.25
0
16-bit resolution
|
0
000
|
|
|
|
50
100
Time (ms)
150
200
Signal Conditioning: Filtering
Lowpass
Filter
Time Domain
Time Domain
Lowpass
Filter
Frequency Domain
•Removes noise
•Blocks unwanted frequencies
42
Frequency Domain
DEMO: Measuring Temperature in LabVIEW
Find the maximum error possible from your measurement equipment configuration.
Use the online accuracy calculator. Visit ni.com/advisor/accuracy.
43
Hardware versus Software Timing
20 kHz Signal
44
1 kS/s to 20 kS/s
varying by point
0 to 200 kS/s
50 ns timing accuracy
Immediately available,
point-by-point data
Faster/better
frequency measurements
Using a Buffer to Acquire Samples
•Use in conjunction with hardware
timing
•Continuous or finite length
Data
Board
Memory
Data
PC
Memory
45
NI DAQmx VIs
DAQ Assistant to Configure
the Hardware and Generate Code
46
Basic and Advanced Functionality
in the Same Set of VIs
Advanced Calibration
and Configuration Routines
DEMO : Simple, Continuous and Express AI
Learn how to guarantee your measurement accuracy to within 0.0127% of the actual signal.
Request the Measurement Ready DAQ white paper today.
Visit ni.com/info and enter mready.
47
Analog Output
48
Analog Output Operation
Output
Rate
DATA
RAM
PC
Buffer
LabVIEW
49
PCI Bus
Transfer Onboard FIFO Memory
ADE (Application)
Memory
Rate
Analog Output Architecture
Channel 0 DAC
Channel 1 DAC
Channel 0
Channel 1
•Most multifunction DAQ devices have a Digital-to-Analog
Converter (DAC) for each analog output channel
•DACs are updated at the same time
•Similar to Simultaneous Sampling for Analog Input
50
DEMO : Generating an Analog Output Waveform
NI continues to expand the boundaries of cost-effective DAQ performance and accuracy.
Visit ni.com/daq for product specifications.
51
Digital I/O
52
Digital I/O
0 1 0 1 0
+5.0V
High
(Transistor-Transistor Logic)
+2.0V
+0.8V
0V
TTL
Low
DEMO : Controlling Lights and Switches
Keep your measurement in check with
NI basic and detailed calibration services. Visit ni.com/calibration.
54
Counter
55
Counter measurement types
•
Edge Counting
•
Pulse Generation
•
Pulse Measurement
•
Frequency Measurement
•
Position Measurement
Gate
Out
Count Register
Source
56
CIO Terminology –Resolution / Size
•
How high a counter can count
•
Counter register size = 2(resolution) - 1
•
Typical resolutions
–DAQ STC : 24 Bit counter ( up to 16,777,215)
–NI-STC2 : two 32 Bit counter ( up to 4,294,967,295)
–NI-TIO : 32 Bit counter ( up to 4,294,967,295)
57
CIO Terminology –Timebase / Max Source Frequency
•
The Speed of the fastest signal the counter can count.
•
Common timebases –from 100kHz to 80MHz
–DAQ STC : 100KHz and 20MHz timebases
–NI-STC2 : 80MHz timebases
–NI-TIO : 100KHz, 20MHz, and 80MHz timebases
timebases
58
Pulse / Frequency Measurement
•
Counter Size (Number of Bits) : 32 Bits
•
Max Source Frequency : 80MHz
•
An 80 MHz counter can count pulses that are 12.5 ns
apart
•
Measure pulse width up to 53s with 12.5 ns resolution
( 232-1 ) * 12.5 ns
Delay
59
Width
DEMO : Counting Rising Edges with a
Counter/Timer
NI offers comprehensive technical support through Application Engineers worldwide,
Web resources, and Premier Support. Visit ni.com/support.
60
Summary
DAQ
Device
•
Data Acquisition (DAQ)
•
DAQ System
Transducer
Signal
•
Programming with DAQmx
–DAQ Assistant
–Increased Performance
–Simpler API (Polymorphic VIs)
Signal
Conditioning
Hardware
Create Channel/Task
Set Timing (Optional)
Set Triggering (Optional)
Start Read/Write Data
Stop and Clear
61
Software
Question & Comment
別忘了填寫問卷!
Hsiang-Sheng Huang (黃翔鉎)
National Instruments Taiwan
Applications Engineer
62
M Series
E Series
Up to 1.25 MS/s (16-bit)
Up to 1.25 MS/s (12-bit)
16 or 18-bit
12 or 16-bit
NI-MCal (all ranges)
Linear, 2-point (single range)
Yes
No
Up to 2.8 MS/s, 16-bit
Up to 333 kS/s, 16-bit
Analog Output Ranges
Programmable per channel
±10 V, 0-10 V
Analog Output Offset
Programmable per channel
0V
Digital I/O Lines
24 or 48
8 or 32
Digital I/O Rate
Up to 10 MHz, clocked
Software-timed
Over/under voltage (±20 V),
overcurrent
None
Counter/Timers
2, 32-bit
2, 24-bit
Counter Timebase
80 MHz
20 MHz
Programmable per line
None
PLL, RTSI
RTSI
6
1 or 3
Sampling Rate
Input Resolution
Calibration Method
AI
Lowpass Input Filters
Analog Output Rate
AO
DIO
CTR
Digital Line Protection
Counter Debouncing
Filters
Clock Synchronization
Other
DMA Channels
Two set of NI-DAQ Driver
Traditional NI-DAQ
NI-DAQmx
Driver方式比較
Driver需透過OS去控制DAQ
卡,以Stack Sequence方式
執行程式,執行效能及效
率較差
Driver不需經由OS控制DAQ
卡,以Multithread方式執行
程式,故執行效能及效率
較佳
單點量測
較慢
較快
連續量測
相同
相同
單張卡片之Multithreading
支援單張卡的
Synchronization
不支援單張卡的
Synchronization
API比較
AI,AO,DIO,Counter有各自的
VI sets
為Polymorphism型式VI
NI-DAQmx vs. Traditional NI-DAQ (Legacy)
Feature
Productivity
Performance
Accuracy
Quality
Compatibility
66
NI-DAQmx
Traditional NI-DAQ
Test Panels


DAQ Assistant with code generation

n/a
Development Speed


On-line diagnostics


Scaling to voltage and physical units


Multi-threaded I/O Performance


Instant calibration


Automatic sensor scaling


Guaranteed lossless data


650 Alliance members


Integration with LabVIEW


Developer Exchange discussion forum


Compatible with PCI/PXI, PCMCIA, USB


 Best
Better
 Good
Convert Clock
MUX
Amp
Channel 0
Channel 1
Channel 1
Channel 2
Channel 2
Channel 3
Channel 3
Interval Sampling
15 µs
ADC
Amp
ADC
ADC
Channel 0
(270o
Amp
phase shift) between Ch 0 & 3
Simultaneous Sampling
3 ns (0.054o phase shift) between Ch 0 & 3
Multiple Device
Sample clock
Convert clock 1
Convert clock 2
CH1
CH2
Synchronizing Measurements
•
Start simultaneously
•
The same sampling rate
•
Sharing sample clock
•
Sharing timebase
Convert clock
MUX
ADC
DAC
Digital
Counter
Computer I/O
RTSI
What exactly is CompactDAQ
高達 24 位元解析度
3.2 MS/s 取樣率
高速 USB 2.0 連結
Signal Streaming 技術
8 槽機箱
可熱插拔模組
高達 2,300Vrms
提供高達 256 通道
每模組有獨立 A/D 轉換器
模組與機箱隔離
支援 DAQmx
以及文字語言驅動程式
內建訊號處理
與接線能力
目前提供超過
10 個不同種類模組
71
Types of Transducers
Phenomena
Transducer
Temperature
Thermocouples
Resistive Temperature Devices (RTDs)
Thermistors
Vacuum tube
Photo sensors
Microphone
Light
Sound
Force and Pressure
Position and Displacement
Fluid
pH
Strain gages
Piezoelectric transducers
Potentiometers
Linear voltage differential transformer
Optical encoder
Head meters
Rotational flowmeters
pH electrodes
Common Types of Signal Conditioning
Transducers/Signals
Thermocouples
RTDs
Strain Gages
Common Mode or High
Voltages
Signal Conditioning
Amplification, Linearization, and
Cold-Junction Compensation
Current Excitation, and
Linearization
Voltage Excitation, Bridge
Configuration, and Linearization
Isolation Amplifiers
(Optical Isolation)
Loads Requiring AC Switching
or Large Current Flow
Electromechanical Relays
or Solid-State Relays
Signals with High Frequency
Noise
Low-Pass Filters
DAQ Device
Download