lecture4 - DATA ACQUISITION AND NYQUIST SAMPLING THEOREM ME...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: DATA ACQUISITION AND NYQUIST SAMPLING THEOREM ME 4231 Rajesh Rajamani Department of Mechanical Engineering University of Minnesota PC Based Control System Loop { Read voltages from sensors Compute voltage to be sent to actuator Send voltage to actuator } 1 PC Based Control System Example: Automotive Cruise Control Loop { Read voltages from wheel speed sensors, determine speed of vehicle Compute difference between desired speed and actual speed } PC Based Control System Example: Automotive Cruise Control Loop { Compute whether throttle angle should be increased or decreased and by how much Compute voltage to be sent to throttle actuator Send voltage to throttle actuator } 2 DATA ACQUISITION CARD Common Tasks Read voltages a2d (analog to digital conversion) digital inputs The signal from a sensor can be analog or digital Send out voltages d2a (digital to analog conversion) digital outputs The voltage to be sent to an actuator can be analog or digital DATA ACQUISITION Weighted-resistor D2A (digital 2 analog conversion) Vref R LSB R/2 R/4 MSB R/8 + Summing Amplifier Electronic switches 3 DATA ACQUISTION Analog-to-digital conversion Analog signal Sample and hold Analog to digital conversion Digital signal DIGITIZATION Two types of digitization Digitization in time, called “sampling” Depends on speed and complexity of real-time program Depends on speed of data acquisition card Digitization in value Depends on resolution of data acquisition card (12 bit, 16 bit, etc) 4 DIGITIZATION Digitization in time (“sampling”) 1 0.8 0.6 0.4 0.2 0 -0.2 Sampling time T -0.4 -0.6 -0.8 -1 0 1 2 3 4 5 6 7 8 9 10 5 6 7 8 9 10 DIGITIZATION Digitization in value 1 Depends on resolution of data acquisition system 0.8 0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -0.8 -1 0 1 2 3 4 5 DATA ACQUISITION Successive Approximation A2D Clock Comparator Counter Analog input Gate 1 0 1 0 D2A DATA ACQUISITION Data acquisition card from Sensoray in lab Model 626 PCI Multi-function I/O board 16 differential analog inputs (16-bit) 4 analog outputs (14-bit) 48 digital I/O channels 6 24 bit up/down counters 6 SAMPLING THEOREM The sampling theorem states that for a limited bandwidth (bandlimited) signal with maximum frequency fmax, the equally spaced sampling frequency fs must be greater than twice of the maximum frequency fmax, i.e., fs > 2·fmax in order to have the signal be uniquely reconstructed without aliasing. The frequency 2·fmax is called the Nyquist sampling rate. Sampling theorem articulated by Nyquist in 1928 Mathematically proved by Shannon in 1949. Some books use the term "Nyquist Sampling Theorem", and others use "Shannon Sampling Theorem". Under Sampling When the sampling rate is lower than or equal to the Nyquist rate, a condition defined as under sampling, it is impossible to rebuild the original signal according to the sampling theorem. 7 ALIASING Suppose we are sampling a sine wave. How often do we need to sample it to figure out its frequency? ALIASING If we sample at 1 time per cycle, we can think it's a constant 8 ALIASING If we sample at 1.5 times per cycle, we can think it's a lower frequency sine wave ALIASING If we sample at twice the maximum frequency, i.e Nyquist Rate, we start to make some progress. In this case we see we get a sawtooth wave that begins to start crudely approximating a sine wave However, phase mismatches will distort the signal. 9 ALIASING Sampling at many times per cycle For loss-less digitization, the sampling rate should be at least twice the maximum frequency responses. Indeed many times more the better. ALIASING 10 ANTI-ALIAS FILTERS Therefore, an analog filter is typically applied before sampling to ensure that no components with frequencies greater than half the sample frequency remain. This is called an anti-aliasing filter. The quality of analog-to-digital-converters (A/D-Converters) depends critically upon that filter, since a poor filter causes phase distortion and other difficulties. A2D Conversion 1 0 ... 0 1 n bit binary number e.g. 1 0 2 n 1 possible combinations, other than zero 3 possible combinations - 3 non-zero numbers can be represented n bit binary number 1 0 sign bit ... 0 1 2 n1 1 positive numbers 2 n1 negative numbers can be represented 11 A2D Conversion For a 16-bit a2d, set to operate between -10 to 10 V, what voltages do 15,000 and 15,001 correspond to ? 2 n 1 1 32767 Hence numbers from -32768 to 32767 can be represented 15,000: V Vmax 15,001: V Vmax z : 15,000 15,000 V x 10 4.5778V 32,767 32,767 15,001 15,001 V x 10 4.5781V 32,767 32,767 z V x 10 V for z 0 32 ,767 V z x 10V 32 ,768 for z 0 D2A Conversion For a 14-bit d2a, set to operate between -10 to 10 V, what voltages do 4,000 and 4,001 correspond to ? 2 n 1 1 8191 Hence numbers from -8192 to 8191 can be represented 4,000: V 4,001: Vmax V Vmax z : V 4,000 4,000 V x 10 4.8834V 8,191 8,191 4,001 4,001 V x 10 4.8846V 8,191 8,191 z x 10V for z 0 8,191 V z x 10V 8,192 for z 0 12 PC Based Control System Loop { Read voltages from sensors Compute voltage to be sent to actuator Send voltage to actuator Wait until sampling time has been reached } Lab 4 Task 1 Demonstration of the A2D Converter Set the power supply to different voltages Check and see if your a2d program can read those voltages correctly Change the voltage range settings in your program and repeat 13 Lab 4 Task 2 Demonstration of the D2A Converter Send out different voltages from channel 0 by writing a program that takes a user input from the screen The user enters an integer number, e.g. 6000 Check the output voltage on a multimeter to see if your program works correctly Lab 4 Task 3 Demonstration of Aliasing with the A2D Converter Set the sampling frequency to be 1000 Hz Change input signal frequency on the function generator to vary from 50Hz to 1500 Hz according to the given table For each input frequency write down the estimated frequency of the output signal from the oscilloscope. 14 ...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online