This guide shows you how to build a wearable ESP32 health monitoring patch that reads your heart rate and body temperature and sends the readings to the cloud over Wi-Fi. It is a student and final year project — a working prototype you can demonstrate, explain, and extend.
Important: this is a learning prototype, not a medical device. The MAX30100 is a hobby sensor, not a medical-grade sensor, and its readings are approximate. Do not use this patch to diagnose illness or replace a real medical check-up.

The ESP32 is the right board for this project because it has built-in Wi-Fi and Bluetooth, two I2C pins for the pulse sensor and display, and enough pins for the temperature sensor — all on one small, cheap board.
| Component | Specification | Price / link |
|---|---|---|
| ESP32 Dev Module | 30-pin Wi-Fi + Bluetooth board | ESP32 30-Pin Wi-Fi Bluetooth Development Board — Rs 1,100 |
| Pulse sensor | MAX30100 / MAX30102 | — |
| Temperature sensor | DS18B20 (waterproof version works well) | — |
| Resistor | 4.7k ohm (pull-up for DS18B20) | — |
| Battery | 3.7V Li-ion 18650 cell | 18650 Lithium-Ion Rechargeable Cell 2000mAh — Lot Rs 200 / New Rs 250 |
| Charging module | TP4056 Type-C | TP4056 Charging Board Type-C — Rs 50 |
| Display (optional) | OLED 0.96" I2C | — |
| Breadboard + jumper wires | — | — |
The MAX30100, DS18B20 and OLED display do not have individual listings in the QKZEE shop — they are available at the Hall Road shop on request.
| Sensor / Module | ESP32 Pin | Notes |
|---|---|---|
| MAX30100 VCC | 3V3 | 3.3V only — do not connect to 5V |
| MAX30100 GND | GND | — |
| MAX30100 SDA | GPIO 21 | I2C data |
| MAX30100 SCL | GPIO 22 | I2C clock |
| DS18B20 data | GPIO 4 | OneWire data |
| DS18B20 VCC | 3V3 | — |
| DS18B20 GND | GND | — |
| 4.7k ohm resistor | Between DS18B20 data (GPIO 4) and 3V3 | Pull-up — without it the sensor will not reply |
| OLED SDA | GPIO 21 | Shared I2C bus with MAX30100 |
| OLED SCL | GPIO 22 | Shared I2C bus with MAX30100 |
| OLED VCC / GND | 3V3 / GND | — |
| Battery (via TP4056 OUT) | VIN | For bench testing, a 5V USB cable is the safer option |
The MAX30100 shines red and infrared light into your fingertip and measures how much light bounces back. Blood absorbs light differently with every heartbeat, so the sensor can work out your pulse and your blood oxygen level (SpO2) — this is called photoplethysmography.
At the same time, the DS18B20 measures skin temperature. The ESP32 reads both sensors, prints the values to the Serial Monitor, and every 20 seconds uploads them to ThingSpeak over Wi-Fi. You can then watch heart rate, SpO2 and temperature as live charts on your ThingSpeak channel.
Install these libraries first from the Arduino IDE Library Manager (Sketch → Include Library → Manage Libraries):
Then upload this sketch. Replace the Wi-Fi name, password and ThingSpeak Write API Key with your own (see the ThingSpeak section below).
/*
ESP32 Health Monitoring Patch
Reads heart rate + SpO2 from MAX30100, temperature from DS18B20,
prints values on the Serial Monitor and uploads them to ThingSpeak.
Board: ESP32 Dev Module. MAX30100 on I2C (SDA 21, SCL 22).
DS18B20 data pin GPIO 4, with a 4.7k ohm resistor to 3.3V.
*/
#include <WiFi.h>
#include <HTTPClient.h>
#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include "MAX30100_PulseOximeter.h"
#define REPORTING_PERIOD_MS 1000
#define ONE_WIRE_BUS 4
const char* ssid = "YOUR_WIFI_NAME";
const char* password = "YOUR_WIFI_PASSWORD";
const char* thingSpeakApiKey = "YOUR_THINGSPEAK_WRITE_API_KEY";
PulseOximeter pox;
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature tempSensor(&oneWire);
uint32_t tsLastReport = 0;
uint32_t tsLastUpload = 0;
void onBeatDetected() {
Serial.println("Beat!");
}
void setup() {
Serial.begin(115200);
Serial.println("ESP32 Health Monitoring Patch starting...");
tempSensor.begin();
if (!pox.begin()) {
Serial.println("MAX30100 not found - check wiring!");
while (1);
}
pox.setOnBeatDetectedCallback(onBeatDetected);
WiFi.begin(ssid, password);
Serial.print("Connecting to WiFi");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("\nWiFi connected");
}
void loop() {
pox.update();
if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
tempSensor.requestTemperatures();
float temperatureC = tempSensor.getTempCByIndex(0);
float heartRate = pox.getHeartRate();
float spo2 = pox.getSpO2();
Serial.print("Heart rate: ");
Serial.print(heartRate);
Serial.print(" bpm | SpO2: ");
Serial.print(spo2);
Serial.print(" % | Temperature: ");
Serial.print(temperatureC);
Serial.println(" C");
tsLastReport = millis();
}
// ThingSpeak accepts an update at most every 15 seconds
if (millis() - tsLastUpload > 20000 && WiFi.status() == WL_CONNECTED) {
tempSensor.requestTemperatures();
float temperatureC = tempSensor.getTempCByIndex(0);
HTTPClient http;
String url = "http://api.thingspeak.com/update?api_key=" + String(thingSpeakApiKey)
+ "&field1=" + String(pox.getHeartRate())
+ "&field2=" + String(pox.getSpO2())
+ "&field3=" + String(temperatureC);
http.begin(url);
int code = http.GET();
Serial.print("ThingSpeak response: ");
Serial.println(code);
http.end();
tsLastUpload = millis();
}
}YOUR_THINGSPEAK_WRITE_API_KEY, along with your Wi-Fi name and password.Firebase and Blynk are also possible for this project, but the sketch above uses ThingSpeak because it is the simplest free option for a student demo: no app to build, just a web dashboard.
This is a prototype for learning and demonstration. It is not a medical device and its readings are not accurate enough for diagnosis or treatment decisions.
The ESP32 board, TP4056 charging module and 18650 cell are available at QKZEE Technologies, Shop 20, 1st Floor, Al-Khalil Center, Hall Road, Lahore, and online at qkzeetech.com with delivery all over Pakistan — see the links in the components table above. The MAX30100, DS18B20 and OLED display are available at the Hall Road shop on request.
If a sensor does not respond, or your ThingSpeak charts stay empty, message us — tell us what the Serial Monitor shows (copy the exact lines) and which step you are on, and we will help you find the fault.
Chat on WhatsAppWatch on YouTube
Is the MAX30100 a medical-grade sensor?
No. It is a hobby sensor for learning and prototypes. Its heart rate and SpO2 readings are approximate and affected by movement, skin tone and finger placement. Never use them for medical decisions.
Can I use this patch to monitor a patient?
No. This is a student project prototype, not a certified medical device. It is fine for demonstrations and learning, not for real patient care.
Why does my heart rate show 0?
Usually the finger is not flat on the sensor, or it is moving. Hold your fingertip steady on the sensor window and wait about 10 seconds for the reading to settle.
Why does the temperature show −127°C?
That is the DS18B20's "not connected" value. Check the data wire on GPIO 4 and the 4.7k ohm resistor between the data pin and 3V3.
Do I need the OLED display?
No, it is optional. Without it, all readings appear on the Serial Monitor and on ThingSpeak. The display only helps if you want to show values on the patch itself.
Can I use Firebase or Blynk instead of ThingSpeak?
Yes. The sensors and wiring stay the same — only the cloud code changes. ThingSpeak is used here because it is the simplest free dashboard for a student demo.
Building an ESP32 health monitoring patch with a MAX30100 pulse sensor and a DS18B20 temperature sensor is a strong final year project: it combines sensors, Wi-Fi, and cloud dashboards in one wearable prototype. Follow the wiring above, test each sensor on its own first, and you will have live heart rate, SpO2 and temperature charts on ThingSpeak to show your teachers and judges.