Tracks temperature, heart rate and SpO₂, plots them live and alerts on abnormal values.
Built and tested by Shahan Fathima K · Industrial Robotics Institute
Arduino IDE, Python 3, DHT sensor library, SparkFun MAX3010x library, PySerial, Matplotlib
A health monitor that combines an ESP32 with sensors and a Python dashboard. A DHT11 measures temperature and a MAX30102 is connected for heart rate and oxygen level. The ESP32 sends the readings to the computer, which plots them live; if temperature goes above 38 °C, heart rate above 100 or SpO₂ below 92%, the buzzer sounds and an alert is printed.
| Component | Qty |
|---|---|
| ESP32 Dev Board | 1 |
| MAX30102 Heart Rate & SpO₂ Sensor | 1 |
| DHT11 Temperature Sensor | 1 |
| Buzzer | 1 |
| OLED / LCD Display (optional) | 1 |
| Breadboard | 1 |
| Jumper Wires | As needed |
| From | Connect to |
|---|---|
| DHT11 VCC | 3.3V |
| DHT11 GND | GND |
| DHT11 DATA | GPIO 4 |
| MAX30102 VIN | 3.3V |
| MAX30102 GND | GND |
| MAX30102 SDA | GPIO 21 |
| MAX30102 SCL | GPIO 22 |
| Buzzer + | GPIO 15 |
| Buzzer − | GND |
Complete, tested Arduino C++ code for this project. Copy it into Arduino IDE and upload it and run it.
// ===================== ESP32 (Arduino IDE) =====================
#include <Wire.h>
#include "MAX30105.h"
#include "heartRate.h"
#include "DHT.h"
#define DHTPIN 4
#define DHTTYPE DHT11
#define BUZZER 15
DHT dht(DHTPIN, DHTTYPE);
MAX30105 particleSensor;
void setup() {
Serial.begin(9600);
pinMode(BUZZER, OUTPUT);
dht.begin();
if (!particleSensor.begin(Wire, I2C_SPEED_STANDARD)) {
Serial.println("MAX30102 not found");
while (1);
}
particleSensor.setup();
}
void loop() {
float temp = dht.readTemperature();
long irValue = particleSensor.getIR();
// Demo values: replace with a real BPM / SpO2 algorithm
int heartRate = random(60, 110);
int spo2 = random(90, 100);
Serial.print(temp);
Serial.print(",");
Serial.print(heartRate);
Serial.print(",");
Serial.println(spo2);
if (temp > 38 || heartRate > 100 || spo2 < 92) {
digitalWrite(BUZZER, HIGH);
} else {
digitalWrite(BUZZER, LOW);
}
delay(1000);
}
// ===================== Python (graph + alerts) =====================
/*
import serial
import matplotlib.pyplot as plt
from collections import deque
ser = serial.Serial('COM5', 9600)
temp_data, hr_data, spo2_data = deque(maxlen=20), deque(maxlen=20), deque(maxlen=20)
plt.ion()
while True:
values = ser.readline().decode().strip().split(",")
if len(values) == 3:
temp, hr, spo2 = float(values[0]), int(values[1]), int(values[2])
temp_data.append(temp); hr_data.append(hr); spo2_data.append(spo2)
print(f"Temp: {temp} HR: {hr} SpO2: {spo2}")
if temp > 38 or hr > 100 or spo2 < 92:
print("ALERT! Abnormal Condition")
plt.clf()
plt.plot(temp_data, label="Temperature")
plt.plot(hr_data, label="Heart Rate")
plt.plot(spo2_data, label="SpO2")
plt.legend()
plt.pause(0.1)
*/A health monitor that combines an ESP32 with sensors and a Python dashboard. A DHT11 measures temperature and a MAX30102 is connected for heart rate and oxygen level.
You need: ESP32 Dev Board (1), MAX30102 Heart Rate & SpO₂ Sensor (1), DHT11 Temperature Sensor (1), Buzzer (1), OLED / LCD Display (optional) (1), Breadboard (1), Jumper Wires. Software: Arduino IDE, Python 3, DHT sensor library, SparkFun MAX3010x library, PySerial, Matplotlib.
It is rated intermediate and takes about 3–4 hours to build, using the ESP32 + Laptop. The guide on this page explains every connection and step.
The complete, tested Arduino C++ code is free on this page. Copy it into Arduino IDE and upload it and run it.
Yes. IRI sells a kit with the parts for this project (PRJ-095). Message IRI on WhatsApp at +91 86060 82634 for the kit price and delivery details.