Logo

ESP32 Health Band with Pulse, Temperature, and Step Count Monitoring

Objective

The aim of this experiment is to build a compact wearable health band using ESP32 that continuously monitors pulse rate, body temperature, and step count. The data can be displayed on a serial monitor or OLED screen and optionally sent to a cloud platform for real-time health tracking.

Introduction

Health monitoring wearables have become increasingly popular for personal fitness and medical diagnostics. In this project, we will build a basic ESP32-powered health band that can measure pulse using the MAX30100 sensor, temperature using LM35 or DS18B20, and step count using an accelerometer (like MPU6050 or ADXL345). This wearable solution can help users track vital health stats in real time.

  • Connect MAX30100 to ESP32 to measure pulse and oxygen levels.
  • Connect temperature sensor (LM35 or DS18B20) for body temperature measurement.
  • Connect accelerometer (MPU6050 or ADXL345) to detect steps using motion analysis.
  • Process the data in ESP32 and calculate pulse, temperature, and step count.
  • Display the data on Serial Monitor or OLED display.
  • Optionally send data to a cloud platform via Wi-Fi (ThingSpeak, Firebase, etc.).

Formula: Step Count: Calculated by detecting acceleration peaks using MPU6050 Pulse Rate: Peaks in infrared signal from MAX30100 Temperature (LM35): Temp (°C) = (Analog reading × 3.3 × 100) / 4095

Components Required

  • ESP32 Development Board
  • MAX30100 Pulse Oximeter Sensor
  • LM35 or DS18B20 Temperature Sensor
  • MPU6050 or ADXL345 Accelerometer Module
  • OLED Display (Optional)
  • Breadboard and Jumper Wires
  • USB Cable

Circuit Diagram

  • MAX30100 SDA →: GPIO 21 (ESP32)
  • MAX30100 SCL →: GPIO 22 (ESP32)
  • LM35 OUT →: GPIO 34 (Analog Input)
  • MPU6050 SDA →: GPIO 21
  • MPU6050 SCL →: GPIO 22
  • VCC & GND →: 3.3V and GND (common)

Use only 3.3V logic-compatible sensors. Avoid powering MAX30100 from 5V as it may damage the sensor.

Connection Table

  • -> GPIO 21
  • -> GPIO 22
  • -> GPIO 34
  • -> GPIO 21
  • -> GPIO 22
  • -> 3.3V and GND

Arduino Code

1#include <Wire.h>
2#include "MAX30100_PulseOximeter.h"
3#include <Adafruit_MPU6050.h>
4#include <Adafruit_Sensor.h>
5
6#define REPORTING_PERIOD_MS 1000
7#define TEMP_PIN 34
8
9MAX30100_PulseOximeter pox;
10Adafruit_MPU6050 mpu;
11uint32_t tsLastReport = 0;
12float tempC = 0;
13int stepCount = 0;
14
15void onBeatDetected() {
16  Serial.println("Beat Detected!");
17}
18
19void setup() {
20  Serial.begin(115200);
21  pinMode(TEMP_PIN, INPUT);
22
23  if (!pox.begin()) {
24    Serial.println("MAX30100 init failed");
25    while (1);
26  }
27  pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);
28  pox.setOnBeatDetectedCallback(onBeatDetected);
29
30  if (!mpu.begin()) {
31    Serial.println("MPU6050 not found!");
32    while (1);
33  }
34  mpu.setAccelerometerRange(MPU6050_RANGE_2_G);
35}
36
37void loop() {
38  pox.update();
39  sensors_event_t a, g, temp;
40  mpu.getEvent(&a, &g, &temp);
41
42  float accMag = sqrt(a.acceleration.x * a.acceleration.x +
43                      a.acceleration.y * a.acceleration.y +
44                      a.acceleration.z * a.acceleration.z);
45
46  if (accMag > 1.3) stepCount++;
47
48  int analogTemp = analogRead(TEMP_PIN);
49  tempC = (analogTemp * 3.3 * 100.0) / 4095.0;
50
51  if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
52    tsLastReport = millis();
53    Serial.print("Pulse: "); Serial.print(pox.getHeartRate());
54    Serial.print(" BPM | Temp: "); Serial.print(tempC);
55    Serial.print(" °C | Steps: "); Serial.println(stepCount);
56  }
57
58  delay(100);
59}

Code Explanation

  • MAX30100_PulseOximeter pox;: Creates a pulse oximeter object to manage heart rate sensing.
  • mpu.getEvent(&a, &g, &temp);: Fetches acceleration and gyroscope data from MPU6050.
  • accMag > 1.3: Checks if movement is significant enough to count as a step.
  • analogRead(TEMP_PIN): Reads analog value from the LM35 temperature sensor.
  • Serial.print(pox.getHeartRate());: Prints the detected pulse rate from MAX30100.

Applications

  • Personal fitness tracking
  • Remote patient health monitoring
  • Wearable IoT healthcare systems
  • Activity and wellness analysis

Conclusion

This ESP32-based health band prototype provides basic real-time monitoring of pulse rate, body temperature, and physical activity through step count. It can serve as a foundational system for wearable health tech and can be enhanced with features like Bluetooth, Wi-Fi cloud sync, and mobile app integration for a complete health solution.