Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

ESP32-Based Heart Rate and SpO2 Monitor with AD8232 and MAX30102

View and Edit Project In Cirkit DesignerImage of ESP32-Based Heart Rate and SpO2 Monitor with AD8232 and MAX30102

Circuit Documentation

Summary

This circuit is designed to read ECG data from an AD8232 Heart Rate Monitor and SpO2 data from a MAX30102 sensor using an ESP32 microcontroller. The ECG data is read from the VN pin of the ESP32, and the SpO2 data is read via I2C communication.

Component List

  1. ESP32 (30 pin)

    • Description: A powerful microcontroller with built-in Wi-Fi and Bluetooth capabilities.
    • Pins: EN, VP, VN, D34, D35, D32, D33, D25, D26, D27, D14, D12, D13, GND, Vin, D23, D22, TX0, RX0, D21, D19, D18, D5, TX2, RX2, D4, D2, D15, 3V3
  2. AD8232 Heart Rate Monitor

    • Description: A sensor module used to measure the electrical activity of the heart.
    • Pins: GND, 3.3v, OUTPUT, LO-, LO+, SDN, RA, LA, RL
  3. MAX30102

    • Description: A sensor module used to measure SpO2 and heart rate.
    • Pins: VIN, SDA, SCL, GND, RD, IRD, INT
  4. Resistor

    • Description: A 10k Ohm resistor used for signal conditioning.
    • Pins: pin1, pin2
    • Properties:
      • Resistance: 10k Ohms

Wiring Details

ESP32 (30 pin)

AD8232 Heart Rate Monitor

MAX30102

Resistor

Code Documentation

/*
 * This Arduino Sketch reads ECG data from the AD8232 Heart Rate Monitor and
 * SpO2 data from the MAX30102 sensor. The ECG data is read from the VN pin
 * and the SpO2 data is read via I2C communication.
 */

#include <Wire.h>
#include "MAX30105.h"

MAX30105 particleSensor;

const int ecgPin = 36; // VN pin of ESP32
const int loMinusPin = 34; // LO- pin of AD8232
const int loPlusPin = 35; // LO+ pin of AD8232

void setup() {
  Serial.begin(115200);
  pinMode(ecgPin, INPUT);
  pinMode(loMinusPin, INPUT);
  pinMode(loPlusPin, INPUT);

  // Initialize MAX30102
  Wire.begin(21, 22); // SDA, SCL
  if (!particleSensor.begin(Wire, I2C_SPEED_FAST)) {
    Serial.println("MAX30102 was not found. Please check wiring/power.");
    while (1);
  }
  particleSensor.setup(); // Configure sensor with default settings
}

void loop() {
  // Read ECG data
  int ecgValue = analogRead(ecgPin);
  Serial.print("ECG: ");
  Serial.println(ecgValue);

  // Read SpO2 data
  long irValue = particleSensor.getIR();
  long redValue = particleSensor.getRed();
  Serial.print("IR: ");
  Serial.print(irValue);
  Serial.print(" Red: ");
  Serial.println(redValue);

  delay(1000); // Delay for readability
}

This code initializes the ESP32 to read ECG data from the AD8232 Heart Rate Monitor and SpO2 data from the MAX30102 sensor. The ECG data is read from the VN pin of the ESP32, and the SpO2 data is read via I2C communication. The data is then printed to the serial monitor.