jiristepanovsky.cz

Return to Index


ECG monitor - 2020

A DIY device that is based on an AD620 instrumentation amplifier and designed to record ECG signals and send them through USB to a host computer.

ECG monitor plot

The circuit consists of AD620, LM324, and Attiny85. First, the signal from the input electrodes is amplified by AD620 (the input diodes protect the circuit from ESD). The signal is then filtered by various high-pass and low-pass filters (removing mains noise and DC offset), giving the best frequency response somewhere in the range of 4 to 10 Hz. The total amplification is set by a trimmer in the range of 60 to 2000 times. Filtered data are sampled by an ADC in Attiny85 with a resolution of about 2.4uV per LSB (at the highest amplification). Samples from ADC are finally sent through USB to a host computer with a sampling rate of 1000 samples per second.

ECG monitor

Instead of using a negative voltage to power the operational amplifiers, I chose to use a virtual ground. It doesn't introduce any additional noise from a negative voltage converter, but it reduces the voltage swing of OPs to only about +-1.5V. Because the electrode-skin contacts have a DC offset of 300mV maximum, which after amplification by AD620 (gain 3.2) is about +-1V, the reduced voltage swing is not a concern in this setup. However, in a different situation (different electrodes or higher gain), the OP's output could exceed the voltage range resulting in a signal loss. That's why you see a lot of circuits powered from 9V batteries - they can afford a higher input DC offset or higher gain. Another problem is filtering... Because my filters were tuned based on "what worked" and "what parts I've had" instead of proper calculations, the data suffer from significant phase shift, non-uniform gain, and overall signal distortion. Since I am not a medic, the results are good enough for me, although you could spend months improving them.

ECG monitor

The quality of ECG signals is largely based on the quality of electrodes. My best working (cheap) solution was the use of 3 old Pentium M processors. Their pins are gold plated (non-corrosive) and make good contact with skin, even if no conductive gel is used (... and I don't own a conductive gel).

ECG monitor

The application visualizing the ECG does not process the received data. It just plots the signal on the screen and shows its Fourier transform. Filtering is done only in hardware.

ECG monitor

The best results are achieved by placing the electrodes directly on the chest. The QRS complex is clearly visible, and the noise is negligible. (plot below)

ECG monitor

Recording from the left and right arm (farther from the heart) is far noisier. But it could also be just an artifact since I've held my arms in the air during the measurement, and the frequency matches the high frequencies of muscle artifacts. (plot below)

ECG monitor

If one of the electrodes makes poor contact with the body, increasing the impedance, inevitably, the mains frequency is coupled onto the signal. (plot below)

ECG monitor

Overall, the circuit is highly capable of recording clean ECG. In theory, it could also pick up the ~10uV EEG signals, but that is not tested. The electrodes are not galvanically isolated from the USB, so if safety is a concern, the host computer should be battery powered and isolated from mains.

ECG monitor

The source code and circuitry can be downloaded here.