Lecture Notes Part 2Lecture Notes Part 2 ET 438 b Digital Control and Data Acquisition et438b-2.pptx1.

Presentation on theme: "Lecture Notes Part 2Lecture Notes Part 2 ET 438 b Digital Control and Data Acquisition et438b-2.pptx1."— Presentation transcript:

Lecture Notes Part 2Lecture Notes Part 2 ET 438 b Digital Control and Data Acquisition et438b-2.pptx1

Window ComparatorsWindow Comparators 2et438b-2.pptx V cc = 5 V V o1 V o2 V in V cc V ref1 = 1 V V ref2 = 2 V U1 U2 V cc = 5 V Circuit Logic U1 Inverting Comparator V in > V ref1 (1 V) then V o1 = 0 V V in < V ref1 (1 V) then V o1 = V cc (5 V) Circuit Logic U2 Non-Inverting Comparator V in > V ref2 (2 V) then V o2 = V cc (5 V) V in < V ref2 (2 V) then V o2 = 0 V V in V0V0 V o2 V o1 1= V ref1 2=V ref2

Window ComparatorsWindow Comparators et438b-2.pptx3 Add outputs through logic gates to get final V o Assume V cc = 5 V o2 V o1 V ref1 LTP V ref2 UTP V o1 V o2 V o 005 when LTP< V in < UTP 050 when V in > UTP 500 when V in < LTP 550 this case never happens V o1 V in VoVo VoVo Same logic as NOR gate.

Window ComparatorWindow Comparator et438b-2.pptx4 Final Circuit LTP UTP inverting comparator non-inverting comparator V0V0 NOR V o1 V o2 V in Final Input/Output V in V0V0 V ref2 UTP V ref1 LTP

Window Comparator-Alternate DesignWindow Comparator-Alternate Design et438b-2.pptx5 Add outputs using resistive voltage dividers and use OP AMP for final output. Note bipolar power supplies. Analyze this part

Window Comparator-Alternate Design Analysis et438b-2.pptx6 Circuit enclosed Must use superposition

Window Comparator-Alternate Design Analysis et438b-2.pptx7

Window Comparator-Alternate Design Analysis et438b-2.pptx8

Window Comparator-Alternate Design Analysis et438b-2.pptx9 For V LTP < V in < V UTP the following circuit applies This can be further reduced

Window Comparator-Alternate Design Analysis et438b-2.pptx10 v in

Window Comparator SimulationWindow Comparator Simulation et438b-2.pptx11 Simulation of previous circuit using piece-wise linear input and transient analysis. Uses LM 324 Quad OP AMP. (4 in 1 package) V utp =7 V V ltp =4 V

Design ExampleDesign Example et438b-2.pptx12 Design a circuit that will light one of three LEDs when the output from a pressure sensor that has a gain of.25 V/psi is connected to its input. The output should follow the specification listed below RangeLED1LED2LED3 0 - 5 psi on offoff 5 - 10 psioffonoff 10 - 15 psioffoffon Assume there is a 5Vdc power supply available and that all inputs and output are TTL compatible

Design ExampleDesign Example et438b-2.pptx13 Solution: Use window comparator with LEDs connected to the outputs of each device in the circuit. LTP UTP inverting comparator non-inverting comparator V0V0 +5V LED1 R LED2 LED3 R R When V in < LTP LED1 energized U1 U2 V o1 V o2 V in When V in > UTP LED3 Energized V in V0V0 LED2 On V ref1 LTP V ref2 UTP V in V0V0 V o2 V o1 LED1 On LED3 On V ref1 LTP V ref2 UTP

Design Example (Continued)Design Example (Continued) et438b-2.pptx14 Determine the values of UTP and LTP from the pressure sensor gain. Ranges 0 - 5 psi 5 - 10 psi 10 - 15 psi V LTP = 5∙(0.25 V/psi) = 1.25 V V UTP = 10∙(0.25 V/psi) = 2.5 V Size resistors for LED current limiting. Determine the maximum current sourcing ability of the comparators. (assume 25 mA) Forward voltage drop of LEDs V f = 1.2 V V sat of U1, U2 -0.8V cc =4 V at high output

