Sunday , November 24 2024

Development of an ECG Monitoring System using Arduino.

Abstract:
This paper presents the design and implementation of an Electrocardiogram (ECG) monitoring system utilizing Arduino and an OLED display. The system captures ECG signals through electrodes placed on the skin, processes the signals to filter noise, and displays the results on an OLED screen and through a serial plotter. The objective is to provide real-time monitoring of heart activity, which is crucial for early detection of cardiac conditions. The project aims to demonstrate a simple, cost-effective solution for ECG monitoring, suitable for use in various healthcare settings.


1. Introduction
Electrocardiograms (ECGs) are essential tools for assessing heart health. They provide vital information regarding the heart’s electrical activity, which can help detect arrhythmias, ischemic heart disease, and other cardiac abnormalities. Traditional ECG systems can be expensive and complicated, often requiring professional installation and maintenance. This project aims to develop a user-friendly ECG monitoring system using Arduino technology, which is both affordable and easy to use. The integration of an OLED display allows for real-time visualization of the ECG waveforms, making the data accessible for immediate analysis.


2. Methodology
The system employs an Arduino microcontroller (e.g., Arduino Uno) to read analog signals from ECG electrodes. The electrodes are placed on the skin to capture the electrical signals produced by heartbeats. The main components include:

  • AD8232 Module: A low-power, integrated signal conditioning circuit for ECG applications.
  • Electrodes: Placed on the wrist and ankle to measure the electrical activity of the heart.
  • Arduino Board: Processes the signals captured by the electrodes.
  • OLED Display: Visualizes the processed ECG waveforms in real-time.

Code :

#include <Adafruit_SSD1306.h>
#define OLED_Address 0x3C // 0x3C device address of I2C OLED. Few other OLED has 0x3D
Adafruit_SSD1306 oled(128, 64); // create our screen object setting resolution to 128x64
int a=0;
int lasta=0;
int lastb=0;
int LastTime=0;
int ThisTime;
 
void setup() {
  // initialize the serial communication:
  Serial.begin(9600);
  pinMode(10, INPUT); // Setup for leads off detection LO +
  pinMode(11, INPUT); // Setup for leads off detection LO -
  oled.begin(SSD1306_SWITCHCAPVCC, OLED_Address);
  oled.clearDisplay();
  oled.setTextSize(2);

}

void loop() {
  
  if((digitalRead(10) == 1)||(digitalRead(11) == 1)){
    Serial.println('!');
  }
  else{
    if(a>127)
{
oled.clearDisplay();
a=0;
lasta=a;
}
 
ThisTime=millis();
int value=analogRead(A0);
oled.setTextColor(WHITE);
int b=60-(value/16);
oled.writeLine(lasta,lastb,a,b,WHITE);
lastb=b;
lasta=a;
    // send the value of analog input 0:
Serial.println(analogRead(A0));
  }
  oled.display();
a++;
  //Wait for a bit to keep serial data from saturating
  delay(50);
}

The workflow involves:

  1. Signal Acquisition: The Arduino reads the analog values from the ECG electrodes using the analogRead function.
  2. Signal Processing: The captured signal is smoothed and filtered to reduce noise. A moving average filter is applied to enhance signal stability.
  3. Display: The processed signal is displayed on the OLED screen and transmitted to the Serial Plotter for further analysis.

3. Results
The system was tested under various conditions to evaluate its performance. The results showed stable ECG readings with minimal noise interference. Values fluctuated between 0 and 1023, reflecting the heart’s electrical activity. Graphical outputs demonstrated recognizable waveform patterns consistent with normal heartbeats.

  • Signal Stability: The moving average filter effectively reduced noise, resulting in clearer waveform displays.
  • Real-time Monitoring: The OLED display provided immediate feedback, making it easy to observe heart activity.

The system’s performance indicates that it can be used for basic ECG monitoring, but further optimization is needed for clinical applications.


4. Conclusion
The developed ECG monitoring system is an effective tool for real-time heart activity monitoring, demonstrating potential for integration into telemedicine applications. Future improvements may include wireless connectivity for remote monitoring, integration with mobile devices, and enhanced filtering algorithms for better signal clarity.


Share

About Jilali LAKTATI

Master en multimédia et technologie de web. Développeur informatique.