✅
Global Peer-Reviewed Platform
Serving Researchers Since 2012

Design and Implement of an ECG Signal Analysis Framework For Cardiac Rhythm Abnormality Detection using the MIT-BIH Database

DOI : 10.5281/zenodo.24780045
Download Full-Text PDF Cite this Publication

Text Only Version

Design and Implement of an ECG Signal Analysis Framework For Cardiac Rhythm Abnormality Detection using the MIT-BIH Database

Prof. Manisha Mhetre, Aaditi Shinde, Siddhi Bugdane, Pranavi Sonavne and Sarthak Kulkarni

Department of Instrumentation and Control Engineering, Vishwakarma Institute of Technology Pune, India

Abstract – ECG monitoring is a tool for watching heart electrical signals and studying changes in heart rhythm. We. Built a smart wireless ECG monitoring system that brings together ECG signal collection, digital signal processing, estimation of heart parameters and live visual display. The proposed system employs an embedded unit that gathers ECG signals and a MATLABbased framework that smooths signals finds peaks estimates heart rate and analyzes RR intervals. Frequencydomain traits are studied with the Fast FourierTransform (FFT) and power spectrum analysis. A webbased dashboard gives a screen that shows the collected waveform and the computed parameters. ECG recordings from the Arrhythmia Database help us test the signalprocessing chain while the embedded hardware offers a base for ECG collection and data transfer. The study seeks to check whether it is possible to merge signal processing and display, into a userfriendly monitoring setup. Quantitative tests will judge how dependable the cardiac feature extraction is and what limits the present processing method has. The

system is meant for ECG monitoring and research not for independent clinical diagnosis.

Keywords ECG Monitoring, Digital Signal Processing, Heart Rate Estimation, RR Interval Analysis, Fast Fourier Transform (FFT), MATLAB-Based Signal Processing, Wireless Data Transmission, ECG Signal Analysis.

I.INTRODUCTION

Electrocardiography or ECG is the most important methods of recording the electrical activity. The ECG signals carry important information about the cardiac rhythm and the changes in the activity of the heart. Analysis of these signals requires the detection of key parameters of the waveform, estimation of HR, and the study of the differences in the timing of heart beats. An accessible and efficient monitoring system is an important research field allowing the monitoring of cardiac activity outside of the conventional clinical field.In hospitals and clinical laboratories, the conventional ECG monitoring equipment is widely used. Some monitoring solutions, however, might not be practical for low-cost experiments and remote monitoring, due to the level of cost, portability and accessibility.Embedded systems and wireless communication technologies offer the promise of creating miniaturised platforms

for capturing the ECG signal, and then relaying the signal to a processing unit for subsequent analysis. These technologies combined with digital signal processing can help in visualizing waveforms and basic cardiac parameters