Data Acquisition Card Sampled SignalsSampled Signals et438b-2.pptx15 Sampling Process Sensor Signal Conditioner Physical parameter Multiplexer Sample & Hold ADC Other analog Input channels To computer Data bus Amplify Filter Linearize

Sampled Signals-Representation of Signal et438b-2.pptx16 Analog Signal - defined at every point of independent variable For most physical signals independent variable is time Sampled Signal - Exists at point of measurement. Sampled at equally spaced time points, T s called sampling time. (1/T s =f s ), sampling frequency Analog Example Sampled Example n=sample number

Sampled Data ExamplesSampled Data Examples et438b-2.pptx17 Representation of analog signal Representation of sampled analog signal TsTs

Sample and Hold OperationSample and Hold Operation et438b-2.pptx18 Sample and Hold Circuit Control input operates solid –state switch at sampling rate f s Impedance Buffer Operating Modes tracking = switch closed hold= switch open Sample and Hold Parameters Acquisition Time - time from instant switch closes until V i within defined % of input. Determined by input time constant  = R in C 5  value = 99.3% of final value decay rate - rate of discharge of C when circuit is in hold mode aperture time - time it takes switch to open.

Sample and Hold SignalsSample and Hold Signals et438b-2.pptx19 Pulse generator closes switch and captures signal value Pulse generator outputAnalog and sampled signal Amplitude Modulated s(t)=p(t)∙a(t)

Sample and Hold OutputSample and Hold Output et438b-2.pptx20 Sample must be held while digital conversion takes place. Total time to digitize t c = t a + t d Where t c = total conversion time t a = total acquisition time t d = total digital conversion time Hold Time

Frequency SpectrumFrequency Spectrum et438b-2.pptx21 Sampling is modulation. Shifts all signal frequency components and generates harmonics Information Carrier f c =1000 Hzf I1 =50 Hz f I2 =25 Hz Modulation produces sums and differences of carrier and information frequencies f h1 = f c ±f I1 for the 1 st information frequency f h2 = f c ±f I1 for the 2 nd information frequency f hi = f c ±f Ii for the i-th information frequency

Frequency SpectrumFrequency Spectrum et438b-2.pptx22 f h1 = f c ±f I1 =1000 Hz ± 50 Hz = 1050 Hz and 950 Hz f h2 = f c ±f I1 =1000 Hz ± 25 Hz = 1025 Hz and 975 Hz Frequency Components Frequency Spectrum Plot 950 Hz1050 Hz 1000 Hz 1.0 0.5 1025 Hz975 Hz | v | Frequency

Frequency SpectrumFrequency Spectrum et438b-2.pptx23 Complex signals usually have a frequency spectrum that is wider. Can be visualized with continuous f plot and found with an Fast Fourier Transform (FFT) Frequency spectrum of input signals sample & hold must be known to accurately reproduce original signal from samples | v | Frequency dc f=0 highest frequency in signal

Nyquist Frequency and Minimum Sampling Rate et438b-2.pptx24 To accurately reproduce the analog input data with samples the sampling rate, f s, must be twice as high as the highest frequency expected in the input signal. (Two samples per period) This is known as the Nyquist frequency. f s(min) = 2f h Where f h = the highest discernible f component in input signal f s(min) = minimum sampling f Nyquist rate is the minimum frequency and requires an ideal pulse to reconstruct the original signal into an analog value

Sampled Signal Frequency SpectrumSampled Signal Frequency Spectrum et438b-2.pptx25 Sampling with f s >2f h Amplitude Frequency fhfh fsfs 2f s f s +f h f s -f h 2f s +f h 2f s -f h Sampling at less than 2f h causes aliasing and folding of sampled signals. Amplitude Frequency fhfh fsfs 2f s f s +f h f s -zf h 2f s +f h 2f s -f h Folded Frequencies

Nyquist Frequency and AliasingNyquist Frequency and Aliasing et438b-2.pptx26 Only signals with frequencies below Nyquist frequency will be correctly reproduced Example: Given the following signal, determine the minimum sampling rate (Nyquist frequency) Find the highest frequency component: 100 Hz, 250 Hz, 500 Hz, 400 Hz f s(min) = 2f h f s(min) = 2(500 Hz)= 1000 Hz f h = 500 Hz

