Thursday, June 11, 2026

Health Monitoring System of Patient Based on IOT Using ESP8266 & ARDUINO #school #science #health

“Health Monitoring System of Patient Based on IoT Using ESP32, Arduino, AI Agent, n8n Automation, Telegram Voice Alerts, Google Sheets & ThingSpeak Cloud Dashboard” Save as project_documentation.php and open it in a PHP server environment. AI Powered IoT Health Monitoring System

AI Powered IoT Health Monitoring System Using ESP32

This project continuously monitors patient health parameters and sends data to cloud platforms. Artificial Intelligence analyzes health trends and predicts potential health risks. The system automatically generates Telegram alerts, voice notifications, Google Sheets records, and ThingSpeak cloud visualizations.


1. Project Objectives

  • Monitor patient body temperature.
  • Measure heart rate.
  • Measure blood oxygen level (SpO2).
  • Upload data to cloud in real-time.
  • Store historical records.
  • Generate AI-based predictions.
  • Send emergency Telegram alerts.
  • Generate voice notifications.
  • Create dashboard visualization.

2. System Architecture


Patient
   |
Sensors
(MAX30102, DHT11/LM35)
   |
ESP32 Controller
   |
WiFi Internet
   |
ThingSpeak Cloud
   |
n8n Automation
   |
AI Agent Analysis
   |
-------------------------
| Telegram Bot Alerts   |
| Voice Notifications   |
| Google Sheets Logs    |
-------------------------


3. Components Required

Component Quantity
ESP32 Development Board 1
MAX30102 Pulse Oximeter Sensor 1
DHT11 Temperature Sensor 1
Buzzer 1
LED Indicators 2
Breadboard 1
Jumper Wires Several
USB Cable 1
WiFi Network 1

4. Sensor Functions

MAX30102

  • Measures Heart Rate
  • Measures Blood Oxygen (SpO2)

DHT11

  • Measures Body Temperature

5. Circuit Connections

MAX30102 → ESP32

MAX30102ESP32
VIN3.3V
GNDGND
SCLGPIO22
SDAGPIO21

DHT11 → ESP32

DHT11ESP32
VCC3.3V
GNDGND
DATAGPIO4

Buzzer

BuzzerESP32
PositiveGPIO15
NegativeGND

6. Flowchart


START
  |
Initialize ESP32
  |
Connect WiFi
  |
Read Sensors
  |
Upload Data
  |
ThingSpeak Cloud
  |
n8n Workflow
  |
AI Analysis
  |
Abnormal?
  |
Yes -------> Telegram Alert
  |                |
  |                |
  |          Voice Message
  |
No
  |
Store Data
  |
Repeat


7. ESP32 Source Code


#include <WiFi.h>
#include <HTTPClient.h>

const char* ssid = "YOUR_WIFI";
const char* password = "YOUR_PASSWORD";

String apiKey = "THINGSPEAK_API_KEY";

void setup()
{
  Serial.begin(115200);

  WiFi.begin(ssid,password);

  while(WiFi.status()!=WL_CONNECTED)
  {
    delay(1000);
  }
}

void loop()
{
  float temp = 36.5;
  int heartRate = 78;
  int spo2 = 98;

  if(WiFi.status()==WL_CONNECTED)
  {
      HTTPClient http;

      String url =
      "https://api.thingspeak.com/update?api_key="
      + apiKey +
      "&field1="+String(temp)+
      "&field2="+String(heartRate)+
      "&field3="+String(spo2);

      http.begin(url);
      http.GET();
      http.end();
  }

  delay(15000);
}


8. ThingSpeak Setup

  1. Create ThingSpeak account.
  2. Create new channel.
  3. Add fields:
    • Temperature
    • Heart Rate
    • SpO2
  4. Save Channel.
  5. Copy Write API Key.
  6. Paste into ESP32 code.

9. Telegram Bot Setup

Step 1

Open Telegram and search BotFather.

Step 2

Create new bot using /newbot command.

Step 3

