Signal Acquisition And Processing Overview

3y ago
49 Views
3 Downloads
712.69 KB
28 Pages
Last View : 18d ago
Last Download : 3m ago
Upload by : Bennett Almond
Transcription

BiomechatronicsSignal Processing5.5. Digital Signal Processing5.5.1. The ComparatorThe comparator can be considered to be the simplest analog to digital converter as itconverts an analog signal with an infinite number of amplitudes to a single bit digitaloutput. If the analog signal is above a given threshold, the output is high, and if it islower, the output is low as shown in Figure 5.40.Figure 5.40: Comparator circuitIn reality, the analog signal almost always includes a small amount of noise, so as itnears the threshold level, multiple triggering may occur. This can be eliminated byincluding some positive feedback from the comparator output to add hysteresis to thethreshold level. This circuit configuration is referred to as a Schmitt trigger.5.5.2. Signal Acquisition and Processing OverviewProcessing signals within a computer (digital signal processing) requires that they besampled periodically and then converted to a digital representation using an Analog toDigital Converter (ADC). The result is that a continuous signal is reduced to one thatis only defined at discrete points, as shown in Figure 5.41. The sampling theorem(also known as Shannon’s sampling theorem) states that to ensure accuraterepresentation the signal must be sampled at the Nyquist rate which is defined as atleast double the highest significant frequency component of the signal.f s d 2 f max(5.27)In addition, the number of discrete levels to which the signal is quantised must also besufficient to represent variations in the amplitude to the required accuracy. MostADCs quantise to 12 or 16 bits which represent 212 4096 or 216 65536 discretelevels respectively.Figure 5.41: Digitising a signal244This electronic file is the copywritten property of SciTech Publishing and is for review only. All rights reserved

BiomechatronicsSignal ProcessingThe signal can then be manipulated within a computer in various ways. This processoften produces intermediate results that are much larger than the input valuesrequiring that a larger word size be used if fixed point values are used or, as is morecommon, a floating point representation is used. Once the signal has been processed,the final result is often passed through a Digital to Analog Converter (DAC) toconvert it from the internal binary representation back to a voltage. It is thereforepossible to represent a complete DSP, as shown in Figure 5.42, with ADCs aprocessor and DACs.Figure 5.42: Typical Configuration for a digital signal processing application (Brooker 2008)The DAC only outputs new values at discrete times and so a continuous signal needsto be reconstructed. This generally involves holding the signal constant (zero-orderhold) during the period between samples as shown in Figure 5.43. This signal is thencleaned up by being passed through a low-pass filter to remove high frequencycomponents generated by the sampling process.Figure 5.43: Analog Reconstruction of a sampled signal using a zero order holdOther common methods of interfacing to the outside world include manipulating asingle bit or a complete digital word to drive some peripheral device like a videodisplay unit. Alternatively it is possible to output clock signal at a specific frequency,or with a particular duty cycle, to represent a number.245This electronic file is the copywritten property of SciTech Publishing and is for review only. All rights reserved

BiomechatronicsSignal Processing5.5.3. ADCs and DACsThere are many different ways of converting an analog signal to its digital equivalent.These are selected depending on the number of digital bits required and the rate ofconversion. Two of the most common, used in commercial designs, are the successiveapproximation and flash conversion, though others including single and dual slopeintegration, switched capacitor and delta-sigma conversion are implemented forspecialist applications.The successive approximation method is used in bioelectrical applications, forrelatively low conversion rates, because it is low cost. As can be seen in the blockdiagram shown in Figure 5.44, it consists of a number of modules including a digitalto analog converter (DAC) in the feedback path.The process of conversion is as follows: At the start of the conversion, the analog signal is latched (captured and held)using a sample and hold (S&H),The successive approximation register (SAR) sets its most significant bit(MSB) which causes the DAC to output an analog value voltage equal toVmax/2,The DAC value is compared to the analog input value using a comparator,If the analog signal is still larger than this value, then the output of thecomparator remains high and the bit remains set. If it is smaller, then theoutput of the comparator goes low and the bit is reset,The process is then repeated with the next most significant bit, and then theone after, until at last the least significant bit (LSB) has been output,The successive approximation register then contains a digital equivalent of theanalog input signal which is clocked into the output register and latched so thatthe whole process can be repeated.Figure 5.44: Successive approximation ADCAn n-bit ADC converter requires n'T seconds to perform one conversion, where 'Tis the cycle time for the DAC and control unit. Typical conversion times for 8-bit to12-bit successive approximation ADCs range from 1 to 100Ps (Alciatore and Histand2003).246This electronic file is the copywritten property of SciTech Publishing and is for review only. All rights reserved

