How to improve quality of ECG signal?

I would like to connect an AD8232-EVALZ (datasheet) to an Arduino. The Arduino part is very simple: just AnalogRead the correct pin.

This is what I understood from the data sheet:


So I set the 3 switches as indicated, the input bias selection is set to P3. The 3.3 V supply and ground are connected. The electrodes are connected to the arms and right leg and the output is connected to the correct pin.

The resulting signal is the blue line:

Is there something I missed? On page 4 of the datasheet it explains that OUTF and OUTFF are each after 1 and 2 filters.

Thank you.

"Is there something I missed? "

Nice explanation, but where is the Arduino problem? The blue and red traces obviously did not come from your Arduino.

Paul

Paul_KD7HB:
"Is there something I missed? "

Nice explanation, but where is the Arduino problem? The blue and red traces obviously did not come from your Arduino.

Paul

The Arduino code is from the Amped pulse sensor (code).

The graph is made with the serial plotter. The red line is the IBI value. Normally it should be around 800 ms. I don't expect the heartbeat detection algorithm to work with a different sensor but output signal of should still be correct. I used the sketch because it implements a hardware timer.

Looks like you might benefit from more low pass filtering - the datasheet mentioned this, there
are some unpopulated RC filter stages on the board apparently.

You could digitally filter the signal (a low pass FIR filter is probably the wise choice here as you
don't want phase-distortion on this kind of signal). What is your sampling rate?

MarkT:
What is your sampling rate?

200 Hz

MarkT:
Looks like you might benefit from more low pass filtering - the datasheet mentioned this, there
are some unpopulated RC filter stages on the board apparently.

The capacitors are already there and are 1 uF.

fc= 1/ (2piRC).

Would 5 Hz be a good cutoff frequency (4 Hz is 240 BPM) ? Would that require a 32 KOhm resistor?

Are the resistors there? If not populate for your desired bandwidth - although an RC filter isn't
constant-phase so you might get nicer waveform from digitally filtering what you have with a FIR
filter.

MarkT:
Are the resistors there? If not populate for your desired bandwidth...

The resistors are not there, only the capacitors. Should the band be under 5 Hz? Do I not need to worry about sampling frequency because it is continuous time? (Nyquist rate wikipedia page, Nyquist frequency wikipedia page).

MarkT:
[...]although an RC filter isn't constant-phase so you might get nicer waveform from digitally filtering what you have with a FIR
filter.

How could I implement it. There is a good video about processing an ECG signal with a FIR filter but does not explain how to implement it (link)

Try 100K for R18 and R19, which gives two 1st order filters in series (with seperate outputs) and rolloffs of 10 Hz.

There are various digital filter design websites, I found: https://www-users.cs.york.ac.uk/~fisher/mkfilter/racos.html http://t-filter.engineerjs.com/

Hello dear MarkT, Remington, Ray and Paul

i just have stumbled over a intersting approach - real time ECG Signal Transmission for Remote Monitoring

Abstract - Our main objective is to implement a monitoring system which monitors the heart pulse of a patient. This work presents a novel easy-to-use system intended for the fast and non invasive monitoring of the Lead I electrocardiogram (ECG) signal by using a wireless steering wheel. The steering wheel used here is a prototype model. A novel heart rate detection algorithm based on the continuous wavelet transform has been implemented, which is specially designed to be robust against the most common sources of noise and interference present when acquiring the ECG in the hands. Skin Electrodes were used to record the nerve voltages for monitoring the heart pulse. The voltages recorded will be sent to an instrumentation amplifier which amplifies the signal, and then to a filter which filters the noise. Thus, analog signal is given to Analog-to-Digital Convertor (ADC) of Arduino. There, analog voltages are been converted to digital and that digital values will be stored in the EEPROM of Arduino. The values stored in EEPROM will be sent to PC via XBEE (IEEE 802.15.4) wirelessly and a serial port will be opened in the MATLAB by using a serial object. GUI is programmed to make the user interface interactive and simple. Using the real time plot, I’ve plotted the values received by XBEE module and making a running waveform which displays when the MATLAB sent a query to Arduino.

see more: https://www.ijedr.org/papers/IJEDR1303068.pdf

the most intersting parts of this

Internal circuit of INA126U
Instrumentation Amplifier The signal acquisition is the first consideration when an HRM is implemented. But the signal is too small and contains a lot of added noise. As we said above the signal extracted from the heart has amplitude of approximately 0.5mV. Since, it is necessary to amplify the signal and filter the noise, and then extract the QRS complex. An instrumentation amplifier is usually the very first stage in an instrumentation system. This is because of the very small voltages usually received from the probes need to be amplified significantly to be proceeding stages. We can summarize the reasons to use

instrumentation amplifier

  1. Get differential signal
  2. High input impedance
  3. High CMRR

Output Stage AmplifierThe LMC6084 is a precision quad low offset voltage operational amplifier, capable of single supply operation. Performance characteristics include ultra low input bias current, high voltage gain, rail to rail output swing, and an input common mode voltage range that includes ground. These features, plus its low offset voltage, make the LMC6084 ideally suited for precision circuit applications.

Filter
A further stage in this is to use band pass filter. The reason for using band pass filter is to avoid the DC voltages created by the muscles and to avoid the high frequency component which is not of any use to us. The high pass filter section has a cut off of 0.5Hz and the low pass filter has cut off of 35Hz approximately. Since the low pass cut off is must lower than 50Hz, it helps in suppressing some of the 50Hz noise as well, which is a good thing. We preferred passive filter topology i.e. using only capacitor and resistors to filter out the signal. Passive filters of 2nd order are implemented and they require around 10 seconds of settling time. That means you need 10 seconds for the circuit to settle down and start showing you correct signal. Active filters if at all used would yield better result and the settling time for them is less than a second

The above figure shows the filter schematic with values calculated using the equation: F = 1 / (2piRC)

This stage receives the signal from the first stage i.e. INA126. After the filter stage comes the final amplification stage in which the filtered ECG signal is amplified using non inverting operational amplifier with a gain of 100 to 220. This stage is necessary to bring the ECG signal’s peak to peak amplitude to around 2V approximately. Bringing the voltage level to 12V will yield a better resolution when given to the ADC of the microcontroller in later stage. A low amplitude signal given to ADC would require high resolution (>12bits) to be recognizable which would increase the cost and components. To avoid adding another ADC IC, we preferred to amplify the voltage level of the signal. The stage successive to this is where we will give the final ECG signal from the circuit to the analog digital converter of the microcontroller. We will discuss about the microcontroller later in this book. Once the data is digitized, we can transmit this information to the computer where we can digitally filter the signal and plot it in real time, or do whatever we want with.

well this approach can be very very interesting - i think that i personally will follow these steps

well i hope this helps you a bit - perhaps you can get some ideas and thoughts