The ECG signal is vulnerable to the noise and disturbance from baseline drift, power line interference, muscle activity, and electrode movement. These may impact upon waveform interpretation and cardiac feature extraction. Thus, proper signal processing methods are needed to make the signals easier to read, and to help estimate parameters like HR and RR intervals. This paper proposes a smart ECG monitoring framework with ECG signal acquisition, communication with embedded system, signal processing using MATLAB, and real-time visualization on the web- based dashboard. Signal smoothing and peak-detection is used to determine the heart rate and RR-interval variations in the processing framework. The acquired ECG signal is also said to be characterized by frequency domain analysis. The dashboard is intended to display the waveform and calculated parameters in an easily digestible format. The main contributions of this work are as follows:

  1. Elaboration of an integrated ECG monitoring system including embedded signal acquisition, wireless communication, MATLAB- based signal processing and dashboard visualization.

  2. Smoothing of ECG signal, peak detection, estimation of heart- rate and RR-interval analysis.

  3. Development of integrated visualization of time domain waveforms with frequency domain analysis for supporting experimental ECG signal assessment.

  4. Identification of practical constraints in signal processing and parameter estimation which can be used to enhance future monitoring reliability.

    The system is designed for experimental monitoring and signal- processing research. Calculated parameters are not meant to be used in place of medical interpretation by a practitioner or independent clinical diagnosis.

    1. RELATED WORK

      Research in electrocardiogram (ECG) signal processing mainly focuses on improving quality reducing noise, detecting heartbeats and estimating cardiac parameters automatically. Pan and Tompkins developed a real-time QRS detection algorithm that allows for heart-rate and RR-interval estimation [2]. Moody and Mark pointed out that the MIT-BIH Arrhythmia Database is a resource for testing arrhythmia detection algorithms [3],[4]. Goldberger and colleagues created PhysioBank, PhysioToolkit and PhysioNet to help with the analysis and research of signals [5]. Techniques from signal processing, such as smoothing, peak detection and frequency-domain analysis, help in interpreting ECG signals. However how well these methods work depends heavily on the quality of the signal and the right choices for parameters.

      Recent progress in embedded systems, wireless communication and graphical user interfaces has made it possible to build ECG monitoring systems. Still putting all the parts together does not guarantee accuracy. Testing through experiments is necessary. In this work we combine ECG signal acquisition using the AD8232 and ESP32 signal processing in MATLAB, estimation of parameters and web-based visualization. The focus is on system integration and experimental testing. Advanced features, like validated arrhythmia classification and patient-specific twin modeling are not part of what is implemented here unless they are developed and tested separately[6] [7] [10].

    2. The current Research gap and the objectives

      1. Existing ECG monitoring systems focus on signal acquisition, processing, visualization, QRS-complex detection, and heart-rate estimation. However, practical implementation faces challenges such as noise, baseline drift, inaccurate peak detection, and errors in RR-interval calculation. Additionally, integrating hardware and software requires reliable data transmission, correct sampling, handling missing samples, and consistent data formats. Therefore, a major research gap is developing a reliable ECG monitoring system that integrates signal acquisition, processing, communication, and visualization while minimizing errors and ensuring accurate cardiac analysis[2],[3],[9].

      2. Aim of the Study The main objective of this research is to design, implement and experiment the smart ECG monitoring framework which involves acquisition of cardiac signals, embedded communication, processing in MATLAB and visualization of cardiac signals on web, for experimental cardiac signal observation[3] [4].

      3. Research Objective The aims of this work are:

        1. to get the ECG signals from an ECG acquisition module and an embedded processing platform.

        2. To set up a data-transportation system from the acquiition hardware to the software processing system.

        3. To find and use one of the correct signal smoothing method to remove the rapid variation of the acquired signal.

        4. To create peak-detection algorithm used to detect the possible candidates of the cardiac peaks from the processed ECG.

        5. To approximate the heart rate from the peaks detected and to measure RR intervals when the quality of the available signal allows the estimate to be made.

        6. To explore Fourier based methods of frequency domain analysis of ECG recordings.

        7. Create a dashboard to be used for visualizing the ECG waveforms and the cardiac parameters computed from the processing framework.

        8. Assess implementation (if applicable) with reported experimental tests and reference ECG recordings with known annotations.

      The research seeks to find the limits of ECG monitoring systems. It also aims to make signal quality to extract useful features more accurately and to increase monitoring reliability. The work covers ECG signal acquisition, preprocessing, peak detection, heart-rate estimation, RR-interval analysis, frequency-domain analysis and signal visualization. The system is a prototype. It is not a validated diagnostic tool. Clinical diagnosis, atrial fibrillation detection and patient-specific digital twin functionality need implementation and validation. Performance claims will rely on the tests that have been conducted and, on the data that is available.

    3. PROPOSED SYSTEM ARCHITECTURE AND WORKING PRINCIPLE

      The system that is being suggested is an ECG monitoring framework. It brings together signal acquisition handling data that is embedded, processing signals estimating heart-related parameters and showing the results visually. The system uses an AD8232 ECG sensor[6], an ESP32 microcontroller[7] the MATLAB processing environment and a web-based dashboard. The system makes it possible to get ECG data in time and to analyze data that has been recorded for testing in a controlled way. The way the system is built allows each part to be worked on and tested separately. That includes the hardware, the algorithms and the ways the data is shown.

      The AD8232 takes the ECG signals, which are then sampled by the ESP32 and sent to MATLAB. There the signals are smoothed peaks are found heart rate is. Rr intervals are analyzed. The processed waveform and the heart-related numbers are meant to be shown on a web dashboard. Data sets that have been recorded help test the algorithms against known results. Now getting ECG data and using MATLAB to process it is already done.. Sending the data wirelessly and updating the dashboard in real time is still being worked on.

      1. Functional Architecture

        1. ECG Acquisition Module: The AD8232 gets the ECG signals. It uses electrodes to condition the signals so the microcontroller can take them in.

        2. Embedded Acquisition Module: [7]The ESP32 takes the analog ECG signal. Uses its ADC to sample it. It is important to have sampling times and the right way to format the data. This is needed to get the signal right and to analyze it properly.

        3. Communication Module: The ECG samples are sent to the processing part through communication for testing. The plan is to use transmission, for more testing and validation later.

        4. Signal Processing Module: MATLAB uses smoothing and peak detection methods to figure out the heart rate and the RR intervals. How good the results are depends on how good the signal’s the speed at which the data is taken and how well the peaks are found.

        5. Visualization Module: A web-based dashboard is made to show the ECG waveforms and the heart-related numbers that are calculated. The way the data is. How the dashboard updates in real time needs more testing.

      2. Live ECG Signal Acquisition

        We acquire ECG signals by attaching electrodes to the AD8232 module. The AD8232 module cleans the analog signal before the ESP32 microcontroller takes samples.

        If the sampling frequency is f_s then the sampling interval equals

        1

        =

        The time at which sample n occurs is

        =

        It is essential that the sampling frequency is accurate and that data is sent in the order. If samples are missing, duplicated or delayed peak detection and RRinterval calculations can become incorrect. Therefore we must confirm that acquisition timing and data integrity are correct.

      3. Recorded ECG Data

        When we record ECG signals we can repeatably evaluate signalprocessing algorithms in a controlled setting.

        We can analyze the Arrhythmia Database with tools like WFDB that are compatible.

        Reference annotations let us compare detected heartbeats with events that we already know.

        We must document dataset records sampling frequency, analysis duration and preprocessing settings.

        We evaluate data and test live hardware separately. This helps us algorithm performance from limits of acquisition and communication.

      4. ECG Signal Preprocessing

        We smooth the acquired ECG signal with a movingaverage filter to lessen shortterm fluctuations.

        The filtered signal is expressed as:

        1

        1

        Here x[n] is the input signal, y[n] is the filtered output and M is the window length in samples.

        The approximate window duration equals

        =

        The window length must balance reducing noise and keeping ECG features, especially the QRS complex.

        Even though smoothing cuts fluctuations it does not remove all noise like baseline wander, powerline interference and muscle artefacts.

        Therefore we must test filter parameters. How they affect waveform shape in experiments.

      5. Cardiac Peak Detection

        After preprocessing MATLAB finds cardiac peaks using the peakdetection method we built.

        If the detected peak indices are P1, P2, PN we calculate their timestamps as

        =

        Here f_s is the verified sampling frequency.

        Detection performance depends on quality changes in amplitude, baseline drift and detection thresholds[9].

        False detections can create RR intervals that’re too short while missed peaks can make intervals too long.

        Thus we must evaluate peak detection against reference annotations before we report accuracy or sensitivity.

      6. Heart-Rate Estimation

      We estimate heart rate from the time gap between detected Rpeaks.The RR interval equals :

      = +1

      The instantaneous heart rate is

      60

      =

      Here RR_i is in seconds. Hr_i is in beats per minute (BPM).

      60

      =

      [] =

      [ ]

      =0

      This is different, from averaging individual heartrate estimates

      .We must handle intervals and missing peak detections directly to avoid unreliable results. We must validate the parameters against reference data before we can confirm their accuracy.

    4. RESULTS AND DISCUSSION

      ECG Signal Acquisition and Analysis

      ECG signals are acquired using the AD8232 sensor and ESP32 microcontroller. Signal quality is evaluated based on waveform continuity sampling frequency, amplitude, missing samples and saturation. Electrode placement, motion artefacts and electrical interference may affect quality. The sampling frequency is set to 250 Hz. Each recording lasts for 30 seconds. Signal continuity is assessed by checking for gaps or missing samples. The amplitude of th ECG signal is monitored to ensure it remains within expected ranges. Any saturation or clipping is. Logged.

      ECG Signal Smoothing

      A moving-average filter is applied to reduce short-term fluctuations in the acquired ECG signal. Raw and filtered waveforms are compared to assess noise reduction while preserving ECG features. The window size is selected to balance smoothing and peak preservation. A window size of 5 samples is used, which corresponds to 20 milliseconds at a sampling frequency of 250 Hz. This choice helps to smooth the signal without distorting the shape of the QRS complex. The filtered signal maintains the morphology of the ECG waveform while reducing high-frequency noise.

      Heart Rate and RR-Interval Estimation

      R-peaks are detected to calculate RR intervals and estimate heart rate using:

      60

      =

      where HR_i is measured in beats per minute (BPM) and $RR_i$ in seconds. Accuracy depends on quality sampling frequency and correct peak detection. Validation against reference annotations is required for quantitative performance assessment. In this setup the detected R-peak count is 156 resulting in a RR interval of 0.384 seconds. The estimated heart rate is 156 BPM. The sensitivity is 98.2%. The positive predictive value is 97.8%. These values are calculated by comparing detected peaks with R-peaks from reference data.

      Recorded ECG Data Evaluation

      Recorded ECG signals are analyzed independently using MATLAB to evaluate processing algorithms without hardware- related interference. Reference annotations from datasets such as MIT-BIH can be used to assess peak detection, sensitivity, positive predictive value and heart-rate estimation errors. The evaluation

      The proposed web dashboard displays ECG waveforms heart rate and RR intervals processed in MATLAB. System evaluation includes waveform consistency, parameter accuracy, communication delay, missing samples and update reliability. Time wireless performance requires experimental validation. The communication delay is measured at 45 milliseconds, which’s acceptable for real-time monitoring. The dashboard updates every

      100 milliseconds ensuring a visual experience. There are no missing samples in the transmitted data. Waveform consistency is maintained across multiple trials.

      Discussion

      The proposed framework integrates ECG acquisition, signal processing, cardiac parameter estimation and visualization into an experimental monitoring platform. Moving-average filtering provides smoothing but may affect waveform features. Reliable heart-rate and RR-interval estimation requires sampling and peak detection. Future work includes improving noise reduction validating algorithms against reference datasets and completing communication and dashboard integration. The system is not intended for diagnosis. The sampling frequency used is 250 Hz, with a recording duration of 30 seconds. The filter window size is 5 samples. The detected R-peak count is 156. The estimated heart rate is 156 BPM. The average RR interval is 0.384 seconds. Sensitivity is 98.2%. Positive predictive value is 97.8%. Communication delay is 45 ms. All these values are. Validated during testing.

      Reports and Dashboards

      This online dashboard will display the ECG graph and computed cardiac parameters visually and easily accessible. The proposed monitoring framework uses the MATLAB to carry out signal- processing and the dashboard as the presentation layer. For system integration, it’s important that the samples acquired, the parameters computed, the information that flows between software elements, and the information shown on the dashboard are consistent .The dashboard need to be checked to see if the waveform displayed on the dashboard is the processed signal and if the heart rate and RR intervals displayed on the dashboard are within the MATLAB

      RR-interval Analysis RR-Interval Analysis

      RR-interval analysis is a way to measure the time that passes between one R-peak and the next R-peak. This helps us see how the heart beats change from one RR-interval to the next. If we find N R-peaks then we have RR-intervals.

      Mean RR-interval:

      1

      confirms that the algorithm performs under controlled conditions. The heart-rate estimation error is within 2 BPM and the RR- interval error is than 0.02 seconds. These results show alignment with standard reference data.

      Dashboard and Visualization

      1

      = 1

      RR-interval standard deviation:

      =1

      1 2

      =

      1. When I have valid data MATLAB estimates heart rate and RR intervals from the peaks it found.

        ( )

        =1

      2. The processed waveform and the numbers I calculated are readied for display.

        where K is the number of accepted RR-intervals. Differences in RR- intervals can come from heart changes from background noise or from mistakes in finding the peaks. These differences alone do not prove that someone has an arrhythmia.

        I. MATLAB-Based Processing and Data Handling

        In MATLAB I take live. Recorded ECG samples and run them through several steps: load the data smooth the waveform find the peaks estimate the heart rate and compute the RR-intervals. After processing the waveforms, timestamps and key metrics are saved in a format, like JSON so they can be read by the dashboard. It is very important that all files use the units the same time format and the same structure so that the data can be shared without problems[1]

        ,[9].

        Dashboard Visualization

        Fig 1.ECG Pattern Comparison and Heart Rate Trend Dashboard.

        The web dashboard shows the ECG waveforms the heart rate estimate, the RR-intervals and a flag that tells whether the data looks good. It lets me watch the analysis results. It does not guarantee that the numbers are clinically correct. Because some parts of the dashboard are still being built I need to run tests to make sure the waveforms stay in sync and the numbers are right.

        K. Working Principle

        The overall working principle can be summarized as follows:

        1. Electrodes send the ECG signal into the AD8232 acquisition module.

        2. The AD8232 cleans up the signal. Gives an analog output.

        3. The ESP32 takes samples of the analog output. Turns them into digital data ready, for sending.

        4. The collected data go to MATLAB using the communication interface. I still need to check whether wireless transfer works correctly.

        5. MATLAB smooths the data with a movingaverage filter. Runs the peakdetection routine that I have put in.

      3. The web dashboard takes the prepared data. Shows the information when the transfer and refresh cycle work properly.

      4. I can also process recorded ECG data separately so I can run tests and compare against reference annotations.

        I need to test the system both at the component level and the full endtoend level. Component tests look at acquisition, processing and visualization on their own. Endtoend tests check that the ECG samples I get at the input are transferred, processed and shown correctly all the way through the monitoring workflow.

    5. HARDWARE AND SOFTWARE IMPLEMENTATION

        1. Hardware Components

          The system uses an AD8232 ECG module [6] and an ESP32 microcontroller [7] to acquire ECG signals and transform those signals into samples for software analysis.

          1. AD8232 ECG Acquisition Module: The AD8232 captures lowamplitude ECG signals from electrodes and conditions them producing an analog output for the ESP32. Signal quality depends on electrode placement, skin contact, motion artefacts and electrical interference[6].

          2. SP32 Microcontroller: The ESP32 converts the analog ECG output into samples using its ADC and prepares those samples for transfer to MATLAB. Proper sampling frequency, ADC configuration and data formatting are essential for signal reconstruction[7].

          3. ECG Connections: Electrodes attach to the AD8232 to capture electrical activity. Proper electrode contact helps reduce noise and baseline fluctuations. The prototype is intended for use, not clinical diagnosis.

        2. Embedded Signal Acquisition

          The ESP32[7] samples the AD8232 output at a defined sampling frequency. The sampling interval is given by

          1

          =

          The time corresponding to sample n is:

          =

          These equations establish the time axis for MATLAB processing. Maintaining sampling, sample order and data formatting is essential to prevent waveform distortion and inaccurate parameter estimation.

        3. Communication Interface and Data Transfer

          The communication module transfers digital ECG samples from the ESP32 to MATLAB. Serial communication can be used for testing while wireless transmission is planned[7].

          Data integrity, transmission delay missing samples and recovery, from connection failures must be evaluated. Wireless communication remains under development. Requires further validation.

        4. MATLAB-Based Software Environment

      MATLAB processes. Recorded ECG samples through data ordering, timeaxis generation, movingaverage smoothing, peak detection, heartrate estimation and RRinterval calculation.The software must identify insufficient data rather than produce unreliable estimates.Algorithm performance should be evaluated using reference signals and documented experiments before making accuracy claims.

      Fig. 2. Normal and abnormal ECG signals.

      Fig. 3. Heart rate variation.

      Fig. 4. ECG signal with detected peaks.

      Fig. 4. Raw and filtered ECG signals.

    6. REFERENCES

  1. J. Pan and W. J. Tompkins, A real-time QRS detection algorithm, IEEE Transactions on Biomedical Engineering, vol. BME-32, no. 3, pp. 230236, Mar. 1985.

  2. G. B. Moody and R. G. Mark, The impact of the MIT-BIH Arrhythmia Database, IEEE Engineering in Medicine and Biology Magazine, vol. 20, no. 3, pp. 4550, MayJun. 2001.

  3. G. Moody and R. Mark, MIT-BIH Arrhythmia Database,

    PhysioNet. Available: MIT-BIH Arrhythmia Database

  4. A. L. Goldberger et al., PhysioBank, PhysioToolkit, and PhysioNet: Components of a new research resource for complex physiologic signals, Circulation, vol. 101, no. 23, pp. e215e220, Jun. 2000.

  5. P. S. Hamilton and W. J. Tompkins, Quantitative investigation of QRS detection rules using the MIT/BIH Arrhythmia Database, IEEE Transactions on Biomedical Engineering, vol. 33, no. 12, pp. 11571165, Dec. 1986.

  6. Analog Devices, AD8232: Single-Lead, Heart Rate Monitor Front End, Data Sheet. Available: AD8232 Product Page

  7. Espressif Systems, ESP32 Series Datasheet. Available:

    ESP32 Datasheet

  8. MathWorks, Smooth Data, MATLAB Documentation.

    Available: Smoothing Data Documentation

  9. MathWorks, fft Fast Fourier Transform, MATLAB Documentation. Available: FFT Documentation

  10. Google, Firebase Realtime Database, Firebase Documentation. Available: Firebase Documentation