
Electrocardiogram (ECG) Signal Processing
Arduino UNO with AD8232 ECG sensor was provided. 3 electrodes were provided to be attached to the skin. Signal Processing was done with MATLAB.
Results
Fourier Transform, filter, inverse Fourier Transform
The project was designed for us to refresh our MATLAB coding skills and apply our knowledge of MATLAB coding to reduce the noise in an ECG signal. The artefacts in the signal are removed by introducing a software low-pass filter that removes signals above 50Hz. This project in the second half o the module serves to complement the first half where we learnt about hardware filters through the use of op-amps.

Starting from the top-left graph, the unfiltered signal is captured with much noise from the Arduino sensor.
The top-right graph shows the result of a Fourier Transform on the unfiltered signal. The signal is shown in the frequency domain.
The bottom-right graph shows the result of the signal in the frequency domain after filtering. The filter is set to remove signals with frequencies above 20Hz (the project required us to take readings with filters set between 20-50Hz).
The bottom-left graph shows the result of the filtered signal having undergone an inverse Fourier transform.
MATLAB Code
Fast Fourier Transform:
N = length(secg);
for k = 1:N
fft_secg(k) = 0;
for n = 1:N
fft_secg(k) = fft_secg(k) + secg(n).*exp(-1j.*2.*pi.*(k-1).*(n-1)/N);
end
end
​
Inverse Fourier Transform:
N = length(Y);
for k = 1:N
yt(k) = 0;
for n = 1:N
yt(n) = yt(n)+(1/N)*Y(k)*exp(1i*2*pi*(k-1)*(n-1)/N);
end
end
​
Filter Code:
H = zeros(length(fsaxis),1);
N = length(fsaxis);
for k = 1:N
if abs(fsaxis(1,k)/fz) > cutoff
H(k) = 0;
else
H(k) = 1;
end
end