In this project, we’ll be using the AD8232 chip for ECG Monitoring with AD8232 & Arduino for real-time ECG monitoring, this will be done by placing two leads on the chest, which will then be used to measure the voltage difference between them.
The AD8232 module is a low-cost, single-lead heart rate monitor front-end integrated circuit. developed to measure electrocardiogram (ECG or EKG)) signals from the human body. AD8232 sensor is generally used in biomedical applications, including ECG monitoring systems.
By interfacing the AD8232 with Arduino, we can easily plot the ECG signal on a serial plotter or Processing IDE.
Note – That’s an important note to keep in mind. AD8232 ECG module Sensor is not a medical device. It is designed for educational and research purposes only, and should not be used to diagnose or treat any medical conditions.
Importance of real-time ECG monitoring
Real-time ECG monitoring is important because it allows healthcare specialists to continuously monitor a person’s heart rate in real-time. This allows them to early detect and promptly treat patients’ conditions, especially in the critical care ward. Real-time ECG monitoring can also be used for remote monitoring of patients.
Generally, real-time ECG monitoring plays a crucial role in the detection, diagnosis, and treatment of cardiac conditions, improving patient results and saving lives.
Required material
- AD8232 ECG module
- Electrodes
- Arduino UNO
- Breadboard
What is ECG?
ECG stands for electrocardiogram, which measures the electrical activity of the heart. This is typically generated by placing electrodes on the skin of the chest, arms, and legs, which monitor the electrical signals generated by the heartbeats.
During an ECG, little electrodes are put on the skin of the chest, arms, and legs, which detect and record the electrical signals generated by heartbeats.
ECG provides a lot of information about the rhythm and electrical activity of the heart, which can help analyze different heart conditions, including arrhythmias (irregular heartbeats), heart attacks, etc.
ECG (electrocardiogram) machine records the electrical activity of the heart as it beats, and produces a strip chart or waveform that shows the electrical impulses of multiple heartbeats.
There are many kinds of arrhythmias that can be identified by analyzing the different components of the ECG waveform. Analyzing the different components of the ECG, such as the P wave, QRS complex, and T wave.
- Wave = Upwards or downward deflection
- Segment = Flat portion between waves
- Interval = Often a wave plus a segment
The different components of the ECG waveform are as follows:
- P wave – Atrial depolarization
- QRS complex – Ventricular depolarization
- T wave – Ventricular repolarization
- PR interval – conduction time from the end of atrial depolarization to the onset of ventricular depolarization
- ST interval – Time when ventricular fibers are fully depolarized.
- TP interval – when the heart muscle is completely at rest and ventricular filling is taking place
Use of ECG
- Diagnosing arrhythmias
- Detecting signs of a heart attack
- Assessing heart function
- Monitoring heart rate and rhythm
- Diagnosing congenital heart defects
- Screening for heart disease
A new-generation smartwatch normally uses a built-in heart rate sensor to measure the electrical signals generated by heartbeats. These sensors are converted into a digital signal that is processed by the watch’s software.
Overview of AD8232 ECG module
The AD8232 ECG module is a compact and reliable module designed to measure Electrocardiogram (ECG) signals. the module is based on the AD8232 Chip, which is a low-noise, single-lead heart rate monitor. It is used in biomedical applications, including ECG monitoring systems & wearable health devices.
The AD8232 ECG module is developed to be easy to use and can be connected to a microcontroller, such as an Arduino or Raspberry Pi using just four pins. The Sensor provides three input pins which are used as electrodes, to the module, and the fourth pin is used to output the amplified and filtered ECG signal.
Pinout of AD8232 ECG module
Here is the pinout for the AD8232 ECG module:
- GND (ground)
- 3.3V (power supply)
- OUTPUT (output signal of the ECG signal)
- LO- (Lead-Off Detection Negative) negative input for the right leg drive
- LO+ (Lead-Off Detection Positive) Positive input for the right leg drive
- SDN (shutdown)
Features of AD8232 ECG module
- Power supply: 3.3V
- Input voltage range: ±300 mV (maximum)
- Common-mode rejection ratio (CMRR): >80 dB (typical)
- Input impedance: >2 GΩ
- Bandwidth: 0.5 Hz to 40 Hz
- Lead-off detection threshold: 500 kΩ (typical)
- Operating temperature range: -40°C to +85°
- Input voltage range: ±300 mV
Note – Always refer to the sensor’s datasheet for the specific specifications and recommended operating conditions.
Applications of AD8232 ECG module
- Fitness and Exercise
- Heart Rate Monitoring
- Portable ECG
- Remote Health Care
- Gaming Peripherals
- Biological signal
ECG Electrodes
ECG electrodes are small conductive pads or sensors that are used to measure the electrical activity of the heart in ECG monitoring systems.
They are commonly small metal plates or disks that are attached to the skin. ECG electrodes normally use a conductive gel to improve electrical contact between the skin and the electrode.
This gel helps to reduce noise and interference in the ECG signal, then the result is a more accurate measurement of the heart’s electrical activity.
Electrode placement on the body
The placement of an electrode on the body is important for accurate ECG measurements.
Three electrodes are placed on the arms and legs as follows:
- Right arm (RA): On the inside of the right wrist
- The left arm (LA): On the inside of the left wrist
- Right leg (RL): On the lower right side of the abdomen, just above the hip bone
Wiring AD8232 ECG Sensor With Arduino
Here is the wiring diagram/connection between Arduino and ECG Sensor AD8232: We’ll connect five of the nine pins on the AD8232 to the Arduino board. The five pins you need are labeled GND, 3.3v, OUTPUT, A0-, and A0+.
AD8232 Pin | Arduino Pin |
---|---|
3.3V | 3.3V |
GND | GND |
OUTPUT | A0 |
LO- | D11 |
LO+ | D11 |
SDN | Not connected |
The output pin of the AD8232 sensor is connected to the analog input pin A0 of the Arduino.
Programming
Source Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
void setup() { pinMode(10,INPUT); pinMode(11,INPUT); } void loop() { Serial.begin(115200); if((digitalRead(10)==1)||(digitalRead(11)==1)){ Serial.println("Gagal"); } else{ Serial.println(analogRead(A1)); } delay(5); Serial.end(); delay(5); } |
Sampling ECG data
Code for Processing and filtering ECG signal
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
import processing.serial.*; Serial myPort; // The serial port int xPos = 1; // horizontal position of the graph float height_old = 0; float height_new = 0; float inByte = 0; void setup () { size(1000, 400); // set the window size: // List all the available serial ports println(Serial.list()); myPort = new Serial(this, Serial.list()[2], 115200);// Open whatever port is the one you're using. myPort.bufferUntil('\n'); // don't generate a serialEvent() unless you get a newline character: // set inital background: background(0xff); } void draw () { // everything happens in the serialEvent() } void serialEvent (Serial myPort) { String inString = myPort.readStringUntil('\n');// get the ASCII string: if (inString != null) { inString = trim(inString);// trim off any whitespace: // If leads off detection is true notify with blue line if (inString.equals("!")) { stroke(0, 0, 0xff); //Set stroke to blue ( R, G, B) inByte = 512; // middle of the ADC range (Flat Line) } // If the data is good let it through else { stroke(0xff, 0, 0); //Set stroke to red ( R, G, B) inByte = float(inString); } //Map and draw the line for new data point inByte = map(inByte, 0, 1023, 0, height); height_new = height - inByte; line(xPos - 1, height_old, xPos, height_new); height_old = height_new; // at the edge of the screen, go back to the beginning: if (xPos >= width) { xPos = 0; background(0xff); } else { // increment the horizontal position: xPos++; } } } |
You need to change the following line:
1 |
myPort = new Serial(this, Serial.list()[2], 115200);// Open whatever port is the one you're using. |
Displaying real-time ECG waveform
🚀For more Arduino projects, you can visit our Arduino Projects category.
Nice one