ECG Front-End Design is Simplified with MicroConverter® INTRODUCTION
Figure 1. Form of ECG signal. This article suggests some ideas for a low-cost implementation of an ECG monitor.1 Its configuration is envisaged for use with a personal computer (PC). Although this article is written with patient safety in mind, any ideas presented are not by themselves necessarily compatible with all system safety requirements; anyone using these ideas must ensure that, in a particular design, the design as a whole meets required safety criteria. First we provide an overview of typical analog ECG topology. Then a circuit is proposed which performs analog-to-digital conversion, digital filtering, and digital amplificationall by using a MicroConverteran integrated system on a chip that combines an A/D converter, microcontroller, and flash memory. The article goes on to discuss considerations in the choice of components and programming of the MicroConverter. Requirements for an Electrocardiograph ECG signals may be corrupted by various kinds of noise. The main sources of noise are: For meaningful and accurate detection, steps have to be taken to filter out or discard all these noise sources. Typical ECG Signal Chain
Figure 2. Typical single-channel electrocardiograph. Proposed Circuit Analog Input Processing The AD620 requires only a single external gain-setting resistor, RG. Resistors R2 and R3 change the normal gain equation to [Gain = 1 + 49.4 k/RG + (49.4 k/2)/22 k]. To avoid output saturation, the usable gain is limited by the output swing and the maximum input voltage to the IA. With a ±5-V power supply, the output swing of the AD620 is about ±3.8 V; and the maximum input is ±5 mV plus a variable normal-mode dc offset of up to ±300 mV, allowing a maximum gain of 12.45. Here, the gain is conservatively set to 8 (±1%), using RG = 8.45 kΩ. The op amp used in the right-leg common-mode feedback circuit is the OP97, a low power, high precision operational amplifier with extremely high common-mode rejection (114 dB minimum). This circuit applies an inverted version of the common-mode interference to the subjects right leg, with the aim of canceling the interference. The op amp has a voltage gain for the common-mode voltage of 91 [viz., R4/(R2 || R3) = 1 MΩ/11 kΩ], with a 1.6-Hz rolloff and a low-pass cutoff at about 160 Hz for stability [f 3 dB = 1/(2π × (10 kΩ × 0.1 µF)]. Digital Isolation It also achieves high data rates with lower power consumption than optocouplers. The ADuM1301 has three independent isolation channels, two of which are used hereone for transmitting, the other for receiving data. (A further capability of the ADuM1301not required hereis the ability to enable/disable the input/output data.) The power supply for the measurement side of the ADuM1301 is taken from the ADP3607-5 booster/regulator, which provides a fixed 5-V output. The power for the PC side is totally isolated from the circuit. It can be taken from the PC (as it is here) or from a different source. Safe Power The ADP3607 is a regulated-output switched-capacitor voltage doubler capable of providing up to 50 mA. Capable of operating from an input voltage as low as 3 V, it is offered in a version with the regulation fixed at 5 V (ADP3607-5)the one used here. (It is also available in a form adjustable over a 3-V to 9-V range via an external resistor. It can produce an even larger positive voltage with an external pump stage consisting of passive components.) The ADP3605 switched-capacitor voltage inverter, with a regulated output voltage, is capable of providing up to 120 mA. It is offered with the regulation fixed at 3 V (ADP3605-3) or adjustable via external resistors over a Both supply voltages (±5 V) are generated by capacitive charge pumps, which cannot generate unsafe voltageseven under fault conditionsbecause they do not require any inductors. These devices also feature a shutdown mode, which allows the MicroConverter to power down the devices when the system is not in use. Patient Safety Signal Processing
Figure 4. ADuC842 block diagram. The key components of the MicroConverter for this design are the ADC and the 8052 core. The ADC converts the analog output of the instrumentation amplifier to a digital signal. The software written for the 8052 core processes the digitized signal to produce the data for the ultimate ECG trace. As in many MicroConverter designs, the software includes both complex high level code written in C and time sensitive routines written in assembly code. In this case, the implementation of band-pass filters and notch filters is in C, while the ADC is controlled by assembly code. Assembly code, combined with converter speed, enables the accumulation of multiple samples, enhancing the effective resolution of the ADC well beyond its normal 12 bits. Figure 5 gives a good indication of the effectiveness of the MicroConverter. The top trace is the signal from the instrumentation amplifier applied to the ADC. The middle trace shows the initial results achieved using the C-code filtering only, while the bottom trace shows the final result after the processing of multiple conversions, using assembly code.
Figure 5. Oscilloscope traces. Filters in C Code
The transfer function can be converted into a programmable recursive algorithm:
In this equation the subindex, k, means the present value, k-1 means the value in the previous instant, and so on. We now need to turn this equation into code. C coding was the automatic choice for this arithmetic-intensive processing, as programming it in assembly would have been too time consuming. Implementing the filter equations directly would be inefficient with the ADuC842, since it is not tailored for floating-point calculations. Fortunately we can just scale the coefficients (e.g. by 4096) and implement the notch code as: iNOut = (4096L*iNIn-6627L*iNIn1+4096L*iNIn2+6211L*iNOut1-3598L*iNOut2)/4096; This implements a second-order filter. Although we can calculate higher order filters, in practice it seems workable to simply cascade second-order filters. The second filter was a Butterworth pass-band filter with a 0.05-Hz low cutoff frequency and a 100-Hz high cutoff frequency. The transfer function and recursive algorithm are:
This is implemented in C code by: iBOut = (1723L*iBIn-1723L*iBIn2+4745L*iBOut1-650L*iBOut2)/4096; Note that the outputs can be scaled simply by changing the coefficients of the inputs. Also note that, for efficiency (if the signals are all positive), the division by 4096 is accomplished at the end by shifting 12 right. The implementation shown in Figure 6 is for a cascade of five band-pass filters and two notch filters. The signal is scaled up by a factor of 4 in each of the first and second band-pass filters. The 12-bit right shift accomplishes the divide-by-4096.
Figure 6. Essential part of C code. Note the lines, if(iAdc00>24000)iDac-= 1,, and if(iAdc00<8000)iDac += 1,, which adjust the DAC output of the ADuC842 to drive the level-shifting input of the AD620 to shift the AD620 output to a comfortable value for the MicroConverters ADC input. This is desirable to reduce the effects of the variable dc offsets that result from slight differences in the way the electrodes are applied to the skin. A similar technique is used to ensure that the output voltage is centered within the output range. Processing in Assembly Code while(c2ms<2); //Used in first phase. Initially, c2ms is 0, and the C code will wait at the line while(c2ms<2);. After 1 ms, a Timer0 interrupt occurs, and c2ms is incremented to 1. After a further 1 ms, c2ms is incremented to 2. Now while(c2ms<2); is no longer satisfied, and the C code continues by resetting counter c2ms to 0 and doing the filter calculations. Thereafter, the C code shifts the results down the chain of variables representing the various delayed results ready for the next iteration of the loop. The final part of the loop is the printf(...), which sends the result to the PC for display. The processing of the data on the PC, beyond the scope of this article, can be as simple as importing it to a spreadsheet for graphical displayor as sophisticated as the designer wishes to make it. This solution produced the middle trace of Figure 5. To improve the result, the Timer0 interrupt rate was shortened to 1/32 ms, and the data was accumulated in iAdc0, to make use of multiple measurements instead of just a single measurement. At the same time, the while was changed to while(c2ms<64) so that the C code would wait for 64 measurements to be accumulated before doing each filter loop. The value in iAdc0 is saved in iAdc00 for further processing, and then iAdc0 is clearedready to accumulate the next 64 measurements. Figure 7 shows the assembly code. This improved solution produced the lower trace of Figure 5.
Figure 7. Assembly code. Gain
Figure 8. Graphs of practical measurements. CONCLUSION REFERENCES Firth J. and Errico P., Low-Power, Low-Voltage IC Choices for ECG System Requirements, Analog Dialogue, Volume 29, Number 3, 1995. AAMI, American National Standard, Safe Current Limits for Electromedical Apparatus (ANSI/AAMI ES1-1993). Association for the Advancement of Medical Instrumentation, 1993. AD620 Data Sheet revision F. Analog Devices, Inc., ©2003. 1 Standard paragraph (19) from Analog Devices Terms and Conditions: USE IN LIFE SUPPORT APPLICATIONS Copyright 1995- Analog Devices, Inc. All rights reserved. |