Real-time data acquisition techniques Programming device operation

Download Report

Transcript Real-time data acquisition techniques Programming device operation

Advanced Programming for 3D
Applications
CE00383-3
Data Acquisition
Lecture 10
Bob Hobbs
Staffordshire university
Definition
• Data acquisition is the process by which
•
2
physical phenomena from the real world
are transformed into electrical signals
that are measured and converted into a
digital format for processing, analysis,
and storage by a computer.
data acquisition (DAQ) system is designed
not only to acquire data, but to act on it as
well.
DAQ and Control
• Control
– is the process by which digital control signals
from the system hardware are convened to
a signal format for use by control devices
such as actuators and relays.
• These devices then control a system or
process.
• Where a system is referred to as a data
acquisition system or DAQ system, it is
possible that it includes control functions as
well.
3
Elements of
a data acquisition system
Sensors and transducers
 Field wiring
 Signal conditioning
 Data acquisition hardware
 PC (operating system)
 Data acquisition software
4
Basic elements
Sensors and transducers
5
Data Acquisition and Processing
6
Sensors and Transducers
• Transducers and sensors provide the
actual interface between the real world
and the data acquisition system
• convert physical phenomena into electrical
signals that the signal conditioning and/or
data acquisition hardware can accept.
7
wiring and communications cabling
• Field wiring represents the physical
•
8
connection from the transducers and sensors
to the signal conditioning hardware and/or
data acquisition hardware.
When the signal conditioning and/or data
acquisition hardware is remotely located from
the PC, then the field wiring provides the
physical link between these hardware
elements and the host computer.
Signal conditioning
• Filtering
• Amplification
• Linearization
• Isolation
• Excitation
9
Filtering
• In noisy environments, it is very difficult
for very small signals received from
sensors such as thermocouples and strain
gauges (in the order of mV), to survive
without the sensor data being
compromised.
10
Amplification
• Having filtered the required input signal, it must
•
11
be amplified to increase the resolution.
The maximum resolution is obtained by
amplifying the input signal so that the maximum
voltage swing of the input signal equals the
input range of the analog-to-digital converter
(ADC), contained within the data acquisition
hardware.
Linearization
• Many transducers, such as
thermocouples, display a non-linear
relationship to the physical quantity
they are required to measure.
• The method of linearizing these input
signals varies between signal
conditioning products.
12
Isolation
• Signal conditioning equipment can also be used
•
13
to provide isolation of transducer signals from
the computer where there is a possibility that
high voltage transients may occur within the
system being monitored, either due to
electrostatic discharge or electrical failure.
Isolation protects expensive computer
equipment
Excitation
• Signal conditioning products also provide
excitation for some transducers.
• For example:
– strain gauges, thermistors and RTDs
– require external voltage or current excitation
signals.
14
Functions of Acquisition hardware
1. The input, processing and conversion to
2.
3.
4.
15
digital format, using ADCs, of analog signal
data measured from a system or process –
the data is then transferred to a computer for
display, storage and analysis
The input of digital signals,
The processing, conversion to analog
format, using DACs,
Output of digital control signals
Hardware /Links with Computer
• Ports for data acquisition
– RS232
– IEEE-488 (GPIB (General Purpose
Interface Bus)
– Printer port
– Sound Card ports
– Specially designed BUS Cards
– DAQ cards
16
Software
• Application software can be a
• full screen
• interactive panel,
• a dedicated input/output control program,
• a data logger,
• a communications handler,
– or a combination of all of these.
17
Options for software
• Program the registers of the data acquisition
•
•
18
hardware directly
Utilize low-level driver software, usually provided
with the hardware, to develop a software
application for the specific tasks required
Utilize off-the-shelf application software (third
party packages such as LabVIEW provide a
graphical interface for programming)
PC
• Depending on the particular application,
the
– microprocessor speed,
– hard disk access time,
– disk capacity
– types of data transfer available,
can all have an impact on the speed at which
the computer is able to continuously acquire
data.
19
Classification of Signals
• The Output signal has a relationship with the
•
physical phenomenon.
For Example,
– value of e.m.f obtained from a thermocouple, has
relationship with the temperature
– Voltage or current output signal from transducers has
some direct relationship with the physical phenomena
they are designed to measure.
20
Digital signals/ binary signals
• A digital, or binary,
signal can have only
two possible
specified levels or
states; an ‘on’ state,
in which the signal is
at its highest level,
and an ‘off’ state, in
which the signal is at
its lowest level.
21
Examples:- the output voltage signal
of a transistor-to-transistor logic (TTL),
Control devices, such as relays, and
indicators such as LEDs,
Digital pulse trains
• a sequence of digital pulses
• a digital pulse can have only two defined
•
22
levels or states.
For Example:- Output of level indicator,
Control of speed and position of a stepper
motor
Analog signals
Analog signals contain information within the
variation in the magnitude of the signal with
respect to time.
information contained in the signal is dependent
on whether the magnitude of the analog signal is
varying slowly or quickly with respect to time.
For Example:-Temperature and Pressure
measurement, control hardware like a valve
actuator,
23
Analog DC signals
24
Analog Signals Conversion
• DAQ hardware would only be
•
25
required to convert the signal level
to a digital form for processing by
the computer using an analog-todigital converter (ADC).
Low speed A/D boards would be
capable of measuring this class of
signal.
Analog Signal
26
Sensors and transducers
• A transducer is a device that converts one
•
•
form of energy or physical quantity into
another, in accordance with some defined
relationship.
In data acquisition systems, transducers
sense physical phenomena and provide
electrical signals that the system can accept.
For example,
– thermocouples convert temperature into an analog
voltage signal
– flow transducers produce digital pulse trains
whose frequency depends on the speed of flow.
27
Categories of Transducers
• Active transducers convert non-electrical
•
28
energy into an electrical output signal. They
do not require external excitation to operate.
Thermocouples are an example of an active
transducer.
Passive transducers change an electrical
network value, such as resistance, inductance
or capacitance, according to changes in the
physical quantity being measured. Strain
gauges (resistive change to stress) and
LVDTs (inductance change to displacement)
are two examples of this.
Signal Conditioning
• Filtering of signals
• Cut-off frequency
•
29
>This is the transition
frequency at which the filter takes effect. It may
be the high-pass cut-off or the low-pass cut-off
frequency and is usually defined as the frequency
at which the normalized gain drops 3 dB below
unity.
Roll-off >This is the slope of the amplitude versus
the frequency graph at the region of the cut-off
frequency. This characteristic distinguishes an
ideal filter from a practical (non-ideal) filter. The
roll-off is usually measured on a logarithmic scale
in units of decibels (dB).
Low pass filters
• Low pass filters pass low frequency
components of the signal and filter out
high frequency components above a
specific high frequency.
Signal after
filters
30
How Computer Takes INPUT signals
• Interrupts
– CPU of a computer can attend to important events
such as keystrokes or characters arriving at the
COM port only when they occur.
– This allows the CPU to execute a program and
only service such I/O devices as needed
• DMA
– Microprocessor controls data transfers within the
PC (using the IN(port) and OUT(port) instructions.
– In many I/O interfacing applications and certainly
in data acquisition systems, it is often necessary to
transfer data to or from an interface at data rates
higher than those possible using simple
programmed I/O loops.
31
Interrupts
• Hardware interrupts
These are generated electrically by I/O devices
that require attention from the CPU.
• Software interrupts
There are 256 possible interrupt types that can
be generated by software.
• Processor exceptions
Exceptions are generated when an illegal
operation is performed in software (for
example divide by zero).
32
Programmable interrupt controller(s)
33
Computer Operations
• Memory-read: data transfer from a memory
•
•
•
•
•
34
device to the CPU
Memory-write: data transfer from the CPU to
a memory device
I/O-read: data transfer from an I/O device to
the CPU
I/O-write: data transfer from the CPU to an
I/O device
DMA Write I/O: data transfer from a memory
device to an I/O device
DMA Read I/O: data transfer from an I/O
device to a memory device
Communication I/O devices
• Serial Port
• Parallel Port
• PCI Bus
• EISA Bus
35
Serial Communication
• RS-232
• USB
• Synchronous and Asynchronous
36
Serial Communication Hardware
• UART (Universal Asynchronous Receiver
Transmitter) -- Translates data between
parallel and serial forms
– Included in Tmote microcontroller
– RX, TX, and FIFO buffers
• Line driver -- Converts circuit level
voltages to line voltages and vice versa
• USB controller
37
Serial Communication Parameters
• Baud Rate
• Start Bit
• Data Bits – 5 to 8
• Parity – Error check (Even, Odd, none)
• Stop Bit(s)
• Flow Control (DTR/DSR, RTS/CTS, Xon/Xoff,
•
38
none)
Start and Stop bits not necessary for
synchronous communication
Serial Communication
Example Parameters
•
•
•
•
•
39
Baud rate = 115200 bps
8 Data Bits
No parity
1 Stop Bit
No Flow Control
Serial Communication Signals
• Transmitted Data (TxD)
• Received Data (RxD)
• Ground (GND)
40
Serial Communication
Signals
• Request To Send (RTS)
•
•
•
•
41
– Asserted (set to 0) by sender to
– prepare receiver to receive data.
Clear To Send (CTS)
– Asserted by receiver to acknowledge RTS and allow transmission.
Data Terminal Ready (DTR)
– Asserted by device to indicate that it is ready to be connected. If the
device is a modem, this may "wake up" the modem, bringing it out of a
power saving mode.
Data Set Ready (DSR)
– Asserted by host to indicate an active connection.
Data Carrier Detect (DCD)
– Asserted by host when a connection has been established with remote
equipment.
Flow Control
• Flow control avoids overflow
• Can Eliminate the need for flow control
by…
– Regulating speeds
– Packet size smaller than buffers
42
Signal Processing
• Data acquired can be in a variety of forms
• DA hardware has to process the signal
• Device driver manages conformed signal
43
Analog & Digital Signal
• Analog signal must be converted into Digital
form (Discrete) before DSP techniques can
be applied. The analog signal is basically
denoted as x[t] or xa[t] because it varied by
time. The analog signal comes in form of
sinusoid (sine or cosine wave).
• The Analog signal is digitized by using
Integrated Electronic Circuit device called an
Analog-to-Digital Converter (ADC). The
output of ADC will be in the form of binary
number that represents the analog signal
such as electrical voltage.
44
Analog & Digital Signal
• The analog signal are always come with noise.
Thus the noise filtering is needed before the
signal goes to ADC. The filtering can be done
by using DSP techniques.
• The special purpose microprocessors are
designed to carry out application of DSP. It is
named as Digital Signal Processors (DSPs) and
used in real time application.
45
Digital Signal Processing
• DSPs are programmable devices and capable of
•
•
46
carrying out millions of instruction per second.
It is vital to know how Digital Signal Processing work
before we go to DSPs (The diagram of the process is
shown in Figure 1 and 2).
The signals and systems must come together. The
systems are needed to operate the signals. For
example, we need to use Thermometer to measure
Temperature, Microphone to carry out analog signal
(human voice) and convert it to electrical signal,
Charge-Couple Device (CCD) used in in Camera or
Digital Camera to convert image to picture and so on.
In general, the system is characterized by the type of
operation that it performs on the signal.
Discrete Signals
Figure 1 : Digitized process of signal
47
Figure 2 : Complete Process of Digital Signal
48
• From the diagram, it can be seen that ADC and
DAC are 2 vital devices used in signal
processing to convert the signal from analog to
discrete (digital) and vice versa.
• ADC is basically consists of Sampler, Quantizer
and Coder. All this elements are built up by
CMOS Switched-Capacitor (for Sampling), OpAmp (Signal Amplification) & Comparator
(Quantizer).
49
• Quantization is the conversion of discrete-
time continuous-valued to discrete-time
discrete- valued (digital) signal. The
difference of this is called Quantization Error.
• The coder in ADC will convert the output of
the Quantizer to b-bit binary sequence that
can be read by DSPs (Digital Signal
Processors).
• The DAC, will perform a reverse operation of
ADC in order to generate back analog signal.
50
• DSP CAN BE APPLIED IN THE FOLLOWING FIELDS :
=> COMMUNICATION SYSTEMS
(MOBILE PHONE, SATELLITE, RADAR, SONAR,
INTERNET)
=> ENTERTAINMENT ELECTRONICS
(RADIO, TV, Hi-Fi, CD/VCD/DVD PLAYER,MP3),
=> MULTIMEDIA
(ACOUSTICS, IMAGE, SPEECH RECOGNIZATION &
VIDEO CODING, DIGITAL CAMERA),
51
=> MEDICAL INSTRUMENT
(ECG – Electrocardiogram – provides
information about the condition of patient’s heart),
=> GEOPHYSICS (Seismology)
(Apparatus used to measure earth movement)
=> INSTRUMENTATION
(ELECTRONIC TESTER Such as Digital Multimeter,
Oscilloscope)
=> IC TECHNOLOGY
=> DATA COMPRESSION
52
Signal and noise
53
Signals convey relevant information…
but what is relevant can be very relative!
Continuous and discrete signals
Continous signal
xa(t)
Discrete signal
(sequence)
x[n]
54
x[n] = xa(nT)
T
: sampling period
fs = 1/T : sampling rate
Basic sequences
Unit impulse
Unit step
Sinusoidal
Exponential
Periodic
55
Random
Examples of digital signals
Periodic
.
.
.
.
Random
56
Frequency
Speech signals…
57
Time
Frequency
one more…
58
Time
more examples…
59
more examples…
Earthquake prediction???
60