BiomechatronicsSignal ProcessingThe fastest ADCs are known as flash converters. As shown in Figure 5.45, theseconsist of a bank of comparators acting in parallel to identify the signal level. Aresistive potential divider chain forms the references for each of the comparators, sothat the moment an analog input is presented, the respective comparator outputs willhave encoded for it. A priority encoder then converts the comparator output format toa binary word.Figure 5.45: Flash ADCAs the name implies, digital to analog converters (DACs) convert a digital word intoan analog output. The simplest kind use an R-2R resistor ladder network connected toan inverting summer op-amp circuit as shown in Figure 5.46.Figure 5.46: Ladder resistor DACThis configuration is convenient and accurate because it uses only two precisionresistor values, R and 2R to produce a series of reference voltages, each half the sizeof the previous one, with the MSB value being VREF, the next being VREF/2 etc, downto VREF/8 in this example.247This electronic file is the copywritten property of SciTech Publishing and is for review only. All rights reserved

BiomechatronicsSignal ProcessingThe analog output is generated by switching the 2R resistor, either to the –ve input ofthe op-amp (virtual ground) if the bit is high, or to the true ground if the bit is low.Consider the case where only the LSB is high, in which case Do switches the voltageVREF/8 to the –ve input of the op-amp through 2R and the remaining resistors aregrounded.If the gain of the op-amp is AVAV R2R 12(5.28)then the output will beVout 0VREFAV8V REF16(5.29)In a similar manner, if D3 is high, the MSB switches VREF to the –ve input and theoutput of the op-amp goes to Vout 3 VREF / 2 . If both are switched, the output will bethe sum of the two values, as discussed earlier in this chapter.In the general case for a 4 bit DAC with a binary input word b3b2b1b0Voutb3Vout 3 b2Vout 2 b1Vout1 b0Vout 0(5.30)If VREF 10V, then Vout can vary from 0V up to a maximum ofVout§1 1 1 1 · VREF 2 4 8 16 ¹15 VREF165.5.4. Signal AliasingIf the Nyquist criterion is not satisfied and the analog signal is not sampled at at leasttwice the frequency of the highest frequency component, then these high frequencysignals are folded or aliased down to a lower frequency as illustrated in the timedomain representation shown in Figure 5.47.Figure 5.47: Interpretation of aliasing effects in the time domain248This electronic file is the copywritten property of SciTech Publishing and is for review only. All rights reserved

BiomechatronicsSignal ProcessingIn the frequency domain, a generic analog signal may be represented in terms of itsamplitude and total bandwidth as shown in Figure 5.48a. A sampled version of thesame signal can be represented by a repeated sequence spaced at the sample frequency(generally denoted fs) and shown in Figure 5.48b and c. If the sample rate is notsufficiently high, then the sequences will overlap, and high frequency componentswill appear at a lower frequency (albeit with reduced amplitude).In reality, the finite roll-off of the filter response requires that a guard band bemaintained between the spectra. This is achieved by selecting an anti-aliasing filterwith a cutoff frequency that is less than 0.4 times the sample frequency. Using thisratio as a rule of thumb A typical 3rd order low-pass filter will attenuate theseunwanted signals by between 40 and 60dB (1/100 to 1/1000) in voltage.Figure 5.48: Interpretation of aliasing effects in the frequency domain (Brooker 2008)5.5.4.1.Worked Example: ElectrocardiogramConsider the filtered electrocardiogram signal shown in Figure 5.49. At a glance itwould appear to be reasonably noise free.Figure 5.49: Measured electrocardiogram249This electronic file is the copywritten property of SciTech Publishing and is for review only. All rights reserved