Nyquist Frequency and AliasingNyquist Frequency and Aliasing et438b-2.pptx27 Example: Given the following signal, determine the minimum sampling rate (Nyquist frequency) Convert the radian frequency to frequency in Hz by dividing values by 2  Find the highest frequency component: 450 Hz f s(min) = 2f h f s(min) = 2(450 Hz)= 900Hz

Aliased FrequenciesAliased Frequencies et438b-2.pptx28 Sampling analog signal below 2f h produces false frequencies. Aliased frequencies determined by: Where: f I = sampled information signal with f I >f nyquist f s = sampling frequency (Hz) n = sampling harmonic number f alias = aliased frequency f nyquist = one-half sampling frequency

Samples/Period and AliasingSamples/Period and Aliasing et438b-2.pptx29 Correct signal representation requires at least two samples/period WhereN s = number input signal samples per period of sampling frequency f s = sampling frequency (Hz) f I = highest information signal frequency (Hz) T s = sampling period, 1/f s, (seconds) T I = period information signal’s highest frequency (1/f I )

Sampling/Aliasing ExamplesSampling/Aliasing Examples et438b-2.pptx30 Example 1: A f s =1000 Hz sampling frequency samples an information signal of f I =100 Hz. Determine samples/period, the resulting recovered signal,and aliased frequencies if present Determine the number of samples/ period Above Nyquist rate of 2 Signals below 500 Hz reproduced without aliasing View the frequency spectrum using FFT of samples

et438b-2.pptx31 Sampling/Aliasing ExamplesSampling/Aliasing Examples 500 Hz Nyquist Limit Frequency Spectrum 100 Hz Recovered

et438b-2.pptx32 Sampling/Aliasing ExamplesSampling/Aliasing Examples Example 2: A f s =60 Hz sampling frequency samples an information signal of f I =100 Hz. Determine samples/period, the resulting recovered signal,and aliased frequencies if present Determine the number of samples/ period Below Nyquist rate of 2 Signals below 30 Hz reproduced without aliasing Aliased signals will occur due to low sampling rate Now compute the aliased frequency for 1 st sampling harmonic

et438b-2.pptx33 Sampling/Aliasing ExamplesSampling/Aliasing Examples Alias frequencies for 1 st harmonic of sampling f (n=1) The f alias is outside range 0-30 Hz, (40 Hz > 30 Hz) No recovered signal Find alias frequencies of 2 nd sampling harmonic f (n=2) The f alias in range 0-30 Hz, 20 Hz recovered signal

et438b-2.pptx34 Frequency Spectrum Sampling/Aliasing ExamplesSampling/Aliasing Examples 05101520253035 0 0.5 1 1.5 2 2.5 3 Frequency Spectrum Frequency Amplitude 30 Hz Nyquist Limit 20 Hz Alias f

Sampling/Aliasing ExamplesSampling/Aliasing Examples et438b-2.pptx35 Example 3: A f s =80 Hz sampling frequency samples an information signal of f I =100 Hz. Determine samples/period, the resulting recovered signal,and aliased frequencies if present Determine the number of samples/ period Below Nyquist rate of 2 Signals below 40 Hz reproduced without aliasing Aliased signals will occur due to low sampling rate

Sampling/Aliasing ExamplesSampling/Aliasing Examples et438b-2.pptx36 Alias frequencies for 1 st harmonic of sampling f (n=1) The f alias is inside range 0-40 Hz 20 Hz recovered signal Find alias frequencies of 2 nd sampling harmonic f (n=2) The f alias outside range 0-40 Hz, No recovered signal

Sampling/Aliasing ExamplesSampling/Aliasing Examples et438b-2.pptx37 Frequency Spectrum 01020304050 0 0.5 1 1.5 2 2.5 3 Frequency Spectrum Frequency Amplitude 40 Hz Nyquist Limit 20 Hz Alias f

Sampling/Aliasing ExamplesSampling/Aliasing Examples et438b-2.pptx38 Example 4: A f s =100 Hz sampling frequency samples an information signal of f I =100 Hz. Determine samples/period, the resulting recovered signal,and aliased frequencies if present Determine the number of samples/ period Below Nyquist rate of 2 Signals below 50 Hz reproduced without aliasing Aliased signals will occur due to low sampling rate

