Projetando um monitor de ECG baseado em Arduino usando um sensor de ECG AD8232

Designing an Arduino based ECG monitor using an AD8232 ECG sensor

Heart disease is a concern as people age. In fact, heart problems are quite common in men over 50, but they increasingly affect younger adults, regardless of gender. This is attributed, at least partially, to more sedentary and stressful lifestyles and unhealthy habits. But genetics can also play a role.

An electrocardiogram (ECG) is a common medical test to evaluate heart function by measuring the electrical activity of the heart, although other tests may also be performed. ECG is considered a fairly routine and sufficient indication of heart health and is performed with 3-, 5-, 12-, or 15-lead ECG/ECG machines.

Interestingly, it is also possible to design a low-cost ECG machine using Arduino and an AD8232 ECG sensor.

AD8232 is a cost-effective analog ECG sensor for measuring the electrical activity of the heart. Essentially, the AD8232 is an integrated signal conditioning block for ECG and other biopotential measurements. It is designed to extract, amplify and filter small biopotential signals in noisy conditions.

A three-electrode ECG cable can be connected to this sensor board, which easily interfaces with Arduino or Raspberry Pi to efficiently monitor ECG signals – which is what this project involves.

However, please note that the AD8232 is not an industrial-grade medical device. It should not be used to diagnose or treat any medical condition. It is simply an operational amplifier device that measures biopotential signals and can provide a very accurate ECG graph. Be sure to visit your doctor for a true medical evaluation.

When interfacing the AD8232 with Arduino, you can also monitor an ECG graph in the Arduino IDE's Serial Plotter in the Processing IDE and on a laptop or PC.

Required components

1. Arduino UNO x1
2. AD8232 ECG Module x1
3. Three-electrode ECG cable x1
4. ECG Electrode Pads x3
5. Connecting wires or jumper
6. A laptop or PC

Required software

  • Arduino IDE

Circuit Connections
The AD8232 ECG sensor has a six-pin connector for interfacing with Arduino, Raspberry Pi or another similar platform. The header exposes the terminals for 3.3V power, GND, output, LO+, LO-, and SDN. The board also offers three breakout connections for custom sensors/electrodes, including the right arm (RA), left arm (LA), and right leg (RL).

However, instead of using these breakout connections, you can use a biomedical sensor cable with a 3.5 mm connector.

This board is powered by Arduino. To do this correctly, make sure you connect:

  • AD8232 3.3V and GND pins with Arduino UNO 3V3 power supply and ground, respectively.
  • AD3282 output terminal with Arduino analog input pin. And for the output of this circuit, AD8232 is connected to the A1 pin of Arduino UNO.
  • AD3282 LO+ and LO- terminals with Arduino GPIO. Here, LO+ and LO- are connected to Arduino pins 10 and 11 respectively. (Note: A sensor cable is used to connect to the 3.5mm jack of the AD8232).

To measure someone's ECG, electrodes are connected to the sensor cable and the electrodes are placed on the subject's body.

Circuit Diagram

ECG electrode placement

To ensure an accurate ECG reading, it is important to correctly position the sensor cables. The three-lead EKG cable has three lead colors of red, green and yellow.

  • The red electrode should be placed under the subject's right collarbone, which is close to the right shoulder and inside the rib cage.
  • The yellow electrode should be placed under the subject's left collarbone, which is close to the left shoulder and inside the rib cage.
  • The green electrode should be placed on the subject's left side, below the pectoral muscles, close to the lower edge of the left rib cage.

For best results, all electrodes should be placed on the chest wall equidistant from the heart.

Alternatively, pads can be placed on the limbs – the red electrode on the right arm, the yellow electrode on the left arm and the green electrode on the right leg.

The three-electrode ECG system is illustrated here…

Arduino Sketch

empty configuration {
pinMode(10,INPUT);
pinMode(11,INPUT);

}

empty loop {
Serial.begin(9600);
if((digitalRead(10)==1) (digitalRead(11)==1)){
Serial.println(“Gagal”);
}
other{
Serial.println(analogRead(A1));
}
delay(100);
Serial.end;
delay(100);
}

How it works
ECG is the graphic recording of the heart's electrical signals. It is useful in determining a person's heart rate and rhythm. It serves as an indicator of cardiac electrical activities and can point to certain heart-related issues (again, this is not a medical-grade device, so consult a doctor about any concerns).

The ECG graph contains repeating cycles. Each cycle is divided into three parts: P, QRS, and T waves.

The AP wave provides information about the propagation time of the impulse to the two atria of the heart. This is followed by a flat trend, called the PR segment, which indicates the propagation of the electrical impulse from the atria to the ventricles.

What follows is a complex QRS wave, made up of a small Q wave, a tall R wave, and a small S wave. The QRS segment offers information about ventricular systole in relation to the propagation of the impulse from the ventricles (Q wave).

Transmission throughout the tissue is caused by R and S waves.

The ECG also provides information about cardiac fibrillation and arrhythmias, which can be useful in analyzing heart attacks. The ST interval is followed by the T wave, which indicates occurrences of ischemia. The T segment is useful in analyzing cardiac hypertrophy, heart attacks and ischemia.

The ECG signal ends with a small peak, called the U wave. Different segments of the graph are useful in evaluating different potential pathologies.

The AD8232 ECG sensor is useful for measuring heart rate and can be used as a portable heart rate monitor. It is optimized for use as a two- or three-lead ECG/EKG machine.

This device offers analog output, which is received by Arduino pin A1 in the circuit. The analog signal can be monitored on the Arduino IDE's Serial Monitor or plotted on your Serial Plotter.

If electrodes are placed correctly on a subject, the plotted graph will provide fairly accurate results (but consult your doctor for proper medical evaluation). LO+ and LO- offer lead detection.

How the code works
The AD8232 is an analog ECG sensor with a single-lead heart rate monitor. The Arduino sketch simply reads the analog signal from the sensor board and prints it to the serial port. If disconnected wires are detected, the exclamation character will be sent to the printer.

The ECG graph can be plotted on the Serial Plotter of the Arduino IDE.

Results


(tagsToTranslate)Arduino

Related Content

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.