BiomechatronicsSignal ProcessingIf the signal is sampled at about 143 samples per second and the spectrum examined,it can be seen in Figure 5.50 that there is a significant frequency component at 50Hz.This is caused by the residual mains hum that was not removed by the CMRR of thedifferential amplifier. Because most of the signal content of the actual ECG resides atfrequencies below 30Hz, it would seem reasonable to sample this signal at 75 to85Hz.Figure 5.50: ECG spectrum for a 142.9Hz sample rateIf this same ECG signal is sampled at 83 samples per second, and the spectrum isgenerated, the 50Hz component has been aliased down to about 33Hz (83-50 Hz) asshown in Figure 5.51. In this instance, there is no way of knowing that the 33Hzartefact is not a genuine component of the ECG signal.Figure 5.51: ECG spectrum for an 83.3Hz sample rateThe only way to eliminate this aliasing is to ensure that the analog signal is filtered toless than fs/2 prior to sampling and digitisation.250This electronic file is the copywritten property of SciTech Publishing and is for review only. All rights reserved

BiomechatronicsSignal Processing5.5.5. Digital FiltersDigital filters perform the same functions as their analog counterparts; they can beconfigured as low or high-pass filters or any of the other functions discussed earlier,as well as a whole lot more. However, instead of manipulating actual voltages, digitalfilters manipulate numbers – the digital representations of the sampled analog signals.5.5.5.1.Difference Equations and Transfer FunctionsAny filter can be written in terms of a difference equation, which is the weighted sumof a sequence of input values and output values that together generate the next valueof the output sequence. This is shown in general terms (Stanley 1975)NMy ( n) b x(n k ) a y (n k )kk(5.31)k 1k 0For this equation y(n-k) represents the outputs and x(n-k) represents the inputs. Thevalue of N gives the order of the difference equation and corresponds to the depth ofthe memory required to implement it. Because this equation relies on past values ofthe output, it is recursive, and these initial values (initial conditions) must be known.It is in this form that the actual numbers are manipulated by the DSP to perform therequired function, but in general, the filters are described by their transfer functions.The z-transform is useful for the manipulation of discrete data sequences and hasacquired a new significance in the formulation and analysis of discrete-time systemssince the advent of digital computers. It is used extensively in the areas of appliedmathematics and digital signal processing amongst others. In these cases discretemodels are solved with difference equations in a manner that is analogous to solvingcontinuous models with differential equations. The role played by the z-transform inthe solution of difference equations corresponds to that played by the Laplacetransforms in the solution of differential equations.The transfer function H(z) is easily obtained from the difference equation. The firststep involves taking the Fourier Transform before using the linearity property to movethe transform to within the summation. The time shifting property of the z-transformis used to change the time shifting terms to exponentials.For ao 1, this process results in the followingMY ( z) b X ( z) zkk 0 kN ak Y ( z ) z k(5.32)k 1The transfer function H(z) is thenMH ( z)Y ( z)X ( z) bz kkk 0N1 ak z(5.33) kk 1The frequency response is then obtained by replacing every instance of z with ejZ.251This electronic file is the copywritten property of SciTech Publishing and is for review only. All rights reserved

BiomechatronicsSignal ProcessingMH (Z ) be jZk ae j Zkkk 0N(5.34)kk 0Fortunately this process of obtaining the transfer function is easily achieved inMATLAB.5.5.5.2.Example: Obtaining a Filter Transfer Function using MATLABThe difference equation for a Butterworth low-pass filter can be written in terms ofthe following difference equationy ( n)0.0029 x(n) 0.0087 x(n 1) 0.0087 x(n 2) 0.0029 x(n 3) 2.3741y (n 1) 1.9294 y (n 2) 0.5321y (n 3)@The coefficients of the difference equation can be written in as arrays, where Aincludes the coefficients of y and B includes the coefficients of xAa0 , a1 , a2 , a3Bb0 , b1 , b2 , b3Remember that a0 1, soAB1, 2.3741, 1.9294, 0.53210.0029, 0.0087, 0.0087, 0.0029The frequency response can then be obtained and plotted, as shown in Figure 5.52,using the following MATLAB code:[h,w] freqz(B,A,512);% extract the transfer function from DC to fs/2freq (0:511)/512;plot(freq,abs(h));xlabel('Normalised Frequency')ylabel(' H(w) ')Figure 5.52: Frequency response of a low-pass Butterworth filter252This electronic file is the copywritten property of SciTech Publishing and is for review only. All rights reserved