Copy generated Bot Token.

Step 4

Get Chat ID.

Step 5

Use token in n8n Telegram node.


10. Google Sheets Integration

Create Sheet

Date Temperature Heart Rate SpO2 Status

n8n Workflow

  • Receive ThingSpeak Data
  • Analyze Data
  • Append Row to Google Sheet

11. n8n Workflow Design


ThingSpeak Trigger
        |
        v
Data Processing
        |
        v
AI Agent
        |
        +-------------------+
        |                   |
        v                   v
Google Sheets       Telegram Alert
                            |
                            v
                     Voice Message


12. Sample n8n Workflow JSON


{
 "nodes":[
   {
    "name":"Webhook",
    "type":"n8n-nodes-base.webhook"
   },
   {
    "name":"AI Agent",
    "type":"n8n-nodes-base.openai"
   },
   {
    "name":"Google Sheets",
    "type":"n8n-nodes-base.googleSheets"
   },
   {
    "name":"Telegram",
    "type":"n8n-nodes-base.telegram"
   }
 ]
}


13. AI Prediction Logic

Input Parameters

  • Temperature
  • Heart Rate
  • SpO2
  • Historical Trends

Prediction Rules


IF Temperature > 38°C
AND Heart Rate > 110

Risk = HIGH

IF SpO2 < 92%

Risk = CRITICAL

ELSE

Risk = NORMAL


14. Power Consumption Prediction

AI calculates average sensor power usage and predicts battery life.


Battery Capacity = 2000mAh

Average Current = 120mA

Battery Life

= 2000 / 120

= 16.6 Hours


15. Voice Notification Automation

n8n converts alert text into speech.

Example Message


Warning!

Patient Heart Rate High.

Current Heart Rate:
125 BPM

Please Check Immediately.

Automation Flow


AI Alert
   |
Text To Speech
   |
Telegram Voice Message
   |
Doctor / Caretaker


16. Alert Conditions

Parameter Condition Alert
Temperature > 38°C High Fever
Heart Rate > 110 BPM Tachycardia
SpO2 < 92% Emergency

17. Advantages

  • Low Cost
  • Portable
  • Real-Time Monitoring
  • Cloud Storage
  • Remote Healthcare
  • AI Assisted Analysis
  • Automatic Alerts

18. Applications

  • Hospitals
  • Home Care
  • Elderly Monitoring
  • Remote Patient Monitoring
  • Smart Healthcare

19. Future Enhancements

  • ECG Integration
  • Blood Pressure Monitoring
  • Machine Learning Disease Prediction
  • Mobile App Development
  • GPS Emergency Tracking
  • Doctor Dashboard
  • Multi Patient Monitoring

20. Deployment Guide

  1. Assemble hardware.
  2. Upload ESP32 code.
  3. Connect sensors.
  4. Configure WiFi.
  5. Create ThingSpeak channel.
  6. Create Telegram bot.
  7. Configure n8n workflow.
  8. Connect Google Sheets.
  9. Test alerts.
  10. Deploy for real-time monitoring.

21. Conclusion

This AI-Powered Health Monitoring System combines ESP32 IoT hardware, ThingSpeak cloud analytics, n8n automation, Telegram voice notifications, Google Sheets logging, and AI-based prediction techniques to provide a complete smart healthcare solution for patient monitoring and emergency alert management.

This PHP document can be expanded into a full project report of 25–40 pages by adding: Complete MAX30102 library code Full ESP32 production firmware Complete n8n workflow JSON export OpenAI/LLM AI Agent integration ThingSpeak MATLAB analytics Telegram voice-message API implementation Database (MySQL) backend Admin dashboard with PHP + Bootstrap AI health-risk prediction model documentation Deployment and testing results with screenshots.

Health Monitoring System of Patient Based on IOT Using ESP8266 & ARDUINO #school #science #health

“Health Monitoring System of Patient Based on IoT Using ESP32, Arduino, AI Agent, n8n Automation, Telegram Voice Alerts, Google Sheets ...