← Back to IoT Blog
Healthcare IoT 32 min read

Remote Patient Monitoring System

Build a complete remote patient monitoring system. Track vital signs, send alerts to healthcare providers, and create cloud dashboards for telemedicine applications.

System Overview

Remote patient monitoring enables continuous health tracking outside clinical settings, reducing hospital readmissions by 50%.

Monitored Parameters:
  • Heart rate & heart rate variability
  • Blood oxygen saturation (SpO2)
  • Body temperature
  • Blood pressure
  • Respiratory rate
  • Activity/fall detection

Vital Sign Sensors

Hardware Setup

ESP32 → MAX30102 (Pulse Oximeter)
VCC → 3.3V, GND → GND
SDA → GPIO21, SCL → GPIO22
INT → GPIO34

ESP32 → MLX90614 (Temperature)
VCC → 3.3V, GND → GND
SDA → GPIO21, SCL → GPIO22

ESP32 → MPU6050 (Accelerometer)
VCC → 3.3V, GND → GND
SDA → GPIO21, SCL → GPIO22
INT → GPIO35

ESP32 Firmware

#include 
#include 
#include 

MAX30105 particleSensor;

void setup() {
  particleSensor.begin(Wire, I2C_SPEED_FAST);
  particleSensor.setup();
  particleSensor.setPulseAmplitudeRed(0x0A);
  
  WiFi.begin(ssid, password);
  client.setServer(mqtt_server, 8883);
}

void loop() {
  long irValue = particleSensor.getIR();
  long redValue = particleSensor.getRed();
  
  float spo2 = calculateSpO2(irValue, redValue);
  float bpm = calculateBPM(irValue);
  float temp = readTemperature();
  
  // Publish to cloud
  publishVitals(spo2, bpm, temp);
  
  // Check for alerts
  checkAlerts(spo2, bpm);
  
  delay(5000);
}

Cloud Dashboard

// Node-RED dashboard flow
[
  {"id":"mqtt-in","type":"mqtt in","topic":"patient/+/vitals"},
  {"id":"function","type":"function","func":"msg.payload = {heart_rate: msg.payload.bpm, spo2: msg.payload.spo2}; return msg;"},
  {"id":"gauge-hr","type":"ui_gauge","name":"Heart Rate","format":"{{value}} bpm"},
  {"id":"gauge-spo2","type":"ui_gauge","name":"SpO2","format":"{{value}} %"}
]

Alert System

void checkAlerts(float spo2, float bpm) {
  if (spo2 < 90) {
    sendAlert("LOW_SPO2", spo2);
  }
  if (bpm > 120 || bpm < 50) {
    sendAlert("ABNORMAL_HR", bpm);
  }
}

void sendAlert(String type, float value) {
  // Send to healthcare provider
  client.publish("patient/alerts", 
    "{\"type\":\"" + type + "\",\"value\":" + String(value) + "}");
}
HIPAA Compliance:
  • Encrypt all patient data (TLS)
  • Implement access controls
  • Maintain audit logs
  • Use secure authentication
  • Sign BAA with cloud providers

Next Steps

  • Add ECG monitoring
  • Implement fall detection
  • Create mobile app for patients
  • Integrate with EMR systems