Sampling and Aliasing ExamplesSampling and Aliasing Examples et438b-2.pptx39 Alias frequencies for 1 st harmonic of sampling f (n=1) The f alias is inside range 0-50 Hz. 0 Hz indicates that the recovered signal is a dc level View time and frequency plots of this example. 0 Hz is dc. Level depends on phase shift of information signal relative to sampling signal

et438b-2.pptx40 Sampling and Aliasing ExamplesSampling and Aliasing Examples 0102030405060 0 0.5 1 1.5 2 2.5 3 Frequency Spectrum Frequency Amplitude 50 Hz Nyquist Limit 0 Hz (dc) Alias f Time plot

Sampling and Aliasing ExamplesSampling and Aliasing Examples et438b-2.pptx41 Previous examples all demonstrate under-sampling. f s ≤f I Folding occurs when f s >f I but less that f nyquist Example 5: A f s =125 Hz sampling frequency samples an information signal of f I =100 Hz. Determine samples/period, the resulting recovered signal,and aliased frequencies if present Determine the number of samples/ period Below Nyquist rate of 2 Signals below 62.5 Hz reproduced without aliasing Aliased signals will occur due to low sampling rate

Sampling and Aliasing ExamplesSampling and Aliasing Examples et438b-2.pptx42 Alias frequencies for 1 st harmonic of sampling f (n=1) The f alias is inside range 0-62.5 Hz. A 25 Hz signal is reconstructed Find alias frequencies of 2 nd sampling harmonic f (n=2) The f alias outside range 0-62.5 Hz, No recovered signal at this frequency

et438b-2.pptx43 Sampling and Aliasing ExamplesSampling and Aliasing Examples Frequency Spectrum 62.5 Hz Nyquist Limit 25 Hz Alias f

Anti-Aliasing FiltersAnti-Aliasing Filters et438b-2.pptx44 Dealing with Aliasing in practical systems Sampling rate limited by hardware selection. Exact frequency components of a sampled signal are unknown. Can not determine if signal component is alias or real Lab DAQ cards rate is 200 kHz-250 kHz. f nyquist = 100 kHz – 125 kHz sets input frequency limits. Bandwidth limit input signals using anti-aliasing filters to eliminate frequencies above f nyquist.

et438b-2.pptx45 Anti-Aliasing FiltersAnti-Aliasing Filters Ideal low pass filter Bode plot Goal- reduce amplitude of all frequencies above f nyquist to zero level Amplitude Frequency Cut-off Frequency, f c Set f c = f nyquist for perfect signal elimination Stop band Practical (Butterworth) filters have sloping characteristics Amplitude Frequency Cut-off Frequency, f c 1 st Order: -20 dB/decade 2 nd Order: -40 dB /decade 3 rd Order: -60 db/decade Pass band

Anti-Aliasing Filters: OP AMP CircuitsAnti-Aliasing Filters: OP AMP Circuits et438b-2.pptx 46 First order Butterworth filter Design formulas Design Procedure 1.) Determine the acceptable level of signal gain, A v, at sampling frequency f s 2.) Use the formula below to determine the value of f c based of the designed signal gain 3. Select a value of C1 from standard values and compute value of R2

et438b-2.pptx47 Anti-Aliasing Filters: OP AMP CircuitsAnti-Aliasing Filters: OP AMP Circuits Design Procedure (continued) 4.) Set R1=R2 to give pass band gain of -1 (o dB). Amplify signal after filtering to reduce noise and unwanted signal components. (e.g. 60 Hz) Design Example: A data acquisition systems samples an analog signal at T s =0.0004 seconds. Design a 1 st order anti-aliasing filter that will reduce the voltage level of all signal above the Nyquist frequency to 0.4 Solution: Determine the sampling frequency from T s then find the f nyquist Find the value of f c for the given level of A v above f nyquist

et438b-2.pptx48 Design Example (continued) Select a capacitor value of 0.1  F. Use larger values for lower f’s to keep values of resistors in range of 1k to 820k Select standard value of 2700 ohms and compute value of f c 2700  0.1  F Set R1=R2 to give gain of -1 2700  Design complete. Check result with circuit simulation. @ 1.254 kHz A v =-7.4 dB dB=20Log(A v ) 10 (dB/20) =A v 10 (-7.4/20) =A v =0.43

