1 Chapter 7 Introduction to signal processing © Niwareeba Roland 2 Key Highlights Analogue and Digital Signal Processing Analogue filtering Signal Amplification Introduction to DSP Analogue-to-Digital-Converters Digital-to-Analogue Converters © Niwareeba Roland 3 Introduction Signal processing is concerned with improving the quality of the reading or signal at the output of a measurement system, and one particular aim is to attenuate any noise in the measurement signal that has not been eliminated by careful design of the measurement system Other functions are signal filtering, signal amplification, signal attenuation, signal linearization and bias removal © Niwareeba Roland Analogue and Digital Signal processing 4 In the past it was analogue using various types of electronic circuit. However, the ready availability of digital computers in recent years has meant that signal processing has increasingly been carried out digitally DSP is inherently more accurate than analogue techniques, but for measurements coming from analogue sensors and transducers, because an ADC stage is necessary before the digital processing can be applied, thereby introducing conversion errors. Also, analogue processing remains the faster. © Niwareeba Roland 5 Analogue signal filtering Signal filtering consists of processing a signal to remove a certain band of frequencies within it. The band of frequencies removed can be either at the lowfrequency end of the frequency spectrum, at the highfrequency end, at both ends, or in the middle of the spectrum. Filters to perform each of these operations are known respectively as low-pass filters, high-pass filters, band-pass filters and band-stop filters (also known as notch filters). All such filtering operations can be carried out by either analogue or digital methods. © Niwareeba Roland 6 Analogue signal filtering A filter is a circuit that passes certain frequencies and attenuates or rejects all other frequencies. The passband of a filter is the range of frequencies that are allowed to pass through the filter with minimum attenuation (usually defined as less than -3 dB of attenuation). The critical frequency, fc (also called the cutoff frequency) defines the end of the passband and is normally specified at the point where the response drops -3 dB (70.7%) from the passband response. © Niwareeba Roland 7 Analogue signal filtering Following the passband is a region called the transition region that leads into a region called the stopband. There is no precise point between the transition region and the stopband. The band of frequencies removed (stop band) can be either at the low-frequency end of the frequency spectrum, at the high-frequency end, at both ends, or in the middle of the spectrum. Filters to perform each of these operations are known respectively as lowpass filters, high-pass filters, band-pass filters and band-stop filters (also known as notch filters). © Niwareeba Roland 8 Passive Filters-Low Pass Filter Low-pass filter circuit and its frequency characteristics. © Niwareeba Roland 9 Passive Filters-Low Pass Filter The voltage gain for the network is : , the time constant. The amplitude characteristic is / And the phase characteristic is Note that at fc, the amplitude is © Niwareeba Roland 10 Passive Filters-High Pass Filter High-pass filter circuit and its frequency characteristics. © Niwareeba Roland 11 Passive Filters-High Pass Filter The voltage gain for this network is Where once again . The magnitude of the function is / And the phase is © Niwareeba Roland 12 Passive Filters-High Pass Filter The half-power frequency is and the phase at this frequency is 45°. The magnitude and phase curves for this high-pass filter are shown in figure above. At low frequencies the magnitude curve has a slope of +20 dB/decade due to the term in the numerator . Then at the break frequency the curve begins to flatten out. © Niwareeba Roland Passive Filters-Band pass and Band rejection filters Band-pass and rejection filters characteristics. 13 bandand © Niwareeba Roland Passive Filters-Band pass and Band rejection filters 14 Ideal and typical amplitude characteristics for simple band-pass and band-rejection filters are shown in Figs. a and b above, respectively. Simple networks that are capable of realizing the typical characteristics of each filter are shown in figures c and d above. ω0 is the center frequency of the pass or rejection band and the frequency at which the maximum or minimum amplitude occurs. are the lower and upper break frequencies or cutoff frequencies, where the amplitude is of the maximum value. © Niwareeba Roland Passive Filters-Band pass and Band rejection filters 15 The width of the pass or rejection band is called bandwidth, and hence Consider the band-pass filter. / And therefore the amplitude characteristic is © Niwareeba Roland Passive Filters-Band pass and Band rejection filters 16 . Therefore, the frequency characteristic for this filter is shown in figure e. The center frequency is At the lower cutoff frequency Or . Solving this equation gives © Niwareeba Roland Passive Filters-Band pass and Band rejection filters / 17 / At the upper cutoff frequency Or . solving this equation gives / / And the bandwidth of the filter is given by: © Niwareeba Roland 18 Passive Filters-Example Consider the frequency-dependent network in Fig. below. Given the following circuit parameter values: L=159 μH, C=159 μF, and R=10 Ω, let us demonstrate that this one network can be used to produce a lowpass, high-pass, or band-pass filter. © Niwareeba Roland 19 Passive Filters-Example The voltage gain is found by voltage division to be / . . . which is the transfer function for a band-pass filter. At resonance, , and hence © Niwareeba Roland 20 Passive Filters-Example Now consider the voltage gain / . . which is a second-order high-pass filter transfer function. Again, at resonance, Similarly, the voltage gain is © Niwareeba Roland 21 Passive Filters-Example . . . which is a second-order low-pass filter transfer function. At the resonant frequency Thus, one circuit produces three different filters depending on where the output is taken. This can be seen in the Bode plot for each of the three voltages in figure below, where VS is set to . KVL is satisfied. i.e. © Niwareeba Roland 22 Passive Filters-Example Bode plots for network in figure above © Niwareeba Roland 23 Passive Filters-Exercise Given the filter network shown below, sketch the magnitude characteristic of the Bode plot for © Niwareeba Roland 24 Passive Filters-Exercise A band-pass filter network is shown below. Sketch the magnitude characteristic of the Bode plot for © Niwareeba Roland 25 Active Filters Passive filters have some serious drawbacks. One obvious problem is the inability to generate a network with a gain>1 since a purely passive network cannot add energy to a signal. Another serious drawback of passive filters is the need in many topologies for inductive elements. Inductors are generally expensive and are not usually available in precise values. In addition, inductors usually come in odd shapes (toroids, bobbins, E-cores, etc.) and are not easily handled by existing automated printed circuit board assembly machines. © Niwareeba Roland 26 Active Filters By applying operational amplifiers in linear feedback circuits, one can generate all of the primary filter types using only resistors, capacitors, and the op-amp integrated circuits themselves. © Niwareeba Roland 27 Active Filters-Example 1 Let us determine the filter characteristics of the network shown in figure below. Operational amplifier filter circuit. © Niwareeba Roland 28 Active Filters-Example 1 / / Therefore, the voltage gain of the network is / Note that the transfer function is that of a low-pass filter. © Niwareeba Roland 29 Active Filters-Example 2 We will show that the amplitude characteristic for the filter network in Fig. a is as shown in Fig. b. Operational amplifier circuit and its amplitude characteristic © Niwareeba Roland 30 Active Filters-Example 2 Where and Since , the amplitude characteristic is of the form shown in Fig. b. Note that the low frequencies have a gain of 1; however, the high frequencies are amplified. The exact amount of amplification is determined through selection of the circuit parameters. © Niwareeba Roland 31 Active Filters-Exercise Given the filter network shown below, determine the transfer function sketch the magnitude and identify characteristic of the Bode plot for the filter characteristics of the network. © Niwareeba Roland 32 Second Order Filters All the circuits considered so far in this section have been first-order filters. In other words, they all had no more than one pole and/or one zero. In many applications, it is desired to generate a circuit with a frequency selectivity greater than that afforded by firstorder circuits. The next logical step is to consider the class of second-order filters. For most active filter applications, if an order greater than two is desired, one usually takes two or more active filter circuits and places them in series so that the total response is the desired higher-order response. © Niwareeba Roland 33 Second Order Filters In general, second-order filters will have a transfer function with a denominator containing quadratic poles . For high-pass and low-pass of the form circuits, and For these circuits, is the cutoff frequency, and is the damping ratio. For band-pass circuits, and and where is the center frequency and Q is the quality factor for the circuit. Notice that Q is a measure of the selectivity of these circuits. The bandwidth is as discussed previously. © Niwareeba Roland 34 Second Order Filters The transfer function of the second-order low-pass active filter can generally be written as Where is the dc gain. A circuit that exhibits this transfer function is illustrated in Fig. 6.10 and has the following transfer function: © Niwareeba Roland 35 Second Order Filters Figure; Second-order low-pass filter. Question: Determine the damping ratio, cutoff frequency and dc gain for the network in figure 6.10 if 0.1 (2000 rad/s, 1.5. -1) 5 © Niwareeba Roland 36 Differential amplification 1 If , then © Niwareeba Roland 37 Instrumentation amplifier 1 2 © Niwareeba Roland Signal attenuation 38 © Niwareeba Roland 39 Exercise Read about and make notes about 1. Signal linearization 2. Bias (zero drift) removal 3. Signal integration 4. Voltage comparator 5. Phase-sensitive detector © Niwareeba Roland 40 Introduction to DSP A review of the difference between digital and analog quantities: Digital quantities—values can take on one of two possible values. Actual values can be in a specified range, so exact value is not important. Analog quantities—values can take on an infinite number of values, and the exact value is important. © Niwareeba Roland 41 Introduction to DSP Most physical variables are analog, and can take on any value within a continuous range of values. Normally a nonelectrical quantity. • A transducer converts the physical variable to an electrical variable. – Thermistors, photo-cells, photodiodes, flow meters, pressure transducers, tachometers, etc. © Niwareeba Roland 42 Introduction to DSP The transducer’s electrical analog output is the analog input to the analog-to-digital converter. The ADC converts analog input to a digital output Output consists of a number of bits that represent the value of the analog input. The binary output from the ADC is proportional to the analog input voltage. © Niwareeba Roland 43 Introduction to DSP The digital representation of the process variable is transmitted from the ADC to the digital computer The digital value is stored & processes according to a program of instructions that it is executing. The program might perform calculations or other operations to produce output that will eventually be used to control a physical device. © Niwareeba Roland 44 Introduction to DSP Digital output from the computer is connected to a DAC Converted to a proportional analog voltage/current. • The analog signal is often connected to some device or circuit that serves as an actuator to control the physical variable. – An electrically controlled valve or thermostat, etc. © Niwareeba Roland 45 DSP Digital techniques achieve much greater levels of accuracy in signal processing than equivalent analogue methods. However, the time taken to process a signal digitally is longer than that required to carry out the same operation by analogue techniques, and the equipment required is more expensive. Therefore, some care is needed in making the correct choice between digital and analogue methods. © Niwareeba Roland 46 Signal sampling The process of AD conversion consists of sampling the analogue signal at regular intervals of time. Each sample of the analogue voltage is then converted into an equivalent digital value. This conversion takes a certain finite time, during which the analogue signal can be changing in value. The next sample of the analogue signal cannot be taken until the conversion of the last sample to digital form is completed. The representation within a digital computer of a continuous analogue signal is therefore a sequence of samples whose pattern only approximately follows the shape of the original signal. This pattern of samples taken at successive, equal intervals of time is known as a discrete signal. © Niwareeba Roland 47 Sampling …Discrete signal matches the analog signal well - - -Discrete signal does not match the analog signal © Niwareeba Roland 48 Aliasing If the rate of sampling was very much less than the frequency of the raw analogue signal, such as 1 sample per second, only the samples marked ‘X’ in the figure would be obtained. Fitting a line through these ‘X’s incorrectly estimates a signal whose frequency is approximately 0.25 cycles per second. This phenomenon, whereby the process of sampling transmutes a high-frequency signal into a lower frequency one, is known as aliasing. © Niwareeba Roland 49 Quantisation It’s a factor that affects the quality of the signal.. Quantization describes the procedure whereby the continuous analogue signal is converted into a number of discrete levels. At any particular value of the analogue signal, the digital representation is either the discrete level immediately above this value or the discrete level immediately below this value. If the difference between two successive discrete levels is represented by the parameter Q, then the maximum error in each digital sample of the raw analogue signal is ±Q/2. This is the quantisation error a to the no. of bits used to represent the samples in a digital format. © Niwareeba Roland 50 Sample and hold circuit It holds the input signal at a constant level whilst the AD conversion process is taking place reducing the conversion errors that would occur if the input was changing. © Niwareeba Roland 51 Sample and hold circuit The operational amplifier circuit shown in Figure above provides this sample and hold function. The input signal is applied to the circuit for a very short time duration with switch S1 closed and S2 open, after which S1 is opened and the signal level is then held until, when the next sample is required, the circuit is reset by closing S2. © Niwareeba Roland Analogue-to-digital converters 52 Important factors in the design of an analogue-to- digital converter are the speed of conversion and the number of digital bits used to represent the analogue signal level. The minimum number of bits =8. (resolution of 1 part in 256) Several types of analogue-to-digital converter exist. These differ in the technique used to effect signal conversion, in operational speed, and in cost. © Niwareeba Roland 53 The counter ADC © Niwareeba Roland 54 The counter ADC Following reset of the counter at the start of the conversion cycle, clock pulses are applied continuously to the counter through the AND gate, and the analogue signal at the output of the digital-to-analogue converter gradually increases in magnitude. At some point in time, this analogue signal becomes equal in magnitude to the unknown signal at the input to the comparator. The output of the comparator changes state in consequence, closing the AND gate and stopping further increments of the counter. At this point, the value held in the counter is a digital representation of the level of the unknown analogue signal. © Niwareeba Roland 55 The flash ADC +VREF Op-amp comparators R Input from sampleand-hold The flash ADC uses a series high-speed comparators that compare the input with reference voltages. Flash ADCs are fast but require 2n – 1 comparators to convert an analog input to an n-bit binary number. + – R + – R + – R R R 7 6 5 + – 4 + 1 0 – R Priority encoder 1 2 3 2 4 D0 Parallel D1 binary output D2 EN + – + – Enable pulses R © Niwareeba Roland 56 The flash ADC The flash method utilises comparators that compare reference voltages with the analogue input voltage. When the input voltage exceeds the reference voltage for a given comparator, a HIGH is generated. Figure above shows a 3-bit converter that uses seven comparator circuits; a comparator is not needed for the all-0s condition. The reference voltage for each comparator is set by the resistive voltage-divider circuit. The output of each comparator is connected to an an input of the priority encoder. The encoder is enabled by apulse on the EN input, and a 3-bit code representing the value of the input appears on the encoder’s outputs. The binary code is determined by the highest-order input having a HIGH level. © Niwareeba Roland 57 The dual-slope ADC Vin + I – CLK C SW – R ≈0 V + A1 – C A2 + R –VREF Counter n Control logic Latches EN D7 D6 D5 D4 D3 D2 D1 D0 1. The dual-slope ADC integrates the input voltage for a fixed time while the counter counts to n. 2. Control logic switches to the VREF input. 3. A fixed-slope ramp starts from –V as the counter counts. When it reaches 0 V, the counter output is latched. © Niwareeba Roland 58 Digital to Analog Conversion Many A/D conversion methods utilize the D/A conversion process. Converting a value represented in digital code to a voltage or current proportional to the digital value. DAC output is technically not an analog quantity because it can take on only specific values. © Niwareeba Roland Digital to Analog Conversion 59 For each input number, the D/A converter output voltage is a unique value—in general: …where K is the proportionality factor and is a constant value for a given DAC connected to a fixed reference voltage. • The quantity of possible output values can be increased, and the difference between successive values decreased—by increasing the input bits. Allowing output more & more like an analog quantity that varies continuously over a range of values. A “pseudo-analog” quantity, which approximates pure analog, referred to as analog for convenience. © Niwareeba Roland Digital to Analog Conversion 60 Each digital input contributes a different amount to the analog output—weighted according to their position in the binary number. Weights are successively doubled for each bit, beginning with the LSB. VOUT can be considered to be the weighted sum of the digital inputs. © Niwareeba Roland Digital to Analog Conversion 61 The Resolution of a D/A converter is defined as the smallest change that can occur in analog output as a result of a change in digital input. Always equal to the weight of the LSB, called the step size, it is the amount VOUT will change as digital input value changes from one step to the next. © Niwareeba Roland 62 Digital to Analog Conversion Resolution (step size) is the same as the DAC input/output proportionality factor: …where K is the proportionality factor and is a constant value for a given DAC connected to a fixed reference voltage. is the analogue full-scale output © Niwareeba Roland 63 Digital to Analog Conversion Percentage Resolution Although resolution can be expressed as the amount of voltage or current per step, it is also useful to express it as a percentage of the full-scale output. To illustrate, the DAC of Figure 6.19 has a maximum fullscale output of 15 V (when the digital input is 1111). The step size is 1 V, which gives a percentage resolution of © Niwareeba Roland 64 Digital to Analog Conversion Example A 10-bit DAC has a step size of 10 mV. Determine the full-scale output voltage and the percentage resolution Solution With 10 bits, there will be = 1023 steps of 10 mV each. The full-scale output will therefore be 10 mV X 1023 = 10.23 V, and . © Niwareeba Roland Binary Weighted Resistors DAC 65 Simple DAC using an op-amp summing amplifier with binary1 1 1 weighted resistors. 2 4 8 Input resistor values are binarily weighted. Starting with MSB, resistor values increase by a factor of 2, producing desired weighting in the voltage output. © Niwareeba Roland 66 R/2R Ladder 2 © Niwareeba Roland 67 R/2R Ladder The R-2R ladder requires only two values of resistors. By calculating a Thevenin equivalent circuit for each input, you can show that the output is proportional to the binary weight of inputs that are HIGH. Each input that is HIGH contributes to the output: . where VS = input HIGH level voltage n = number of bits i = bit number For accuracy, the resistors must be precise ratios, which is easily done in integrated circuits. © Niwareeba Roland 68 R/2R Ladder An R-2R ladder has a binary input of 1011. If a HIGH = +5.0 V and a LOW = 0 V, what is Vout? Solution Apply . to all inputs that are HIGH, then sum the results. © Niwareeba Roland