BiomechatronicsSignal Processing5.5.5.3.Synthesising Infinite Impulse Response (IIR) FiltersThere is a large body of literature that deals with the synthesis of the common and lesscommon IIR filter algorithms. However, once again MATLAB will synthesise all ofthe common filter types with a minimum of effort. For example, the filter for theprevious example was generated with a single command[B,A] butter(3,0.1)This generates the coefficients of a 3rd order Butterworth filter with a cutoff frequencyof 0.1 (normalised to fs/2).In addition to a range of Butterworth filters, MATLAB will synthesise Bessel,Chebyshev and Elliptical low-pass, high-pass and band-pass filters of whatever orderis required. However some care needs to be exercised as numerical issues tend tomake high order filters unstable.5.5.5.4.Synthesising Finite Impulse Response (FIR) FiltersIn finite impulse response filters, only the input values are used to produce an output;they are therefore not recursive.In this implementation, the shape of the filter is described roughly in terms of therequired amplitude response. So, if the frequency response of the Butterworth filterdescribed in the previous section was to be synthesised using a FIR filter, then thefollowing MATLAB code could be used to produce the frequency response shown inFigure 5.53.f [0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,1.0];a [1,0.707,0.1,0.02,0.01,0,0,0,0,0];% define the frequency response% from DC to fs/2B firls(10,f,a);% generate the coefficients for 10th order FIR filterA [1];[h,w] freqz(B,A,512);% extract the transfer function from DC to fs/2freq (0:511)/512;plot(freq,abs(h));xlabel('Normalised Frequency')ylabel(' H(w) ')Figure 5.53: Frequency response of a 10th order FIR filter253This electronic file is the copywritten property of SciTech Publishing and is for review only. All rights reserved

BiomechatronicsSignal Processing5.5.5.5.Tracking FiltersConsider a prosthetic arm in which only a noisy measurement of the angle of theelbow joint is measured, but effective control requires that the angular rate beestimated. This can be achieved in isolation by using a differentiator or using atracking filter. The latter can be used to produce an estimate of the angular rate (andhigher order derivatives) as well as a filtered estimate of the actual angle.The D-E tracker is a fixed gain formulation of the Kalman filter and is still widelyused because it is easy to implement and performs well under most circumstances(Blackman 1986). The implementation of most tracking filters follows a two stageprocess, first of smoothing and then of prediction. The equations defining these twostages are shown below for the D-E tracker implementation:SmoothingRˆ nRˆ pn D Rn Rˆ pn(5.35)VˆnEVˆpn Rn Rˆ pnTs(5.36)PredictionRˆ p ( n 1)Rˆ n Vˆn .TsVˆp ( n 1)(5.37)Vˆn(5.38)where: R̂n Smoothed estimate of positionVˆn Smoothed estimate of rateRn Measured positionRˆPredicted position after Ts seconds (one sample ahead)p ( n 1)Vˆp ( n 1)Predicted position rate after Ts seconds (one sample ahead)R̂ pn Predicted position at the measurement timeVˆpn Predicted rate at the measurement timeTs Sample timeD , E Smoothing constantsThe equations shown above are only one of the ways that the tracking filter can bedescribed. Other ways include the block diagram representation (Mahafza 2000),state-space representations or rewriting the equations as a position transfer functionfrom the difference equations.R p ( z)R( z )R ( z ) z 1 Ts R ( z ) z 1 R p ( z ) D Rm ( z ) R p ( z )(5.39)@(5.40)254This electronic file is the copywritten property of SciTech Publishing and is for review only. All rights reserved

