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

ESP32-Based Health Monitor with MAX30102 and OLED Display

View and Edit Project In Cirkit DesignerImage of ESP32-Based Health Monitor with MAX30102 and OLED Display

Circuit Documentation

Summary

This circuit utilizes an ESP32 microcontroller to measure heart rate and oxygen levels using the MAX30102 sensor and displays the values on a 0.96" OLED screen. The MAX30205 sensor is also connected but not used in the current sketch. Additionally, the Sim A7670c module is connected for future use.

Component List

  1. ESP32 38 PINS

    • Description: A powerful microcontroller with built-in Wi-Fi and Bluetooth capabilities.
    • Pins: GND, G23, G22, TXD, RXD, G21, G19, G18, G5, G17, G16, G4, G0, G2, G15, SDI, SD0, CLK, 3V3, EN, SP, SN, G34, G35, G32, 33, G25, G26, G27, G14, G12, G13, SD2, SD3, 5V
  2. MAX30102

    • Description: A sensor used for measuring heart rate and oxygen levels.
    • Pins: VIN, SDA, SCL, GND, RD, IRD, INT
  3. MAX30205

    • Description: A temperature sensor.
    • Pins: VCC, GND, SDA, SCL, OS, A0, A1, A2
  4. Sim A7670c

    • Description: A GSM/GPRS module for future use.
    • Pins: Vin, Gnd, Tx, Rx
  5. 0.96" OLED

    • Description: A small OLED display used to show heart rate and oxygen levels.
    • Pins: GND, VDD, SCK, SDA

Wiring Details

ESP32 38 PINS

MAX30102

MAX30205

Sim A7670c

0.96" OLED

Code Documentation

/*
 * This Arduino Sketch uses an ESP32 to measure heart rate and oxygen levels
 * using the MAX30102 sensor and displays the values on a 0.96" OLED screen.
 * The MAX30205 sensor is also connected but not used in this sketch.
 * The Sim A7670c module is connected for future use.
 */

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_MAX30105.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET    -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
Adafruit_MAX30105 max30102;

void setup() {
  Serial.begin(115200);
  if(!display.begin(SSD1306_I2C_ADDRESS, OLED_RESET)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;);
  }
  display.display();
  delay(2000);
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  if (!max30102.begin(Wire, I2C_SPEED_FAST)) {
    Serial.println(F("MAX30102 not found. Please check wiring."));
    for(;;);
  }
  max30102.setup();
  max30102.setPulseAmplitudeRed(0x0A);
  max30102.setPulseAmplitudeGreen(0);
}

void loop() {
  display.clearDisplay();
  display.setCursor(0,0);
  display.print(F("Heart Rate: "));
  display.print(max30102.getIR());
  display.print(F(" bpm"));
  display.setCursor(0,10);
  display.print(F("Oxygen: "));
  display.print(max30102.getRed());
  display.print(F(" %SpO2"));
  display.display();
  delay(1000);
}

This code initializes the OLED display and the MAX30102 sensor. It then enters a loop where it continuously reads the heart rate and oxygen levels from the MAX30102 sensor and displays these values on the OLED screen.