AI-Powered Remote Patient Health Monitoring & Predictive Disease Alert System Using ESP8266 and Arduino
AI-Powered Remote Patient Health Monitoring & Predictive Disease Alert System
Using ESP32/ESP8266 + Sensors + n8n Automation + AI Agent + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI-Powered Remote Patient Health Monitoring & Predictive Disease Alert System
ESP32 + IoT + AI Agent + n8n + Telegram Voice Alerts + Google Sheets + ThingSpeak
1. Project Overview
This project continuously monitors patient health parameters using IoT sensors connected to an ESP32 board. Data is uploaded to ThingSpeak Cloud, stored in Google Sheets, analyzed using AI, and critical alerts are sent through Telegram including voice notifications.
2. Features
- Real-Time Health Monitoring
- Heart Rate Monitoring
- Blood Oxygen (SpO2) Monitoring
- Body Temperature Monitoring
- Cloud Dashboard
- Google Sheets Data Logging
- AI Disease Prediction
- Telegram Notification Alerts
- Voice Alerts
- Remote Doctor Monitoring
3. Components List
| Component | Quantity |
|---|---|
| ESP32 Dev Board | 1 |
| MAX30102 Sensor | 1 |
| DHT11 Sensor | 1 |
| LM35 Sensor | 1 |
| OLED Display | 1 |
| Jumper Wires | As Required |
| Breadboard | 1 |
4. Circuit Connections
MAX30102 → ESP32
VIN → 3.3V GND → GND SDA → GPIO21 SCL → GPIO22
DHT11 → ESP32
VCC → 3.3V GND → GND DATA → GPIO4
LM35 → ESP32
VCC → 3.3V GND → GND OUT → GPIO34
5. System Architecture
Patient
|
Sensors
|
ESP32
|
ThingSpeak Cloud
|
+------------------------+
| |
Google Sheets AI Agent
| |
Database Risk Prediction
| |
+----------+-------------+
|
Telegram Alerts
|
Voice Notification
6. AI Prediction Logic
IF Temperature > 38°C THEN Fever Risk IF Heart Rate > 100 THEN Tachycardia IF Heart Rate < 60 THEN Bradycardia IF SpO2 < 92 THEN Respiratory Risk IF SpO2 < 90 AND HR > 120 THEN Critical Alert
7. ESP32 Source Code
#include <WiFi.h>
#include <HTTPClient.h>
const char* ssid="YOUR_WIFI";
const char* password="YOUR_PASSWORD";
String apiKey="YOUR_THINGSPEAK_API_KEY";
void setup()
{
Serial.begin(115200);
WiFi.begin(ssid,password);
while(WiFi.status()!=WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
}
void loop()
{
float hr=90;
float spo2=98;
float temp=36.8;
HTTPClient http;
String url=
"http://api.thingspeak.com/update?api_key="+apiKey+
"&field1="+String(hr)+
"&field2="+String(spo2)+
"&field3="+String(temp);
http.begin(url);
http.GET();
http.end();
delay(15000);
}
8. ThingSpeak Setup
- Create ThingSpeak Account
- Create New Channel
- Add Fields:
- Heart Rate
- SpO2
- Temperature
- Humidity
- Copy Write API Key
- Use API Key in ESP32 Code
9. Google Sheets Integration
function doPost(e)
{
var sheet =
SpreadsheetApp.getActiveSpreadsheet()
.getSheetByName("Sheet1");
var data =
JSON.parse(e.postData.contents);
sheet.appendRow([
new Date(),
data.hr,
data.spo2,
data.temp,
data.status
]);
return ContentService
.createTextOutput("Success");
}
10. Telegram Bot Setup
- Open Telegram
- Search @BotFather
- Create New Bot
- Get Bot Token
- Get Chat ID
- Use Token in n8n Workflow
11. n8n Workflow
ThingSpeak Trigger
|
▼
Webhook
|
▼
AI Analysis
|
▼
IF Condition
|
+---+---+
| |
Normal Critical
| |
Sheets Telegram
Update Alerts
12. Voice Notification Automation
ESP32 Data
|
ThingSpeak
|
n8n Workflow
|
OpenAI / Gemini
|
Generate Alert Text
|
Google TTS
|
MP3 Voice File
|
Telegram Voice Message
13. Power Consumption Formula
Power = Voltage × Current Battery Life = Battery Capacity(mAh) --------------------- Average Current(mA)
14. Future Enhancements
- ECG Sensor Integration
- Blood Pressure Monitoring
- LSTM Disease Prediction
- Doctor Mobile Application
- AWS IoT Integration
- Firebase Database
- GPS Emergency Tracking
- Hospital Dashboard
15. Deployment Guide
- Build Hardware
- Upload ESP32 Code
- Configure ThingSpeak
- Connect Google Sheets
- Configure n8n Workflow
- Create Telegram Bot
- Connect AI Agent
- Test Alerts
- Deploy System


Comments
Post a Comment