Anti-Aliasing Filters- 2 nd Order FiltersAnti-Aliasing Filters- 2 nd Order Filters et438b-2.pptx49 Second order Butterworth filter Design formulas Unity gain is fixed by negative feedback loop in this design. Use same design procedure as 1 st order filter but use following formula to find cut-off frequency. 2 nd order filter produces -40 dB/decade rolloff in stop band

Anti-Aliasing 2 nd Order Filter DesignAnti-Aliasing 2 nd Order Filter Design et438b-2.pptx50 Design Example 2: Repeat the design of the 1 st order filter example using a 2 nd order filter T s =0.0004 seconds sampling. Design a 2 nd order anti-aliasing filter that will reduce the voltage level of all signal above the Nyquist frequency to 0.4 Same f s and f nyquist as previous case Find the value of f c for the given level of A v using 2 nd order filter formula

et438b-2.pptx51 Design Example (continued) Select value of C2 and compute C3. Let C2=0.1  F so….. C3= 2∙C2=2∙(0.1  F)= 0.2  F 0.1  F 0.2  F Use design formulas to find value of R4=R5 Solve for R4 given C2 and f c Use standard value of 1.5k. Response very sensitive to R values 1.5 k 

et438b-2.pptx52 Design Example (continued) Design complete. Check result with circuit simulation. @ 1.249 kHz A v =-9.4 dB dB=20Log(A v ) 10 (dB/20) =A v 10 (-9.4/20) =A v =0.34 Flatter response in pass band sharper roll off.

Analog Signal ConversionAnalog Signal Conversion et438b-2.pptx53 Two Problems Input Analog-to-digital conversion (ADC): continuous signals converted to discrete values after sampling Output Digital-to-analog conversion (DAC) Discrete values converted t continuous signals Number of bits in digital signal determines the resolution of the digital signals. Resolution also depends on voltage span..

Resolution and Accuracy of Digitized SignalsResolution and Accuracy of Digitized Signals et438b-2.pptx54 Resolution - smallest number that can be measured Accuracy - is the number measured correct ADC Resolution Max. digital value Infinite resolution line 0 -7 in binary 000 001 010 011 100 101 110 111 Full scale analog input V in zero error pts. The output is a discretized version of the continuous input. Error determined by the step size of the digital representation

Resolution FormulasResolution Formulas et438b-2.pptx55 Resolution, in terms of full scale voltage of ADC, is equal to value of Least Significant Bit (LSB) Where V fs = full scale voltage n = number of bits V LSB = voltage value of LSB Finite bit digital conversion introduces quantization errors that range from ± V LSB /2 Maximum quantization error is equal to: Where Q.E. = quantization error V LSB = voltage value of LSB

Digital Resolution and Error in ADCDigital Resolution and Error in ADC et438b-2.pptx56 000 001 010 011 100 101 110 111 V in 1 LSB +1/2 LSB -1/2 LSB 10 V 1.25 8.75 Full scale analog input Error in natural binary coding is ±1/2 LSB Resolution 3-bit system All voltage values between 8.75-10 V map to the 111 code Number of counts reduced by 1

Resolution FormulasResolution Formulas et438b-2.pptx57 Percent Resolution- Based on the number of transitions (2 n-1 ) Where n = number of bits in digital representation Example 1: An 8-bit digital system is used to convert an analog signal to digital signal for a data acquisition system. The voltage range for the conversion is 0-10 V. Find the resolution of the system and the value of the least significant bit n=8 so signal converted to 256 different levels. V fs =10 Vdc

et438b-2.pptx58 Example 2: The 8-bit converter of the previous example is replaced with a 12 bit system. Compute the resolution and the value of the least significant bit. Signal converted to 4096 different levels n = 12 V fs = 10 Vdcn = 12 bits Difference between analog value and digital reconstruction is quantizing error

Download ppt "Lecture Notes Part 2Lecture Notes Part 2 ET 438 b Digital Control and Data Acquisition et438b-2.pptx1."

Similar presentations