AI-Based Smart Healthcare Assistant Chatbot with IoT Sensors
https://svsembedded.wordpress.com/2026/06/18/ai-based-smart-flood-detection-and-early-warning-system/
ESP32 + AI Agent + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
";
echo "";
echo "
AI Smart Healthcare Assistant Project";
echo "
";
echo "";
echo "";
echo "
AI-Based Smart Healthcare Assistant Chatbot with IoT Sensors
";
/* ===================================================== */
echo "
";
echo "
1. Project Overview
";
echo "
This project is an AI-powered Smart Healthcare Monitoring System using:
- ESP32 Microcontroller
- MAX30102 Heart Rate & SpO2 Sensor
- DHT22 Temperature & Humidity Sensor
- ThingSpeak Cloud Dashboard
- n8n Automation
- Telegram Bot Alerts
- Google Sheets Logging
- Voice Notification System
";
echo "
";
/* ===================================================== */
echo "
";
echo "
2. Components List
";
echo "
| Component |
Quantity |
Purpose |
| ESP32 Dev Board |
1 |
Main Controller |
| MAX30102 Sensor |
1 |
Heart Rate & SpO2 Monitoring |
| DHT22 Sensor |
1 |
Temperature & Humidity |
| OLED Display |
1 |
Display Sensor Data |
| Buzzer |
1 |
Emergency Alert |
| LEDs |
2 |
Status Indicators |
| Breadboard |
1 |
Circuit Prototyping |
| Jumper Wires |
Several |
Connections |
";
echo "
";
/* ===================================================== */
echo "
";
echo "
3. Circuit Connections
";
echo "
| Sensor |
ESP32 Pin |
| DHT22 DATA |
GPIO4 |
| MAX30102 SDA |
GPIO21 |
| MAX30102 SCL |
GPIO22 |
| Buzzer |
GPIO18 |
| OLED SDA |
GPIO21 |
| OLED SCL |
GPIO22 |
";
echo "
";
/* ===================================================== */
echo "
";
echo "
4. System Flowchart
";
echo "
START
↓
Initialize ESP32
↓
Connect WiFi
↓
Read Sensor Data
↓
Analyze Health Conditions
↓
Upload to ThingSpeak
↓
Send Data to n8n
↓
Store in Google Sheets
↓
Check Alert Conditions
↓
Send Telegram Voice Alert
↓
Repeat Loop
";
echo "
";
/* ===================================================== */
echo "
";
echo "
5. ESP32 Arduino Source Code
";
echo "
#include <WiFi.h>
#include <HTTPClient.h>
#include "ThingSpeak.h"
#include "DHT.h"
const char* ssid = "YOUR_WIFI";
const char* password = "YOUR_PASSWORD";
WiFiClient client;
unsigned long channelID = YOUR_CHANNEL_ID;
const char* writeAPIKey = "YOUR_API_KEY";
#define DHTPIN 4
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
float temperature;
float humidity;
int heartRate = 78;
int spo2 = 97;
void setup(){
Serial.begin(115200);
WiFi.begin(ssid, password);
while(WiFi.status() != WL_CONNECTED){
delay(1000);
Serial.println("Connecting...");
}
ThingSpeak.begin(client);
dht.begin();
}
void loop(){
temperature = dht.readTemperature();
humidity = dht.readHumidity();
ThingSpeak.setField(1, temperature);
ThingSpeak.setField(2, humidity);
ThingSpeak.setField(3, heartRate);
ThingSpeak.setField(4, spo2);
ThingSpeak.writeFields(channelID, writeAPIKey);
delay(15000);
}
";
echo "
";
/* ===================================================== */
echo "
";
echo "
6. ThingSpeak Setup
";
echo "
- Create ThingSpeak Account
- Create New Channel
- Add 4 Fields
- Copy Channel ID
- Copy Write API Key
- Paste into ESP32 Code
";
echo "
";
/* ===================================================== */
echo "
";
echo "
7. Telegram Bot Setup
";
echo "
- Open Telegram
- Search BotFather
- Type /newbot
- Enter Bot Name
- Enter Username
- Copy Bot Token
";
echo "
https://api.telegram.org/botYOUR_TOKEN/getUpdates
";
echo "
";
/* ===================================================== */
echo "
";
echo "
8. n8n Workflow
";
echo "
Workflow Process:
Webhook Trigger
↓
Receive Sensor Data
↓
Save to Google Sheets
↓
Analyze Data
↓
IF abnormal condition
↓
Send Telegram Alert
↓
Generate Voice Notification
";
echo "
";
/* ===================================================== */
echo "
";
echo "
9. Google Sheets Integration
";
echo "
| Column |
Description |
| Timestamp |
Date and Time |
| Temperature |
Body Temperature |
| Humidity |
Humidity Value |
| Heart Rate |
BPM Value |
| SpO2 |
Oxygen Level |
";
echo "
";
/* ===================================================== */
echo "
";
echo "
10. AI Power Prediction Logic
";
echo "
Power = Voltage × Current
AI adjusts upload frequency based on battery percentage.
| Battery Level |
Action |
| > 70% |
Upload every 15 seconds |
| 40% - 70% |
Upload every 1 minute |
| < 40% |
Deep Sleep Mode |
";
echo "
";
/* ===================================================== */
echo "
";
echo "
11. Voice Notification Automation
";
echo "
Voice alerts are generated using:
- Google Text-to-Speech API
- Telegram Audio Messages
- n8n Automation
Emergency Warning.
Patient oxygen level is critically low.
Please seek medical assistance.
";
echo "
";
/* ===================================================== */
echo "
";
echo "
12. Future Enhancements
";
echo "
- Machine Learning Health Prediction
- Firebase Integration
- Mobile App Dashboard
- GPS Tracking
- ECG Monitoring
- Cloud AI Analytics
";
echo "
";
/* ===================================================== */
echo "
";
echo "
13. Deployment Applications
";
echo "
| Application |
Use Case |
| Hospitals |
Patient Monitoring |
| Elderly Care |
Remote Health Tracking |
| Fitness Monitoring |
Health Analytics |
| Rural Healthcare |
Remote Diagnostics |
";
echo "
";
/* ===================================================== */
echo "
";
echo "
14. Conclusion
";
echo "
This AI-Based Smart Healthcare Assistant combines:
- IoT
- AI
- Cloud Computing
- Automation
- Healthcare Analytics
The system provides real-time monitoring, AI predictions,
Telegram alerts, cloud dashboards, and automated healthcare assistance.
";
echo "
";
/* ===================================================== */
echo "
";
echo "
15. Official Resources
";
echo "
";
echo "
";
echo "";
echo "