BiomechatronicsSignal ProcessingR ( z )ER ( z ) z 1 Rm ( z ) R p ( z )Ts @(5.41)where R p (z ) is the predicted position, R(z ) is the estimated position, R (z ) is the rateestimate and Rm (z ) is the measured position.The position transfer function will therefore beH1 ( z )R( z ),Rp ( z)(5.42)and it can be obtained by manipulation of the equations (5.38) to (5.40)H1 ( z )D ( E D ) z 11 ( E D 2) z 1 (1 D ) z 2(5.43)This is a convenient form of the filter to be used in MATLAB where the filtercoefficients described earlier areB [D , ( E D )]A [1, ( E D 2), (1 D )]One possible filter optimisation (Benedict and Bordner 1962) is to minimise theoutput noise variance at steady state, and the transient response to a changing input ismodelled by a ramp function. This results in the following relationship between thetwo gain coefficientsED2.2 D(5.44)Other criteria can also be used. For example, it has been suggested that the filtershould have the fastest possible step response (critical damping), in which case thecoefficients are related asD2 E E.(5.45)The actual values of the gains depend on the sample period, the predicted dynamicsand the required loop bandwidth.Figure 5.54 shows the filter transfer function for the position estimate of the trackingfilter using various values of D and E (Benedict Bordner relationship). This isobtained using equation (5.42) and the Freqz function in MATLAB. Even though thetransfer function does not conform to the classical low-pass filter shape discussedearlier, the half power bandwidth is still measured at H(z) 0.707.% plot the alpha beta filter position transfer function% ab trans.m%% Variables255This electronic file is the copywritten property of SciTech Publishing and is for review only. All rights reserved

Biomechatronicsfs 1000;alpha 0.1beta alpha. 2/(2-alpha);Signal Processing% Sample frequency (Hz)% Position gain% Velocity gain (Benedict Bordner Relationship% Calculate the

Digital Signal Processing 5.5.1. The Comparator The comparator can be considered to be the simplest analog to digital converter as it converts an analog signal with an infinite number of amplitudes to a single bit digital output. If the analog signal is above a given threshold, the output is high, and if it is

Related Documents:

most of the digital signal processing concepts have benn well developed for a long time, digital signal processing is still a relatively new methodology. Many digital signal processing concepts were derived from the analog signal processing field, so you will find a lot o f similarities between the digital and analog signal processing.

This course introduces basic digital signal processing theory in the context of biomedical applications. Major signal processing topics covered include data acquisition, frequency domain analysis, filtering, time-dependent processing, linear prediction, random signal properties, and interaction of random signals with linear systems.

DSP systems for real time ECG signal processing. In this design, high-speed floating point digital signal processor TMS320C6711 and TLC320AD535 dualchannel voice/data codec based DSP starter kit (DSK) was employed for processing the ECG. Electrocardiogram (ECG) signal frequency range varies between 0 Hz300 Hz and most -

A DSP System A/D DSP D/A Analog signal Analog signal Sampled data signal Analog signal Cts-time dst-amp staricase signal Digital signal Digital signal DSP System Antialiasing Filter Sample and Hold Reconstruction Filter A/D: Iconverts a sampled data signal value into a digital number, in part, through quantization of the amplitude

Overview of Digital Signal Processing 3 using electrical networks containing active and passive circuit elements. This approach is known as analog signal processing (ASP)—for example, . basic MATLAB product, the Signal Processing toolbox (SP toolbox) is required for thi

Conventional signal-processing approaches [1] to signal separation originate in the discrete domain in the spirit of traditional digital signal-processing methods that use statistical properties of signals. Such signal-separation methods employ discrete signal transforms and ad hoc filter/transform function inversion.

That leaves signal 5 and DFT 8. Signal 5 can be written as a cosine times a rectangular pulse, so the DFT of signal 5 will be the convolution of a DFT of a cosine with the DFT of rectangular pulse — that is a sum of two shifted digital sinc functions. Signal DFT 1 4 2 6 3 1 4 2 5 8 6 7 7 3 8 5 18 EL 713: Digital Signal Processing .

The 1980s also saw the introduction of the first Digital Signal Processors. Introduced in 1983 by Texas Instruments, the TMS320C10 was a microprocessor specifically designed to solve digital signal processing problems. Prior to its release, signal processing was mostly the domain of analog electronics. Digital signal processing