SVSEmbedded will do new innovative thoughts. Any latest idea will comes we will take that idea & implement that idea in a few days. We always encourage the students to take good ideas/projects. SVSEmbedded providing latest innovative electronics projects to B.E/B.Tech/M.E/M.Tech students. We developed thousands of projects for engineering student to develop their skills in electrical and electronics
Wednesday, 27 May 2026
AI-Based ECG and Heart Disease Prediction System
AI-Based ECG & Heart Disease Prediction System
Agentic IoT using ESP32 + AI + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI-Based ECG & Heart Disease Prediction System
Agentic IoT using ESP32 + AI + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
1. Project Overview
This project is an advanced AI-powered IoT healthcare monitoring system that continuously monitors ECG signals using an ESP32 microcontroller and predicts possible heart abnormalities using AI logic.
The system integrates:
ESP32 for sensor data acquisition
ECG sensor module (AD8232)
AI-based heart disease prediction
n8n automation workflows
Telegram voice alerts
Google Sheets cloud logging
ThingSpeak real-time dashboard
Agentic IoT automation
Web dashboard visualization
The solution can be used for:
Remote patient monitoring
Smart healthcare systems
Elderly monitoring
Preventive cardiac diagnosis
Wearable healthcare projects
AI-assisted hospital systems
2. System Architecture
ECG Sensor (AD8232)
│
▼
ESP32 Board
│
┌───────────┼───────────┐
▼ ▼ ▼
ThingSpeak n8n Workflow AI Engine
Dashboard │ │
▼ ▼
Telegram Alerts Heart Disease
Voice Msg Prediction
│
▼
Google Sheets
3. Features
Core Features
✅ Real-time ECG Monitoring
✅ Heart Disease Prediction using AI
✅ Cloud Dashboard Visualization
✅ Telegram Notification Alerts
✅ Voice Notification Automation
✅ Google Sheets Data Logging
✅ ESP32 WiFi Connectivity
✅ ThingSpeak IoT Dashboard
✅ Agentic AI Decision Making
✅ Abnormal Heartbeat Detection
✅ BPM Calculation
✅ ECG Waveform Monitoring
4. Components List
Component Quantity Purpose
ESP32 Dev Board 1 Main controller
AD8232 ECG Sensor 1 ECG signal acquisition
Jumper Wires Several Connections
Breadboard 1 Prototyping
USB Cable 1 ESP32 programming
Power Supply 1 System power
WiFi Network 1 Cloud communication
Smartphone 1 Telegram alerts
Laptop/PC 1 n8n & monitoring
5. Working Principle
ECG sensor captures heartbeat signals.
ESP32 reads analog ECG waveform.
BPM is calculated.
AI logic evaluates ECG abnormalities.
Data uploaded to ThingSpeak cloud.
n8n receives webhook data.
Telegram sends alert notifications.
Voice alerts generated automatically.
Google Sheets stores historical records.
6. Circuit Schematic Diagram
AD8232 to ESP32 Connections
AD8232 Pin ESP32 Pin
OUTPUT GPIO34
3.3V 3.3V
GND GND
LO+ GPIO26
LO- GPIO27
7. Circuit Diagram (Text Representation)
+-------------------+
| ESP32 |
| |
ECG OUT --> GPIO34 |
LO+ --> GPIO26 |
LO- --> GPIO27 |
3.3V --> 3.3V |
GND --> GND |
+-------------------+
8. Flowchart
START
│
▼
Initialize ESP32 WiFi
│
▼
Read ECG Sensor Data
│
▼
Calculate BPM
│
▼
AI Prediction Logic
│
┌──────┴───────┐
▼ ▼
Normal Abnormal
│ │
▼ ▼
Upload Data Send Alert
│ │
▼ ▼
ThingSpeak Telegram Voice
│ │
└──────┬───────┘
▼
Google Sheets
│
▼
LOOP
9. ESP32 Source Code (Arduino IDE)
#include
#include
const char* ssid = "YOUR_WIFI_NAME";
const char* password = "YOUR_WIFI_PASSWORD";
String apiKey = "THINGSPEAK_API_KEY";
const int ecgPin = 34;
int threshold = 550;
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting...");
}
Serial.println("WiFi Connected");
}
void loop() {
int ecgValue = analogRead(ecgPin);
Serial.println(ecgValue);
String condition = "Normal";
if(ecgValue > threshold) {
condition = "Abnormal";
}
if(WiFi.status() == WL_CONNECTED) {
HTTPClient http;
String url = "http://api.thingspeak.com/update?api_key="
+ apiKey +
"&field1=" + String(ecgValue);
http.begin(url);
int httpCode = http.GET();
Serial.println(httpCode);
http.end();
}
delay(2000);
}
10. AI Heart Disease Prediction Logic
Basic AI Logic
The AI engine analyzes:
ECG amplitude
BPM variations
Signal irregularities
Threshold crossings
Heart rhythm pattern
Prediction Categories
ECG Condition Prediction
Normal waveform Healthy
Irregular spikes Arrhythmia Risk
High BPM Tachycardia
Low BPM Bradycardia
Noise patterns Sensor Error
11. Advanced AI Enhancement
You can improve prediction using:
TensorFlow Lite
TinyML on ESP32
Edge AI inference
Deep learning ECG classification
Possible datasets:
MIT-BIH Arrhythmia Dataset
PhysioNet ECG Database
12. ThingSpeak Cloud Dashboard Setup
Using ThingSpeak
Steps
Create account
Create new channel
Add fields:
ECG Value
BPM
Prediction
Copy Write API Key
Insert API key into ESP32 code
View real-time graphs
13. Google Sheets Integration
Using:
Google Apps Script
n8n webhook automation
Stored Parameters
Timestamp ECG BPM Prediction
Time ECG Value Heart Rate AI Result
14. Telegram Bot Setup
Using Telegram BotFather
Steps
Open Telegram
Search:
BotFather
Create new bot
Copy Bot Token
Obtain Chat ID
Integrate into n8n workflow
15. Voice Notification Automation
Example Voice Alerts
Warning! Abnormal heart activity detected.
Please check patient condition immediately.
Voice Generation Methods
Google Text-to-Speech
Telegram Voice API
ElevenLabs TTS
gTTS Python library
16. n8n Automation Workflow
Using n8n Automation Platform
Workflow Process
Webhook Trigger
│
▼
Receive ECG Data
│
▼
AI Analysis
│
▼
Condition Check
│
┌────┴─────┐
▼ ▼
Normal Abnormal
│ │
▼ ▼
Log Data Telegram Alert
│ │
▼ ▼
Google Sheets Voice Message
17. Example n8n Workflow JSON
{
"nodes": [
{
"parameters": {},
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [250, 300]
},
{
"parameters": {},
"name": "Telegram",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [600, 300]
}
],
"connections": {}
}
18. Web Dashboard Features
Dashboard Includes
Real-time ECG graph
BPM display
AI prediction result
Alert status
Patient history
Device connectivity status
19. Agentic AI Features
The system behaves like an autonomous AI agent:
✅ Detects anomalies
✅ Makes decisions
✅ Sends alerts automatically
✅ Stores data autonomously
✅ Predicts heart abnormalities
✅ Triggers emergency notifications
20. Power Consumption Prediction Logic
AI Power Optimization
The ESP32 predicts usage patterns:
State Power Mode
Idle Deep Sleep
Monitoring Active
Alert Mode High Performance
Optimization Techniques
Deep sleep mode
Sensor polling intervals
Adaptive WiFi transmission
Edge AI processing
21. Security Enhancements
Recommended Security
HTTPS APIs
Secure MQTT
Token authentication
Encrypted cloud communication
User authentication
22. Future Enhancements
Future Scope
AI Enhancements
Deep learning ECG analysis
CNN-based arrhythmia detection
Cloud AI diagnosis
IoT Enhancements
MQTT communication
Firebase integration
AWS IoT Core
Edge AI
Healthcare Enhancements
Multi-patient monitoring
Doctor dashboard
Emergency ambulance alerts
GPS tracking
Hardware Enhancements
OLED display
Battery backup
Wearable ECG device
Mobile app integration
23. Deployment Guide
Hardware Deployment
Assemble ECG circuit
Upload ESP32 firmware
Connect WiFi
Verify sensor readings
Configure ThingSpeak
Configure n8n
Setup Telegram bot
Test alerts
24. Testing Procedure
Test Expected Result
ECG Reading Real-time waveform
BPM Calculation Accurate BPM
Cloud Upload Data visible
Telegram Alert Alert message received
Voice Notification Audio alert plays
Google Sheets Data logged
25. Applications
Healthcare Applications
Smart hospitals
Remote healthcare
Elderly monitoring
ICU monitoring
Fitness tracking
Home healthcare systems
26. Advantages
✅ Low-cost healthcare solution
✅ Real-time monitoring
✅ AI-assisted diagnosis
✅ Remote accessibility
✅ Cloud integration
✅ Automation support
✅ Scalable architecture
27. Limitations
⚠ Not a certified medical device
⚠ Requires proper ECG electrode placement
⚠ AI predictions are indicative only
⚠ Internet required for cloud features
28. Conclusion
The AI-Based ECG and Heart Disease Prediction System combines:
Embedded systems
Artificial intelligence
IoT cloud monitoring
Automation workflows
Agentic healthcare intelligence
This project demonstrates how ESP32, AI, n8n automation, and cloud technologies can create an intelligent remote healthcare monitoring ecosystem capable of real-time prediction, autonomous alerts, and scalable deployment.
29. Recommended Software & Platforms
Arduino IDE
ESP32 Board Package
ThingSpeak Cloud
n8n Workflow Automation
Google Sheets
Telegram API Documentation
TensorFlow Lite for Microcontrollers
Subscribe to:
Post Comments (Atom)
AI-Based ECG and Heart Disease Prediction System
AI-Based ECG & Heart Disease Prediction System Agentic IoT using ESP32 + AI + n8n Automation + Telegram Voice Alerts + Google Sheets + T...
-
www.svsembedded.com SVSEMBEDDED svsembedded@gmail.com , CONTACT: 9491535690, 7842358459 ------------------------------------------...
-
Watch Video Demonstration Carefully Till End -- Temperature and Humidity Controller For Incubator Temperature and Humidity Controller For ...
-
Electronic KITS: DTDC Courier Proof Of Delivery Receipts - 2024 - 2023 - 2022 - 2021 - 2020 - 2019 - 2018 - 2017 - 2016...

No comments:
Post a Comment