Sunday, 19 July 2026

AI-Based Smart Border Surveillance Robot with Thermal Vision

AI-Based Smart Border Surveillance Robot with Thermal Vision"; echo "

Project Description

"; echo "

"; echo "The AI-Based Smart Border Surveillance Robot with Thermal Vision is an intelligent IoT-enabled mobile robotic platform designed for continuous monitoring of authorized borders, restricted areas, industrial perimeters, campuses, forests and remote inspection zones."; echo "

"; echo "

"; echo "The robot uses an ESP32 microcontroller as the main IoT controller. The system collects real-time information using thermal sensors, PIR motion sensors, ultrasonic distance sensors, GPS modules, environmental sensors and battery monitoring circuits."; echo "

"; echo "

"; echo "The collected data is transmitted to an n8n automation platform through Wi-Fi or another authorized communication network. An AI Agent analyzes the sensor data and generates an event interpretation."; echo "

"; echo "

"; echo "When a significant thermal or motion anomaly is detected, the system automatically generates an event, sends the event to the AI Agent, stores the data in Google Sheets, updates the ThingSpeak cloud dashboard and sends Telegram text and voice notifications to the authorized operator."; echo "

"; echo "

"; echo "The system also monitors battery voltage, current consumption and power usage. AI-based power consumption prediction can estimate future battery usage and identify abnormal power consumption."; echo "

"; echo "

"; echo "The robot is designed as a monitoring and alerting system. Final decisions remain with authorized human operators."; echo "

"; /* =========================================================== 2. MAIN OBJECTIVES =========================================================== */ echo "

Main Objectives

"; echo "
    "; echo "
  • Monitor authorized remote locations continuously.
  • "; echo "
  • Detect thermal anomalies.
  • "; echo "
  • Detect motion using PIR sensors.
  • "; echo "
  • Measure distance and detect obstacles.
  • "; echo "
  • Track robot GPS location.
  • "; echo "
  • Monitor battery voltage and current.
  • "; echo "
  • Send real-time Telegram alerts.
  • "; echo "
  • Generate Telegram voice notifications.
  • "; echo "
  • Store event information in Google Sheets.
  • "; echo "
  • Display sensor data using ThingSpeak.
  • "; echo "
  • Use AI Agent analysis for sensor events.
  • "; echo "
  • Automate workflows using n8n.
  • "; echo "
  • Predict future power consumption.
  • "; echo "
  • Provide a web-based IoT dashboard.
  • "; echo "
  • Support predictive maintenance.
  • "; echo "
"; /* =========================================================== 3. SYSTEM CONCEPT =========================================================== */ echo "

System Concept

"; echo "
";

echo "
REMOTE OPERATOR
      |
      v
WEB DASHBOARD + TELEGRAM
      |
      v
n8n AUTOMATION PLATFORM
      |
      +-----------------------+
      |                       |
      v                       v
AI AGENT              EVENT PROCESSING
      |                       |
      +-----------+-----------+
                  |
                  v
              ESP32 ROBOT
                  |
      +-----------+-----------+
      |           |           |
      v           v           v
THERMAL       PIR SENSOR   DISTANCE
SENSOR        MOTION        SENSOR
      |
      +-----------+-----------+
                  |
        +---------+---------+
        |                   |
        v                   v
      GPS          BATTERY MONITOR
        |
        v
   ENVIRONMENTAL SENSORS
";

echo "
"; /* =========================================================== 4. COMPONENTS LIST =========================================================== */ echo "

Hardware Components List

"; echo "

Main Controller

"; echo "
    "; echo "
  • ESP32 DevKit V1
  • "; echo "
  • ESP32-WROOM-32
  • "; echo "
  • ESP32-S3 for advanced processing
  • "; echo "
"; echo "

Thermal Vision

"; echo "
    "; echo "
  • AMG8833 Thermal Sensor
  • "; echo "
  • MLX90640 Thermal Sensor
  • "; echo "
  • Thermal Camera Module for advanced applications
  • "; echo "
"; echo "

Motion Detection

"; echo "
    "; echo "
  • HC-SR501 PIR Motion Sensor
  • "; echo "
"; echo "

Distance Measurement

"; echo "
    "; echo "
  • HC-SR04 Ultrasonic Sensor
  • "; echo "
"; echo "

GPS Tracking

"; echo "
    "; echo "
  • NEO-6M GPS Module
  • "; echo "
  • NEO-M8N GPS Module
  • "; echo "
"; echo "

Environmental Sensors

"; echo "
    "; echo "
  • DHT22 Temperature and Humidity Sensor
  • "; echo "
  • BME280 Temperature, Humidity and Pressure Sensor
  • "; echo "
  • Air Quality Sensors
  • "; echo "
  • Rain Sensor
  • "; echo "
  • Light Sensor
  • "; echo "
"; echo "

Battery Monitoring

"; echo "
    "; echo "
  • INA219 Current Sensor
  • "; echo "
  • INA226 Current Sensor
  • "; echo "
  • Voltage Divider
  • "; echo "
  • Rechargeable Battery Pack
  • "; echo "
  • Battery Management System
  • "; echo "
"; echo "

Motor System

"; echo "
    "; echo "
  • DC Geared Motors
  • "; echo "
  • Robot Wheels
  • "; echo "
  • L298N Motor Driver
  • "; echo "
  • TB6612FNG Motor Driver
  • "; echo "
  • BTS7960 High Current Motor Driver
  • "; echo "
"; echo "

Communication

"; echo "
    "; echo "
  • Wi-Fi Communication
  • "; echo "
  • 4G/LTE Communication
  • "; echo "
  • LoRa Communication
  • "; echo "
"; /* =========================================================== 5. CIRCUIT SCHEMATIC DIAGRAM =========================================================== */ echo "

Circuit Schematic Diagram

"; echo "
";

echo "
                         +----------------------+
                         |      ESP32 DEVKIT    |
                         |                      |
          +--------------| GPIO21 SDA          |
          |              | GPIO22 SCL          |
          |              | GPIO27              |
          |              | GPIO5               |
          |              | GPIO18              |
          |              | GPIO16 RX           |
          |              | GPIO17 TX           |
          |              | GPIO25              |
          |              | GPIO26              |
          |              | GPIO32              |
          |              | GPIO33              |
          |              +----------+-----------+
          |                         |
          |                         |
     +----v-----+             +-----v------+
     | Thermal  |             | INA219     |
     | Sensor   |             | Current    |
     +----------+             | Sensor     |
                               +------------+

     +-----------+        +--------------+
     | GPS       |        | Ultrasonic   |
     | NEO-6M    |        | HC-SR04      |
     +-----------+        +--------------+

                  +----------------+
                  | Motor Driver   |
                  | L298N/TB6612   |
                  +-------+--------+
                          |
                +---------+---------+
                |                   |
          +-----v-----+       +-----v-----+
          | Left Motor|       |Right Motor|
          +-----------+       +-----------+

                    BATTERY PACK
                         |
                 +-------v--------+
                 | Power Regulation|
                 | 5V / 3.3V       |
                 +----------------+
";

echo "
"; /* =========================================================== 6. ESP32 PIN CONNECTIONS =========================================================== */ echo "

ESP32 Pin Connections

"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
DevicePinESP32 GPIO
Thermal Sensor SDASDAGPIO 21
Thermal Sensor SCLSCLGPIO 22
PIR SensorOUTGPIO 27
Ultrasonic TriggerTRIGGPIO 5
Ultrasonic EchoECHOGPIO 18
GPS RXRXGPIO 16
GPS TXTXGPIO 17
Motor Driver IN1IN1GPIO 25
Motor Driver IN2IN2GPIO 26
Motor Driver IN3IN3GPIO 32
Motor Driver IN4IN4GPIO 33
"; /* =========================================================== 7. OPERATIONAL FLOWCHART =========================================================== */ echo "

Operational Flowchart

"; echo "
";

echo "
START
  |
  v
Initialize ESP32 Hardware
  |
  v
Connect Wi-Fi
  |
  v
Read Sensors
  |
  +----------------------------+
  |                            |
  v                            v
Thermal Data              Motion Data
  |                            |
  +-------------+--------------+
                |
                v
       Detect Thermal Anomaly?
                |
          +-----+-----+
          |           |
         NO          YES
          |           |
          |           v
          |     Check Motion
          |           |
          |           v
          |     Motion Detected?
          |           |
          |      +----+----+
          |      |         |
          |     NO        YES
          |      |         |
          |      v         v
          |    NORMAL   CREATE EVENT
          |                  |
          |                  v
          |             SEND TO n8n
          |                  |
          |                  v
          |              AI ANALYSIS
          |                  |
          |                  v
          |            EVENT PRIORITY
          |                  |
          |        +---------+---------+
          |        |                   |
          |        v                   v
          |     HIGH PRIORITY       NORMAL
          |        |                   |
          |        v                   v
          |     TELEGRAM            LOG DATA
          |     ALERT               TO CLOUD
          |        |
          |        v
          |     VOICE ALERT
          |
          v
      UPDATE DASHBOARD
          |
          v
      POWER ANALYSIS
          |
          v
      REPEAT LOOP
";

echo "
"; /* =========================================================== 8. ESP32 SOURCE CODE =========================================================== */ echo "

ESP32 Source Code

"; echo "
";

echo htmlspecialchars('
#include 
#include 
#include 
#include 
#include 

const char* WIFI_SSID = "YOUR_WIFI_NAME";
const char* WIFI_PASSWORD = "YOUR_WIFI_PASSWORD";

const char* N8N_WEBHOOK_URL =
"https://your-n8n-domain.com/webhook/border-surveillance";

#define PIR_PIN 27
#define TRIG_PIN 5
#define ECHO_PIN 18

Adafruit_AMG88xx thermal;

unsigned long lastSendTime = 0;

const unsigned long SEND_INTERVAL = 10000;

float readDistance()
{
    digitalWrite(TRIG_PIN, LOW);

    delayMicroseconds(2);

    digitalWrite(TRIG_PIN, HIGH);

    delayMicroseconds(10);

    digitalWrite(TRIG_PIN, LOW);

    long duration = pulseIn(ECHO_PIN, HIGH, 30000);

    float distance = duration * 0.034 / 2;

    return distance;
}

float calculateThermalAverage()
{
    float pixels[64];

    thermal.readPixels(pixels);

    float total = 0;

    for (int i = 0; i < 64; i++)
    {
        total += pixels[i];
    }

    return total / 64.0;
}

float calculateMaximumTemperature()
{
    float pixels[64];

    thermal.readPixels(pixels);

    float maximumTemperature = pixels[0];

    for (int i = 1; i < 64; i++)
    {
        if (pixels[i] > maximumTemperature)
        {
            maximumTemperature = pixels[i];
        }
    }

    return maximumTemperature;
}

void sendDataToN8N(
    float averageTemperature,
    float maximumTemperature,
    int motion,
    float distance
)
{
    if (WiFi.status() != WL_CONNECTED)
    {
        Serial.println("WiFi disconnected");

        return;
    }

    HTTPClient http;

    http.begin(N8N_WEBHOOK_URL);

    http.addHeader(
        "Content-Type",
        "application/json"
    );

    StaticJsonDocument<1024> json;

    json["device_id"] = "BORDER_ROBOT_001";

    json["average_temperature"] =
        averageTemperature;

    json["maximum_temperature"] =
        maximumTemperature;

    json["motion_detected"] =
        motion;

    json["distance_cm"] =
        distance;

    json["battery_voltage"] =
        11.8;

    json["battery_current"] =
        1.25;

    json["timestamp"] =
        millis();

    String payload;

    serializeJson(json, payload);

    int responseCode =
        http.POST(payload);

    Serial.print("n8n Response: ");

    Serial.println(responseCode);

    http.end();
}

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

    pinMode(PIR_PIN, INPUT);

    pinMode(TRIG_PIN, OUTPUT);

    pinMode(ECHO_PIN, INPUT);

    Wire.begin();

    if (!thermal.begin())
    {
        Serial.println(
            "Thermal sensor not detected"
        );

        while (true)
        {
            delay(1000);
        }
    }

    WiFi.begin(
        WIFI_SSID,
        WIFI_PASSWORD
    );

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

        Serial.print(".");
    }

    Serial.println();

    Serial.println(
        "WiFi Connected"
    );
}

void loop()
{
    if (
        millis() - lastSendTime
        >= SEND_INTERVAL
    )
    {
        lastSendTime = millis();

        int motionDetected =
            digitalRead(PIR_PIN);

        float averageTemperature =
            calculateThermalAverage();

        float maximumTemperature =
            calculateMaximumTemperature();

        float distance =
            readDistance();

        bool thermalEvent =
            maximumTemperature > 30.0;

        bool eventDetected =
            thermalEvent &&
            motionDetected == HIGH;

        if (eventDetected)
        {
            Serial.println(
                "THERMAL MOTION EVENT DETECTED"
            );

            sendDataToN8N(
                averageTemperature,
                maximumTemperature,
                motionDetected,
                distance
            );
        }
        else
        {
            Serial.println(
                "No significant event"
            );
        }
    }
}
');

echo "
"; /* =========================================================== 9. n8n WORKFLOW =========================================================== */ echo "

n8n Workflow

"; echo "
";

echo "
ESP32
  |
  v
WEBHOOK
  |
  v
VALIDATE JSON
  |
  v
CALCULATE CONFIDENCE
  |
  v
AI AGENT
  |
  v
EVENT CLASSIFICATION
  |
  +------------------+
  |                  |
  v                  v
HIGH PRIORITY      NORMAL
  |                  |
  v                  v
TELEGRAM ALERT    GOOGLE SHEETS
  |
  v
VOICE ALERT
  |
  v
THINGSPEAK UPDATE
  |
  v
WEB DASHBOARD
";

echo "
"; /* =========================================================== 10. n8n WORKFLOW JSON =========================================================== */ echo "

n8n Workflow JSON

"; echo "
";

echo htmlspecialchars('
{
  "name": "AI Border Surveillance Robot Automation",

  "nodes": [

    {
      "name": "ESP32 Webhook",

      "type":
      "n8n-nodes-base.webhook",

      "parameters": {

        "httpMethod": "POST",

        "path":
        "border-surveillance"

      }
    },

    {
      "name": "AI Event Scoring",

      "type":
      "n8n-nodes-base.code",

      "parameters": {

        "jsCode":

        "const data = $json.body || $json;

        let thermalScore = 0;

        let motionScore = 0;

        if (
          data.maximum_temperature >= 35
        )
        {
          thermalScore = 90;
        }
        else if (
          data.maximum_temperature >= 30
        )
        {
          thermalScore = 60;
        }
        else
        {
          thermalScore = 20;
        }

        if (
          data.motion_detected === 1
        )
        {
          motionScore = 90;
        }
        else
        {
          motionScore = 10;
        }

        const confidence =
          (thermalScore * 0.60) +
          (motionScore * 0.40);

        return [
          {
            json:
            {
              ...data,

              thermal_score:
              thermalScore,

              motion_score:
              motionScore,

              confidence_score:
              confidence,

              priority:
              confidence >= 75
              ? 'HIGH'
              : 'LOW'
            }
          }
        ];"
      }
    },

    {
      "name": "High Priority Event",

      "type":
      "n8n-nodes-base.if",

      "parameters": {

        "conditions": {

          "string": [

            {

              "value1":
              "={{$json.priority}}",

              "operation":
              "equal",

              "value2":
              "HIGH"

            }

          ]

        }

      }

    },

    {

      "name":
      "Telegram Alert",

      "type":
      "n8n-nodes-base.telegram",

      "parameters": {

        "text":

        "HIGH PRIORITY THERMAL EVENT

        Device:
        {{$json.device_id}}

        Maximum Temperature:
        {{$json.maximum_temperature}}

        Motion:
        {{$json.motion_detected}}

        Confidence:
        {{$json.confidence_score}}%"

      }

    }

  ]

}
');

echo "
"; /* =========================================================== 11. TELEGRAM BOT SETUP =========================================================== */ echo "

Telegram Bot Setup

"; echo "
    "; echo "
  1. Open Telegram.
  2. "; echo "
  3. Search for BotFather.
  4. "; echo "
  5. Send /start.
  6. "; echo "
  7. Send /newbot.
  8. "; echo "
  9. Enter a bot name.
  10. "; echo "
  11. Enter a unique bot username.
  12. "; echo "
  13. Copy the generated Bot Token.
  14. "; echo "
  15. Configure the token in n8n Credentials.
  16. "; echo "
  17. Send a message to the bot.
  18. "; echo "
  19. Find the authorized Telegram Chat ID.
  20. "; echo "
  21. Use the Chat ID in the n8n Telegram node.
  22. "; echo "
"; /* =========================================================== 12. TELEGRAM ALERT FORMAT =========================================================== */ echo "

Telegram Alert Format

"; echo "
";

echo "
AIoT SURVEILLANCE ALERT

Device:
BORDER_ROBOT_001

Event:
Thermal and Motion Anomaly

Maximum Temperature:
36.8 Celsius

Motion:
Detected

Confidence:
87 Percent

Battery:
11.8 Volts

Location:
GPS Coordinates Available

Status:
Operator Review Required
";

echo "
"; /* =========================================================== 13. VOICE NOTIFICATION AUTOMATION =========================================================== */ echo "

Voice Notification Automation

"; echo "
";

echo "
SENSOR EVENT
      |
      v
n8n WEBHOOK
      |
      v
AI AGENT
      |
      v
GENERATE ALERT TEXT
      |
      v
TEXT-TO-SPEECH SERVICE
      |
      v
GENERATE AUDIO
      |
      v
TELEGRAM SEND AUDIO
";

echo "
"; echo "

"; echo "Example voice message: Attention. A high-confidence thermal and motion anomaly has been detected. Please review the event using the monitoring dashboard."; echo "

"; /* =========================================================== 14. GOOGLE SHEETS INTEGRATION =========================================================== */ echo "

Google Sheets Integration

"; echo "

The Google Sheet can contain the following columns:

"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
TimestampDevice IDTemperatureMotionDistanceBatteryConfidencePriority
2026-07-20BORDER_ROBOT_00136.8Detected215 cm11.8 V87%HIGH
"; /* =========================================================== 15. THINGSPEAK DASHBOARD =========================================================== */ echo "

ThingSpeak Cloud Dashboard

"; echo "
    "; echo "
  • Field 1: Maximum Temperature
  • "; echo "
  • Field 2: Average Temperature
  • "; echo "
  • Field 3: Motion Status
  • "; echo "
  • Field 4: Distance
  • "; echo "
  • Field 5: Battery Voltage
  • "; echo "
  • Field 6: Battery Current
  • "; echo "
  • Field 7: Power Consumption
  • "; echo "
  • Field 8: AI Confidence Score
  • "; echo "
"; /* =========================================================== 16. AI POWER CONSUMPTION PREDICTION =========================================================== */ echo "

AI Power Consumption Prediction

"; echo "

"; echo "The system records battery voltage, battery current, motor activity, travel time, temperature, power consumption and robot operating conditions."; echo "

"; echo "

"; echo "Power consumption is calculated using the voltage and current measurements."; echo "

"; echo "

"; echo "Power = Voltage multiplied by Current"; echo "

"; echo "

"; echo "Energy = Power multiplied by Time"; echo "

"; echo "
";

echo "
BATTERY DATA
     |
     v
VOLTAGE + CURRENT
     |
     v
POWER CALCULATION
     |
     v
HISTORICAL DATA
     |
     v
AI PREDICTION
     |
     v
BATTERY RUNTIME ESTIMATION
     |
     v
MAINTENANCE ALERT
";

echo "
"; /* =========================================================== 17. POWER PREDICTION JAVASCRIPT FOR n8n =========================================================== */ echo "

Power Prediction Logic

"; echo "
";

echo htmlspecialchars('
const voltage =
    Number($json.battery_voltage);

const current =
    Number($json.battery_current);

const power =
    voltage * current;

const batteryCapacityWh =
    120;

const estimatedRuntimeHours =
    batteryCapacityWh / power;

let status =
    "NORMAL";

if (power > 30)
{
    status =
        "HIGH POWER CONSUMPTION";
}

if (
    estimatedRuntimeHours < 2
)
{
    status =
        "LOW ESTIMATED RUNTIME";
}

return [

    {

        json:
        {

            ...$json,

            power_watts:
            power,

            estimated_runtime_hours:
            estimatedRuntimeHours,

            power_status:
            status

        }

    }

];
');

echo "
"; /* =========================================================== 18. IOT WEBPAGE DASHBOARD =========================================================== */ echo "

IoT Webpage Dashboard

"; echo "
"; echo "

AI BORDER SURVEILLANCE ROBOT

"; echo "

Robot Status: ONLINE

"; echo "

Battery: 82%

"; echo "

Wi-Fi: CONNECTED

"; echo "

Thermal Temperature: 36.8 Celsius

"; echo "

Motion: DETECTED

"; echo "

AI Confidence: 87%

"; echo "

GPS Location Available

"; echo "

Power Consumption Monitoring Active

"; echo "
"; /* =========================================================== 19. FUTURE ENHANCEMENTS =========================================================== */ echo "

Future Enhancements

"; echo "
    "; echo "
  • Higher-resolution thermal cameras.
  • "; echo "
  • Edge AI processing.
  • "; echo "
  • 4G and LTE connectivity.
  • "; echo "
  • Solar charging system.
  • "; echo "
  • GPS geofencing.
  • "; echo "
  • Multi-robot coordination.
  • "; echo "
  • Predictive maintenance.
  • "; echo "
  • Offline data storage.
  • "; echo "
  • Secure firmware updates.
  • "; echo "
  • Advanced AI thermal classification.
  • "; echo "
  • Cloud-based analytics.
  • "; echo "
  • Battery health prediction.
  • "; echo "
"; /* =========================================================== 20. DEPLOYMENT GUIDE =========================================================== */ echo "

Deployment Guide

"; echo "

Phase 1: Laboratory Prototype

"; echo "

"; echo "Connect the ESP32, thermal sensor, PIR sensor, ultrasonic sensor, motor driver and battery monitoring circuit. Test all sensors individually."; echo "

"; echo "

Phase 2: IoT Integration

"; echo "

"; echo "Connect the ESP32 to n8n using a secure webhook. Configure Telegram, Google Sheets and ThingSpeak integrations."; echo "

"; echo "

Phase 3: Controlled Outdoor Testing

"; echo "

"; echo "Test the system in an authorized and controlled environment. Verify thermal detection, Wi-Fi range, battery runtime and sensor reliability."; echo "

"; echo "

Phase 4: Advanced Deployment

"; echo "

"; echo "Add cellular communication, solar power, advanced thermal cameras, edge AI and secure cloud infrastructure."; echo "

"; /* =========================================================== 21. SECURITY REQUIREMENTS =========================================================== */ echo "

Security Requirements

"; echo "
    "; echo "
  • Use HTTPS communication.
  • "; echo "
  • Protect API keys.
  • "; echo "
  • Use secure n8n credentials.
  • "; echo "
  • Use strong Wi-Fi passwords.
  • "; echo "
  • Restrict Telegram bot access.
  • "; echo "
  • Use authentication for the dashboard.
  • "; echo "
  • Use encrypted communication.
  • "; echo "
  • Maintain audit logs.
  • "; echo "
  • Use secure firmware update mechanisms.
  • "; echo "
  • Do not store passwords or tokens in public source code.
  • "; echo "
"; /* =========================================================== 22. COMPLETE PROJECT ARCHITECTURE =========================================================== */ echo "

Complete Project Architecture

"; echo "
";

echo "
THERMAL VISION
      |
      v
ESP32 ROBOT
      |
      +-------------------------+
      |                         |
      v                         v
SENSORS                    MOTOR CONTROL
      |
      v
Wi-Fi / 4G / LoRa
      |
      v
n8n AUTOMATION SERVER
      |
      +----------------------+
      |                      |
      v                      v
AI AGENT              POWER PREDICTION
      |
      +----------+-----------+
      |          |           |
      v          v           v
TELEGRAM   GOOGLE SHEETS  THINGSPEAK
      |          |           |
      v          v           v
VOICE       EVENT LOGS    CLOUD GRAPHS
      |
      v
WEB DASHBOARD
      |
      v
AUTHORIZED OPERATOR
";

echo "
"; /* =========================================================== 23. CONCLUSION =========================================================== */ echo "

Conclusion

"; echo "

"; echo "The AI-Based Smart Border Surveillance Robot with Thermal Vision combines ESP32, thermal sensing, IoT communication, AI Agent processing, n8n automation, Telegram alerts, voice notifications, Google Sheets logging, ThingSpeak cloud monitoring and AI power prediction."; echo "

"; echo "

"; echo "The complete system provides continuous remote monitoring, thermal anomaly detection, motion detection, automated cloud data logging, real-time notifications, voice alerts, power monitoring and predictive maintenance."; echo "

"; echo "

"; echo "The system is designed for authorized monitoring and inspection applications. Human operators should remain responsible for final decisions and response actions."; echo "

"; ?>

Friday, 17 July 2026

AI-Based Emotion Recognition Robot for Human Interaction

AI-Based Emotion Recognition Robot for Human Interaction Complete Project Documentation
AI-Based Emotion Recognition Robot - Complete Project Documentation

🤖 AI-Based Emotion Recognition Robot for Human Interaction

ESP32 + AI Agent + IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard

Complete Project Description, Components, Circuit Diagram, Flowchart, ESP32 Source Code, n8n Workflow, Telegram Integration, Google Sheets, ThingSpeak, AI Power Prediction and Deployment Guide

1. Project Overview

The AI-Based Emotion Recognition Robot for Human Interaction is an intelligent robotic system designed to recognize human emotional states and respond appropriately through voice, movement, display and IoT automation.

The system combines artificial intelligence, embedded systems, robotics, Internet of Things technology, cloud monitoring and workflow automation.

Complete Technology Stack:
  • ESP32 IoT Controller
  • AI Emotion Recognition
  • AI Agent Decision-Making
  • n8n Workflow Automation
  • Telegram Voice Notifications
  • Google Sheets Data Logging
  • ThingSpeak Cloud Dashboard
  • PHP IoT Web Dashboard
  • Power Consumption Monitoring
  • AI Power Consumption Prediction

2. Main Project Objective

The main objective of this project is to develop an intelligent human-interaction robot capable of recognizing human emotions and responding automatically.

The system detects emotions such as:

  • 😊 Happy
  • 😢 Sad
  • 😡 Angry
  • 😐 Neutral
  • 😨 Fear
  • 😲 Surprise
  • 😴 Tired or Sleepy

After detecting the emotional state, the robot analyzes the information using an AI Agent and performs a suitable action.

3. Complete System Architecture


                 +-------------------------+
                 |       HUMAN USER        |
                 | Face / Voice / Sensors  |
                 +------------+------------+
                              |
                              v
                 +-------------------------+
                 | EMOTION RECOGNITION    |
                 | AI Model / Camera /     |
                 | Voice Analysis          |
                 +------------+------------+
                              |
                              v
                 +-------------------------+
                 |      ESP32 CONTROLLER   |
                 |                         |
                 | Emotion Data            |
                 | Sensor Data             |
                 | Power Monitoring        |
                 +------------+------------+
                              |
                              | Wi-Fi
                              v
                 +-------------------------+
                 |       AI AGENT           |
                 | Emotion Interpretation   |
                 | Decision Making          |
                 +------------+------------+
                              |
                              v
                 +-------------------------+
                 |      n8n AUTOMATION      |
                 +-----+-----+-----+-------+
                       |     |     |
                       v     v     v
                 Telegram Google ThingSpeak
                  Voice    Sheets  Cloud
                  Alert    Logs    Dashboard
                       |
                       v
                 +-------------------------+
                 |       WEB DASHBOARD       |
                 | Emotion Status             |
                 | Robot Status              |
                 | Power Usage               |
                 | AI Prediction             |
                 +-------------------------+

4. Hardware Components

Component Function
ESP32 Development Board Main IoT controller
ESP32-CAM or Camera Module Facial emotion recognition
OLED Display Displays detected emotion
Microphone Module Voice and audio input
MAX98357A / DFPlayer Mini Audio output
Speaker Voice response
Servo Motors Robot head or hand movement
Motor Driver Controls DC motors
DC Motors Robot movement
Ultrasonic Sensor Obstacle detection
DHT22 / BME280 Temperature and humidity monitoring
INA219 Voltage and current measurement
Battery Power supply
LEDs Emotion indication
Buzzer Alert indication

5. ESP32 Pin Configuration


ESP32 GPIO 21  -> I2C SDA

ESP32 GPIO 22  -> I2C SCL

ESP32 GPIO 34  -> Analog Sensor Input

ESP32 GPIO 25  -> Servo Motor

ESP32 GPIO 26  -> Motor Driver IN1

ESP32 GPIO 27  -> Motor Driver IN2

ESP32 GPIO 32  -> Ultrasonic TRIG

ESP32 GPIO 33  -> Ultrasonic ECHO

ESP32 GPIO 4   -> Emotion LED

ESP32 GPIO 16  -> Audio RX

ESP32 GPIO 17  -> Audio TX

6. Circuit Schematic Diagram


                       +--------------------+
                       |       ESP32         |
                       |                    |
             SDA ------| GPIO 21            |
             SCL ------| GPIO 22            |
                       |                    |
 Emotion LED ----------| GPIO 4             |
                       |                    |
 Servo Signal ---------| GPIO 25            |
                       |                    |
 Motor IN1 ------------| GPIO 26            |
 Motor IN2 ------------| GPIO 27            |
                       |                    |
 Ultrasonic TRIG ------| GPIO 32            |
 Ultrasonic ECHO ------| GPIO 33            |
                       |                    |
 INA219 SDA -----------| GPIO 21            |
 INA219 SCL -----------| GPIO 22            |
                       +---------+----------+
                                 |
              +------------------+----------------+
              |                  |                |
              v                  v                v
       +--------------+   +-------------+  +-------------+
       | OLED Display |   | INA219      |  | BME280      |
       |              |   | Power       |  | Environment |
       +--------------+   | Sensor      |  +-------------+
                          +-------------+

                 +------------------+
                 | Camera / AI      |
                 | Emotion Module   |
                 +---------+--------+
                           |
                           v
                    +-------------+
                    | Emotion     |
                    | Detection   |
                    +-------------+

        ESP32 -------- Wi-Fi -------- Internet
                                         |
                +------------------------+--------------------+
                |                        |                    |
                v                        v                    v
             n8n Server              ThingSpeak           Web Server
                |
       +--------+----------+---------+
       |                   |         |
       v                   v         v
   Telegram            Google     AI Agent
   Voice Alert         Sheets

7. Complete Working Principle

Step 1: Human Interaction

The user interacts with the robot by looking at the robot, speaking to the robot, showing facial expressions or asking questions.

Step 2: Emotion Detection

The camera or AI emotion-recognition system analyzes the facial expression and identifies the emotional state.


{
    "emotion": "happy",
    "confidence": 0.94
}

Step 3: ESP32 Processing

The ESP32 receives the emotion data and combines it with sensor information.


Emotion       = SAD

Confidence    = 89%

Temperature   = 29.5 °C

Battery       = 7.4 V

Current       = 320 mA

Step 4: AI Agent Decision

The AI Agent analyzes the emotion and generates an appropriate response.


Input:

Emotion = Sad

Confidence = 89%


AI Output:

Response = "You seem a little sad. I am here with you."

Action = Comfort Mode

Robot Movement = Slow Head Movement

Alert Level = Medium

Step 5: n8n Automation

The ESP32 sends the information to the n8n webhook. n8n processes the data and automatically performs multiple actions.

  • Receives ESP32 data
  • Processes JSON
  • Sends data to AI Agent
  • Generates intelligent response
  • Sends Telegram notification
  • Generates voice notification
  • Stores data in Google Sheets
  • Uploads data to ThingSpeak
  • Updates the IoT web dashboard

8. Complete System Flowchart


                 +-------------+
                 |    START    |
                 +------+------+
                        |
                        v
                 +-------------+
                 | Initialize  |
                 | ESP32       |
                 +------+------+
                        |
                        v
                 +-------------+
                 | Connect WiFi|
                 +------+------+
                        |
                        v
                 +-------------+
                 | Capture Face|
                 | Voice Data  |
                 +------+------+
                        |
                        v
                 +-------------+
                 | Detect      |
                 | Emotion     |
                 +------+------+
                        |
                        v
              +---------------------+
              | Confidence > 60% ?  |
              +----------+----------+
                         |
                +--------+--------+
                |                 |
               NO                YES
                |                 |
                v                 v
        +---------------+  +--------------+
        | Retry Capture |  | Send ESP32   |
        +---------------+  | Emotion Data |
                           +------+-------+
                                  |
                                  v
                           +--------------+
                           | n8n Webhook  |
                           +------+-------+
                                  |
                                  v
                           +--------------+
                           | AI Agent     |
                           | Decision     |
                           +------+-------+
                                  |
                 +----------------+----------------+
                 |                |               |
                 v                v               v
            Telegram         Google Sheets     ThingSpeak
            Voice Alert      Data Logging      Cloud
                 |                |               |
                 +----------------+---------------+
                                  |
                                  v
                           +--------------+
                           | Robot        |
                           | Response     |
                           +------+-------+
                                  |
                                  v
                           +--------------+
                           | Continue Loop|
                           +--------------+

9. Emotion Recognition Logic

The emotion-recognition system may use one of the following architectures.

Option A: Cloud AI


Camera
   |
   v
ESP32-CAM
   |
   v
AI API
   |
   v
Emotion Result
   |
   v
ESP32

Option B: Edge AI


Camera
   |
   v
ESP32-S3 / Edge AI Model
   |
   v
Emotion Result

Option C: Computer Vision Computer


Camera
   |
   v
Python AI Computer
   |
   v
Emotion Detection
   |
   v
ESP32

10. Emotion Response Table

Emotion AI Response Robot Action Alert Level
Happy Encouraging message Fast movement Low
Sad Supportive message Slow movement Medium
Angry Calm response Stop movement High
Fear Reassurance Approach slowly High
Surprise Ask what happened Head movement Low
Neutral Greeting Normal operation Low

11. ESP32 Source Code



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

const char* WIFI_SSID = "YOUR_WIFI_NAME";

const char* WIFI_PASSWORD =
"YOUR_WIFI_PASSWORD";

const char* N8N_WEBHOOK =
"https://YOUR_N8N_SERVER/webhook/emotion-robot";

#define EMOTION_LED 4;

float voltage = 7.4;

float current = 0.32;

float power = 0.0;


void setup() {

    Serial.begin(115200);

    pinMode(
        EMOTION_LED,
        OUTPUT
    );

    WiFi.begin(
        WIFI_SSID,
        WIFI_PASSWORD
    );

    Serial.print(
        "Connecting to WiFi"
    );

    while (
        WiFi.status()
        != WL_CONNECTED
    ) {

        delay(500);

        Serial.print(".");

    }

    Serial.println();

    Serial.println(
        "WiFi Connected"
    );

    Serial.println(
        WiFi.localIP()
    );

}


void loop() {

    String emotion =
        detectEmotion();

    float confidence =
        0.92;

    power =
        voltage * current;

    sendEmotionData(
        emotion,
        confidence,
        voltage,
        current,
        power
    );

    delay(30000);

}


String detectEmotion() {

    String emotions[] = {

        "happy",

        "sad",

        "neutral",

        "angry",

        "surprise"

    };

    int index =
        random(0, 5);

    return emotions[index];

}


void sendEmotionData(

    String emotion,

    float confidence,

    float voltage,

    float current,

    float power

) {

    if (

        WiFi.status()
        == WL_CONNECTED

    ) {

        HTTPClient http;

        http.begin(
            N8N_WEBHOOK
        );

        http.addHeader(

            "Content-Type",

            "application/json"

        );

        DynamicJsonDocument doc(
            1024
        );

        doc["device_id"] =
            "EMOTION_ROBOT_001";

        doc["emotion"] =
            emotion;

        doc["confidence"] =
            confidence;

        doc["voltage"] =
            voltage;

        doc["current"] =
            current;

        doc["power"] =
            power;

        doc["robot_status"] =
            "ONLINE";

        String jsonData;

        serializeJson(
            doc,
            jsonData
        );

        int responseCode =
            http.POST(
                jsonData
            );

        Serial.println(
            "HTTP Response:"
        );

        Serial.println(
            responseCode
        );

        http.end();

    }

}

12. ESP32 JSON Data Format


{
    "device_id":
    "EMOTION_ROBOT_001",

    "emotion":
    "sad",

    "confidence":
    0.89,

    "temperature":
    29.5,

    "humidity":
    58,

    "battery_voltage":
    7.42,

    "current":
    0.32,

    "power_watt":
    2.38,

    "robot_status":
    "ONLINE",

    "location":
    "LAB",

    "timestamp":
    "2026-07-18T07:30:00"
}

13. AI Agent Logic

The AI Agent receives the emotion information and produces an intelligent response.

AI Agent Input


Emotion: SAD

Confidence: 89%

Battery: 7.42 V

Power: 2.38 W

AI Agent Prompt


You are an intelligent emotional interaction robot.

Analyze the following emotion:

Emotion: {{$json.emotion}}

Confidence: {{$json.confidence}}

Generate:

1. A short supportive response.

2. A robot action.

3. An alert level.

4. A suggested voice tone.

Return JSON only.

AI Agent Output


{
    "message":
    "You seem a little sad. I am here to talk with you.",

    "robot_action":
    "COMFORT_MODE",

    "alert_level":
    "MEDIUM",

    "voice_tone":
    "CALM"
}

14. n8n Workflow Architecture


+------------------+
| ESP32 Webhook    |
+--------+---------+
         |
         v
+------------------+
| JSON Parser      |
+--------+---------+
         |
         v
+------------------+
| AI Agent         |
| Emotion Analysis |
+--------+---------+
         |
         v
+------------------+
| IF Node          |
| Emotion Type     |
+----+--------+----+
     |        |
     v        v
  Happy      Sad
     |        |
     +--------+---------+
              |
              v
     +----------------+
     | Telegram Alert |
     +----------------+
              |
              v
     +----------------+
     | Voice Message   |
     +----------------+
              |
              v
     +----------------+
     | Google Sheets   |
     +----------------+
              |
              v
     +----------------+
     | ThingSpeak      |
     +----------------+
              |
              v
     +----------------+
     | Web Dashboard   |
     +----------------+

15. n8n Workflow JSON



{
  "name":
  "AI Emotion Recognition Robot",

  "nodes": [

    {

      "parameters": {

        "httpMethod":
        "POST",

        "path":
        "emotion-robot",

        "responseMode":
        "onReceived"

      },

      "name":
      "ESP32 Webhook",

      "type":
      "n8n-nodes-base.webhook"

    },

    {

      "parameters": {

        "jsCode":

"const data = $json.body || $json;

return [{

json: {

device_id:
data.device_id,

emotion:
data.emotion,

confidence:
data.confidence,

voltage:
data.voltage,

current:
data.current,

power:
data.power,

robot_status:
data.robot_status,

timestamp:
new Date().toISOString()

}

}];"

      },

      "name":
      "Process Emotion Data",

      "type":
      "n8n-nodes-base.code"

    },

    {

      "parameters": {

        "method":
        "POST",

        "url":
        "YOUR_AI_AGENT_ENDPOINT",

        "sendBody":
        true,

        "specifyBody":
        "json",

        "jsonBody":

"={

\"emotion\":
\"{{$json.emotion}}\",

\"confidence\":
\"{{$json.confidence}}\",

\"power\":
\"{{$json.power}}\"

}"

      },

      "name":
      "AI Emotion Agent",

      "type":
      "n8n-nodes-base.httpRequest"

    },

    {

      "parameters": {

        "operation":
        "append",

        "documentId":
        "YOUR_GOOGLE_SHEET_ID",

        "sheetName":
        "EmotionLogs"

      },

      "name":
      "Google Sheets Log",

      "type":
      "n8n-nodes-base.googleSheets"

    },

    {

      "parameters": {

        "chatId":
        "YOUR_TELEGRAM_CHAT_ID",

        "text":

"🤖 Emotion Robot Alert

Emotion:
{{$json.emotion}}

Confidence:
{{$json.confidence}}

Power:
{{$json.power}} W"

      },

      "name":
      "Telegram Alert",

      "type":
      "n8n-nodes-base.telegram"

    }

  ]

}

16. Telegram Bot Setup

Open Telegram and search for BotFather.


/newbot

Create a bot name such as:


Emotion Robot AI Bot

Telegram generates a bot token.


BOT_TOKEN

The token must be kept private.

The Telegram bot is used for:

  • Emotion alerts
  • Robot status alerts
  • Battery alerts
  • Power consumption alerts
  • AI voice notifications

17. Telegram Voice Notification Automation


Emotion Detected

       |

       v

AI Generates Message

       |

       v

Text-to-Speech

       |

       v

Audio File

       |

       v

Telegram Voice Message

Example:


Emotion: SAD

AI Message:

"You seem a little sad.
I am here to support you."

18. Google Sheets Integration

Create a Google Sheet named:


EmotionLogs

Timestamp Device ID Emotion Confidence Temperature Battery Current Power AI Response
2026-07-18 EMOTION_ROBOT_001 Happy 94% 29.5 °C 7.42 V 0.32 A 2.38 W You look happy today!

19. ThingSpeak Cloud Dashboard

Recommended ThingSpeak fields:


Field 1: Emotion Code

Field 2: Emotion Confidence

Field 3: Temperature

Field 4: Humidity

Field 5: Battery Voltage

Field 6: Current

Field 7: Power Consumption

Field 8: Robot Status

Emotion code example:


1 = Happy

2 = Sad

3 = Angry

4 = Neutral

5 = Fear

6 = Surprise

20. PHP IoT Web Dashboard



<?php

$emotion = "HAPPY";

$confidence = 94;

$temperature = 29.5;

$humidity = 58;

$battery = 7.42;

$power = 2.38;

$status = "ONLINE";

?>

<!DOCTYPE html>

<html>

<head>

<title>

AI Emotion Recognition Robot

</title>

</head>

<body>

<h1>

🤖 AI Emotion Recognition Robot

</h1>

<p>

Current Emotion:

<?php echo $emotion; ?>

</p>

<p>

Confidence:

<?php echo $confidence; ?>%

</p>

<p>

Temperature:

<?php echo $temperature; ?> °C

</p>

<p>

Humidity:

<?php echo $humidity; ?>%

</p>

<p>

Battery:

<?php echo $battery; ?> V

</p>

<p>

Power:

<?php echo $power; ?> W

</p>

<p>

Robot Status:

<?php echo $status; ?>

</p>

</body>

</html>

21. Power Consumption Monitoring


Battery

   |

   v

INA219 Sensor

   |

   v

ESP32

   |

   v

Power Calculation

Power is calculated using voltage and current measurement.


Power = Voltage x Current

Example:


Voltage = 7.42 V

Current = 0.32 A

Power = 7.42 x 0.32

Power = 2.37 W

22. AI Power Consumption Prediction

Historical power data is stored in Google Sheets or a cloud database. The AI system analyzes the historical data to predict future power consumption.


Time       Power

08:00      2.1 W

09:00      2.4 W

10:00      2.8 W

11:00      3.1 W

The AI Agent can identify increasing power consumption and generate an alert.


Power usage is increasing.

Expected power consumption
in the next hour = 3.4 W

23. Power Prediction Flowchart


+----------------+
| Power Sensor   |
+-------+--------+
        |
        v
+----------------+
| Collect Data   |
+-------+--------+
        |
        v
+----------------+
| Store History  |
+-------+--------+
        |
        v
+----------------+
| AI Analysis    |
+-------+--------+
        |
        v
+----------------+
| Predict Power  |
+-------+--------+
        |
        v
+----------------+
| Alert if High  |
+----------------+

24. Complete Data Flow


        HUMAN

          |

          v

    +-------------+

    | Camera      |

    | Microphone  |

    +------+------+ 

           |

           v

    +-------------+

    | AI Emotion  |

    | Recognition |

    +------+------+ 

           |

           v

    +-------------+

    | ESP32       |

    | Controller  |

    +------+------+ 

           |

           v

    +-------------+

    | Wi-Fi       |

    +------+------+ 

           |

           v

    +-------------+

    | n8n         |

    | Automation  |

    +------+------+ 

           |

      +----+----+---------+---------+

      |         |         |         |

      v         v         v         v

     AI      Telegram  Google   ThingSpeak

    Agent     Voice     Sheets    Cloud

               Alert

                |

                v

        +---------------+

        | Robot Response |

        +---------------+

25. Real-Time Example

Scenario: User Shows a Sad Expression


Camera:

Emotion = SAD

Confidence = 89%

ESP32 sends:


{

    "emotion": "sad",

    "confidence": 0.89

}

AI Agent generates:


"You seem a little sad.

I am here to talk with you."

Robot action:


Movement = Slow Head Movement

Voice = Calm

LED = Sad Indication

Telegram alert:


🤖 Emotion Alert

Emotion: SAD

Confidence: 89%

AI Action: COMFORT_MODE

26. Advantages

  • Human-friendly robotic interaction
  • Real-time emotion recognition
  • AI-powered decision making
  • IoT cloud connectivity
  • Automated Telegram notifications
  • Voice alerts
  • Google Sheets data storage
  • ThingSpeak visualization
  • Power consumption analysis
  • Expandable architecture
  • Remote monitoring
  • Suitable for academic research

27. Applications

  • Healthcare assistance
  • Elderly care
  • Education
  • Smart homes
  • Social robotics
  • Customer service
  • Human-robot interaction research
  • Emotional wellness support

This system should not be considered a medical diagnostic device.

28. Future Enhancements

  1. Multi-language voice interaction
  2. Advanced facial emotion recognition
  3. Voice emotion recognition
  4. Human identity recognition
  5. Personalized AI behavior
  6. Long-term emotion history analysis
  7. Reinforcement learning
  8. Edge AI processing
  9. Autonomous navigation
  10. Object recognition
  11. Human activity recognition
  12. Mobile application
  13. Mobile push notifications
  14. Cloud-based AI model training
  15. Battery health prediction
  16. Solar charging
  17. Multi-robot communication
  18. Offline AI operation
  19. Advanced speech recognition
  20. Personalized emotional memory

29. Deployment Guide

Hardware Deployment

  1. Assemble ESP32 circuit.
  2. Connect camera module.
  3. Connect sensors.
  4. Connect motor driver.
  5. Connect audio module.
  6. Connect battery.
  7. Test each component individually.

Software Deployment

  1. Install Arduino IDE.
  2. Install ESP32 Board Package.
  3. Install required libraries.
  4. Upload ESP32 firmware.
  5. Configure Wi-Fi.
  6. Create Telegram Bot.
  7. Configure n8n.
  8. Create Google Sheet.
  9. Create ThingSpeak channel.
  10. Deploy PHP dashboard.
  11. Test complete system.

30. Testing Procedure

ESP32 Testing


✓ ESP32 boots

✓ Wi-Fi connects

✓ IP address received

Sensor Testing


✓ Camera works

✓ Temperature sensor works

✓ Power sensor works

✓ Ultrasonic sensor works

Emotion Testing


Happy

Sad

Angry

Neutral

Surprise

n8n Testing


✓ Webhook receives data

✓ AI Agent responds

✓ Telegram notification works

✓ Google Sheets receives data

✓ ThingSpeak receives data

31. Final Project Summary

The AI-Based Emotion Recognition Robot for Human Interaction is a complete AI-powered Agentic IoT project that combines embedded systems, artificial intelligence, robotics, automation and cloud services.


AI Emotion Recognition

        +

ESP32 IoT Controller

        +

AI Agent

        +

n8n Automation

        +

Telegram Voice Alerts

        +

Google Sheets

        +

ThingSpeak Cloud

        +

PHP IoT Dashboard

        +

Power Prediction

The complete system follows the intelligent process:

SENSE → UNDERSTAND → DECIDE → RESPOND → NOTIFY → RECORD → PREDICT

AI-Based Emotion Recognition Robot for Human Interaction

ESP32 + AI Agent + n8n + Telegram + Google Sheets + ThingSpeak + PHP IoT Dashboard

AI-Based Autonomous Line Following Delivery Robot

AI-Based Autonomous Line-Following Delivery Robot ESP32 + AI Agent + IoT Web Dashboard + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Below is a complete project documentation structure suitable for a final-year engineering project, academic project report, prototype demonstration, or product development.
AI-Based Autonomous Line-Following Delivery Robot

AI-Based Autonomous Line-Following Delivery Robot

ESP32 + AI Agent + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak

AI-Powered ESP32 Agentic IoT Autonomous Robot Cloud Dashboard

1. Full Project Description

The AI-Based Autonomous Line-Following Delivery Robot is an intelligent robotic system designed to transport small packages autonomously along a predefined line path.

The robot uses an ESP32 microcontroller as its central processing unit. An IR sensor array detects and follows the path, while ultrasonic sensors detect obstacles and prevent collisions.

The system is connected to the Internet through Wi-Fi and uses an Agentic IoT architecture based on n8n automation. Sensor data, robot status, battery level, power consumption, delivery events, and obstacle information are transmitted to cloud services.

The n8n automation workflow processes the incoming data and automatically performs actions such as Telegram notifications, Telegram voice alerts, Google Sheets data logging, ThingSpeak dashboard updates, and AI-based power consumption prediction.

Project Objective

  • Develop an autonomous line-following delivery robot.
  • Detect and avoid obstacles automatically.
  • Monitor robot status remotely through IoT.
  • Send real-time Telegram notifications.
  • Generate Telegram voice alerts.
  • Store historical data in Google Sheets.
  • Display sensor data on ThingSpeak.
  • Use AI to predict power consumption.
  • Provide a web-based IoT monitoring dashboard.

2. Problem Statement

Traditional short-distance delivery systems require human operators. This increases labor requirements, delivery time, and operational cost. The proposed robot provides an autonomous solution for transporting small packages in indoor environments such as hospitals, warehouses, offices, laboratories, and educational campuses.

3. Proposed Solution

+-------------------------------------------------------+ | AUTONOMOUS DELIVERY ROBOT | | | | IR Sensors -----------+ | | | | | Ultrasonic Sensors ---+--> ESP32 --> Motor Driver | | | | | | Battery Sensor -------+ +--> Motors | | | | Servo Delivery Box | +---------------------------+---------------------------+ | | Wi-Fi v +---------------+ | n8n Automation | +-------+-------+ | +-----------------+------------------+ | | | v v v Telegram Google Sheets ThingSpeak Voice Alert Data Logging Cloud Dashboard | v AI Agent | v Power Prediction Smart Decisions

4. Components List

Component Quantity Purpose
ESP32 Development Board 1 Main controller and Wi-Fi connectivity
IR Line Sensor Array 1 Line detection
Ultrasonic Sensor 1 or 2 Obstacle detection
Motor Driver 1 DC motor control
DC Geared Motors 2 or 4 Robot movement
Robot Chassis 1 Mechanical structure
Servo Motor 1 Delivery box mechanism
Rechargeable Battery 1 Power supply
Voltage Regulator 1 Stable power supply
Buzzer 1 Local warning
LED Indicators Several Status indication
n8n Automation 1 Workflow automation
Telegram Bot 1 Notifications and voice alerts
Google Sheets 1 Cloud data logging
ThingSpeak 1 IoT visualization

5. System Architecture

+---------------------------------------------------------+ | ROBOT HARDWARE | | | | IR Sensor Array | | Ultrasonic Sensor | | Battery Sensor | | Delivery Sensor | | | | | v | | ESP32 | | | | | v | | Motor Driver | | | | | v | | DC Motors | +-------------------------+-------------------------------+ | | Wi-Fi v +----------------+ | n8n Automation | +-------+--------+ | +-----------------+------------------+ | | | v v v AI Agent Telegram Google Sheets | Alerts Logging | v Power Prediction | v ThingSpeak Dashboard

6. Circuit Schematic Diagram

``` +----------------+ | BATTERY | +-------+--------+ | +--------------+--------------+ | | v v +-------------+ +--------------+ | Motor | | Voltage | | Driver | | Regulator | +------+------+ +------+-------+ | | v v DC Motors ESP32 | +-----------------------------+ | +------+------+------+------+------+ | | | | | v v v v v IR1 IR2 IR3 IR4 IR5 Ultrasonic Sensor | v ESP32 Servo Motor | v ESP32 ```

ESP32 Pin Configuration

Device ESP32 Pin
IR Sensor 1 GPIO 32
IR Sensor 2 GPIO 33
IR Sensor 3 GPIO 34
IR Sensor 4 GPIO 35
IR Sensor 5 GPIO 36
Motor IN1 GPIO 25
Motor IN2 GPIO 26
Motor IN3 GPIO 27
Motor IN4 GPIO 14
Motor ENA GPIO 13
Motor ENB GPIO 12
Ultrasonic TRIG GPIO 5
Ultrasonic ECHO GPIO 18
Servo GPIO 23

7. System Flowchart

``` +---------+ | START | +----+----+ | v +----------------+ | Initialize ESP32| +--------+-------+ | v +----------------+ | Connect Wi-Fi | +--------+-------+ | v +----------------+ | Read Sensors | +--------+-------+ | v +----------------+ | Obstacle Found?| +----+-------+---+ | | YES NO | | v v Stop Read Line Robot | | v | Calculate Error | | | v | Motor Control | | +---------+ | v Destination? | +----+----+ | | NO YES | | | v | Stop Robot | | | v | Open Delivery Box | | | v | Delivery Completed | | +---------+ | v Send Cloud Data ```

8. Operating Principle

  1. Power ON the robot.
  2. ESP32 initializes all sensors and actuators.
  3. ESP32 connects to Wi-Fi.
  4. IR sensors detect the line.
  5. The ESP32 calculates the line position.
  6. Motor speed is adjusted to follow the line.
  7. Ultrasonic sensors continuously detect obstacles.
  8. If an obstacle is detected, the robot stops.
  9. n8n receives the robot status through a webhook.
  10. n8n sends Telegram and voice notifications.
  11. Robot data is stored in Google Sheets.
  12. ThingSpeak displays cloud data.
  13. AI predicts future power consumption.

9. ESP32 Source Code

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

const char* ssid = "YOUR_WIFI_NAME";
const char* password = "YOUR_WIFI_PASSWORD";

const char* webhookURL =
"https://YOUR_N8N_DOMAIN/webhook/robot-data";

#define IN1 25
#define IN2 26
#define IN3 27
#define IN4 14

#define ENA 13
#define ENB 12

#define IR1 32
#define IR2 33
#define IR3 34
#define IR4 35
#define IR5 36

#define TRIG_PIN 5
#define ECHO_PIN 18

#define SERVO_PIN 23

Servo deliveryServo;

unsigned long lastSendTime = 0;

void setup() {

    Serial.begin(115200);

    pinMode(IN1, OUTPUT);
    pinMode(IN2, OUTPUT);
    pinMode(IN3, OUTPUT);
    pinMode(IN4, OUTPUT);

    pinMode(ENA, OUTPUT);
    pinMode(ENB, OUTPUT);

    pinMode(IR1, INPUT);
    pinMode(IR2, INPUT);
    pinMode(IR3, INPUT);
    pinMode(IR4, INPUT);
    pinMode(IR5, INPUT);

    pinMode(TRIG_PIN, OUTPUT);
    pinMode(ECHO_PIN, INPUT);

    deliveryServo.attach(SERVO_PIN);
    deliveryServo.write(0);

    WiFi.begin(ssid, password);

    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
    }

    Serial.println("Wi-Fi Connected");
}

long getDistance() {

    digitalWrite(TRIG_PIN, LOW);
    delayMicroseconds(2);

    digitalWrite(TRIG_PIN, HIGH);
    delayMicroseconds(10);

    digitalWrite(TRIG_PIN, LOW);

    long duration = pulseIn(ECHO_PIN, HIGH, 30000);

    long distance = duration * 0.034 / 2;

    return distance;
}

void stopMotors() {

    digitalWrite(IN1, LOW);
    digitalWrite(IN2, LOW);

    digitalWrite(IN3, LOW);
    digitalWrite(IN4, LOW);
}

void moveForward() {

    digitalWrite(IN1, HIGH);
    digitalWrite(IN2, LOW);

    digitalWrite(IN3, HIGH);
    digitalWrite(IN4, LOW);

    analogWrite(ENA, 180);
    analogWrite(ENB, 180);
}

void turnLeft() {

    digitalWrite(IN1, LOW);
    digitalWrite(IN2, LOW);

    digitalWrite(IN3, HIGH);
    digitalWrite(IN4, LOW);

    analogWrite(ENA, 100);
    analogWrite(ENB, 200);
}

void turnRight() {

    digitalWrite(IN1, HIGH);
    digitalWrite(IN2, LOW);

    digitalWrite(IN3, LOW);
    digitalWrite(IN4, LOW);

    analogWrite(ENA, 200);
    analogWrite(ENB, 100);
}

void lineFollowing() {

    int s1 = digitalRead(IR1);
    int s2 = digitalRead(IR2);
    int s3 = digitalRead(IR3);
    int s4 = digitalRead(IR4);
    int s5 = digitalRead(IR5);

    if (s3 == LOW) {
        moveForward();
    }

    else if (s1 == LOW || s2 == LOW) {
        turnLeft();
    }

    else if (s4 == LOW || s5 == LOW) {
        turnRight();
    }

    else {
        stopMotors();
    }
}

void sendTelemetry(String status) {

    if (WiFi.status() == WL_CONNECTED) {

        HTTPClient http;

        http.begin(webhookURL);

        http.addHeader(
            "Content-Type",
            "application/json"
        );

        StaticJsonDocument<512> doc;

        doc["robot_id"] = "ROBOT_001";
        doc["status"] = status;
        doc["distance"] = getDistance();
        doc["wifi_rssi"] = WiFi.RSSI();
        doc["timestamp"] = millis();

        String jsonData;

        serializeJson(doc, jsonData);

        http.POST(jsonData);

        http.end();
    }
}

void loop() {

    long distance = getDistance();

    if (distance > 0 && distance < 20) {

        stopMotors();

        sendTelemetry(
            "OBSTACLE_DETECTED"
        );

        delay(2000);
    }

    else {

        lineFollowing();
    }

    if (millis() - lastSendTime > 10000) {

        sendTelemetry(
            "ROBOT_RUNNING"
        );

        lastSendTime = millis();
    }

    delay(50);
}

10. n8n Automation Workflow

ESP32 | v Webhook | v Read JSON Data | v Check Robot Status | +---- OBSTACLE DETECTED | | | v | Telegram Alert | | | v | Voice Notification | +---- LOW BATTERY | | | v | Telegram Warning | +---- DELIVERY COMPLETED | v Google Sheets | v ThingSpeak Update

Example n8n Workflow JSON

{
  "name": "AI Delivery Robot Automation",

  "nodes": [

    {
      "name": "ESP32 Webhook",
      "type": "n8n-nodes-base.webhook",
      "parameters": {
        "path": "robot-data",
        "httpMethod": "POST"
      }
    },

    {
      "name": "Robot Status",
      "type": "n8n-nodes-base.if",
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json.status}}",
              "operation": "equal",
              "value2": "OBSTACLE_DETECTED"
            }
          ]
        }
      }
    },

    {
      "name": "Telegram Alert",
      "type": "n8n-nodes-base.telegram",
      "parameters": {
        "text": "Obstacle detected. Robot stopped."
      }
    },

    {
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "parameters": {
        "operation": "append"
      }
    }

  ]

}

11. Telegram Bot Setup

  1. Open Telegram.
  2. Create a new bot.
  3. Copy the Bot Token.
  4. Send a message to the bot.
  5. Configure the Telegram node in n8n.
  6. Enter the Chat ID.
  7. Send automated notifications.

Example Telegram Message

🚨 AI DELIVERY ROBOT ALERT

Robot: ROBOT_001

Status: OBSTACLE DETECTED

Distance: 12 cm

Battery: 67%

Action:
Robot stopped automatically.

12. Telegram Voice Notification Automation

Robot Event | v n8n Workflow | v Generate Alert Text | v Text-to-Speech | v Audio File | v Telegram Voice Message

Example voice message:

"Attention. The autonomous delivery robot has detected an obstacle and has stopped."

13. Google Sheets Integration

Google Sheets is used as a cloud-based data logging platform.

Timestamp Robot ID Status Battery Distance Power Event
10:00 ROBOT_001 RUNNING 90% 40 cm 8.4 W Normal
10:05 ROBOT_001 OBSTACLE 86% 15 cm 9.8 W Warning
10:20 ROBOT_001 DELIVERED 72% 0 cm 7.2 W Complete

14. ThingSpeak Cloud Dashboard

ThingSpeak can display real-time sensor and robot data.

  • Battery Voltage
  • Battery Percentage
  • Motor Current
  • Power Consumption
  • Robot Speed
  • Distance
  • Obstacle Count
  • Delivery Status
ESP32 | v ThingSpeak API | v Cloud Channel | v Charts and Graphs | v Remote Monitoring

15. AI Power Consumption Prediction

The AI system analyzes historical energy consumption and predicts future power requirements.

Input Features

  • Battery Voltage
  • Motor Current
  • Robot Speed
  • Payload Weight
  • Distance Travelled
  • Runtime
  • Obstacle Count
  • Battery Level

Power Calculation

Power = Voltage × Current

Example:

Power = 7.4 × 1.2

Power = 8.88 Watts

AI Decision Logic

IF current consumption > historical average
THEN
    Predict reduced battery runtime

IF battery < 20%
THEN
    Generate LOW BATTERY alert

IF power increases continuously
THEN
    Detect possible motor or mechanical problem

16. AI Agent Decision System

Sensor Data | v ESP32 | v n8n Automation | v AI Agent | v Analyze Current State | +------------------+ | | v v Normal Operation Abnormal Condition | | v v Continue Robot Smart Decision | +---------+---------+ | | | v v v Telegram Stop Robot Log Data

17. Safety Features

  • Emergency stop button.
  • Automatic obstacle detection.
  • Low-battery protection.
  • Motor overload protection.
  • Wi-Fi communication failure handling.
  • Safe mode operation.
  • Automatic robot stop during abnormal conditions.

18. Testing Procedure

Test Input Expected Output
ESP32 Test Power ON ESP32 boots successfully
Wi-Fi Test Network Available Wi-Fi Connected
Line Test Black Line Robot follows line
Obstacle Test Object detected Robot stops
Cloud Test Telemetry Data n8n receives data
Telegram Test Robot Event Alert received
Google Sheets Test Telemetry Data Data logged
ThingSpeak Test Sensor Data Dashboard updated

19. Future Enhancements

Computer Vision

Add camera-based object detection, human detection, package recognition, and visual navigation.

GPS Navigation

Use GPS for outdoor autonomous delivery.

LiDAR Mapping

Create advanced obstacle maps and navigation systems.

Multi-Robot Fleet

AI can assign delivery tasks to multiple autonomous robots.

Predictive Maintenance

Detect motor degradation, battery problems, and mechanical failures.

Voice Command Control

Users can send commands such as Start Delivery, Stop Robot, and Return Home.

20. Final Project Workflow

``` USER | v Web Dashboard / Telegram | v AI Agent | v n8n Cloud | v ESP32 Robot | +---------+---------+ | | | v v v Line Sensor Obstacle Battery | | | +---------+---------+ | v Motor Control | v Autonomous Movement | v Delivery Completed | v Telegram Voice Alert | v Google Sheets | v ThingSpeak Cloud ```

21. Project Conclusion

The AI-Based Autonomous Line-Following Delivery Robot combines robotics, embedded systems, artificial intelligence, IoT, cloud computing, and workflow automation into a single intelligent platform.

The ESP32 provides real-time control of the robot. The IR sensors enable line following, ultrasonic sensors provide obstacle detection, and the motor driver controls the robot movement.

The n8n automation platform provides the connection between the robot, AI Agent, Telegram, Google Sheets, and ThingSpeak. The AI system can analyze historical power consumption and predict future energy usage.

The complete system follows the intelligent automation cycle:

SENSE → PROCESS → DECIDE → ACT → COMMUNICATE → LEARN

© AI-Based Autonomous Line-Following Delivery Robot

ESP32 | AI Agent | Agentic IoT | n8n | Telegram | Google Sheets | ThingSpeak

AI Smart Voice Controlled Wheelchair for Disabled Persons

"GPIO 26", "Left Motor IN2" => "GPIO 27", "Right Motor IN1" => "GPIO 14", "Right Motor IN2" => "GPIO 12", "Ultrasonic TRIG" => "GPIO 5", "Ultrasonic ECHO" => "GPIO 18", "Battery Voltage Sensor" => "GPIO 34", "Current Sensor" => "GPIO 35", "Temperature Sensor" => "GPIO 32", "Emergency Button" => "GPIO 4", "Buzzer" => "GPIO 2" ]; $workflowSteps = [ "User gives voice command", "Speech is converted to text", "AI Agent identifies the command", "n8n validates the command", "ESP32 receives the command", "Safety sensors are checked", "Motor driver controls the wheelchair", "Sensor data is sent to the cloud", "Google Sheets stores data", "ThingSpeak displays data", "Telegram sends notifications", "AI predicts power consumption" ]; function showSectionTitle($title) { echo "

" . htmlspecialchars($title) . "

"; } ?> <?php echo $projectTitle; ?>

AI + ESP32 + IoT + n8n Automation + Telegram Voice Alerts

Google Sheets + ThingSpeak Cloud Dashboard + AI Power Prediction

The wheelchair is controlled through natural voice commands. The AI Agent understands the user's spoken command and converts it into an appropriate wheelchair movement command.

The ESP32 acts as the main controller. It communicates with motors, sensors, cloud platforms and automation services.

Project Working

  • Control wheelchair using voice commands.
  • Improve mobility for disabled persons.
  • Detect obstacles automatically.
  • Monitor battery voltage and percentage.
  • Measure motor current and power consumption.
  • Send emergency notifications.
  • Use AI for intelligent decision making.
  • Store IoT data in Google Sheets.
  • Visualize data using ThingSpeak.
  • Use n8n for automation.

USER / PATIENT | v VOICE COMMAND | v AI VOICE PROCESSING | v n8n AI AGENT | v ESP32 CONTROLLER | +----------------+ | | v v SENSORS MOTOR DRIVER | | v v CLOUD PLATFORM DC MOTORS | +----------------+ | | | v v v ThingSpeak Google Telegram Sheets Alerts
+----------------------+ | BATTERY | | 12V / 24V | +----------+-----------+ | +--------------+--------------+ | | v v +-------------+ +--------------+ | DC-DC BUCK | | MOTOR DRIVER | | 12V to 5V | | HIGH CURRENT | +------+------+ +------+-------+ | | v v +------------------------------------------+ | ESP32 | | | | GPIO 26/27 ------ LEFT MOTOR CONTROL | | GPIO 14/12 ------ RIGHT MOTOR CONTROL | | | | GPIO 5/18 -------- ULTRASONIC SENSOR | | GPIO 34 ---------- VOLTAGE SENSOR | | GPIO 35 ---------- CURRENT SENSOR | | GPIO 4 ----------- EMERGENCY BUTTON | | GPIO 2 ----------- BUZZER | +------------------------------------------+
$pin): ?>
Device ESP32 Pin
START | v INITIALIZE ESP32 | v CONNECT TO WIFI | v READ SENSORS | v EMERGENCY BUTTON PRESSED? | YES | v STOP MOTORS | SEND TELEGRAM ALERT | v LOOP NO | v OBSTACLE LESS THAN 30 CM? | YES | v STOP MOTORS | SEND WARNING | v LOOP NO | v RECEIVE AI COMMAND | v VALIDATE COMMAND | v CONTROL MOTORS | v SEND DATA TO CLOUD | v LOOP
Voice Command AI Intent

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

const char* ssid = "YOUR_WIFI_NAME";
const char* password = "YOUR_WIFI_PASSWORD";

const char* n8nWebhook =
"https://YOUR-N8N-DOMAIN/webhook/wheelchair-data";

#define LEFT_IN1 26
#define LEFT_IN2 27

#define RIGHT_IN1 14
#define RIGHT_IN2 12

#define TRIG_PIN 5
#define ECHO_PIN 18

#define EMERGENCY_PIN 4
#define BUZZER_PIN 2

String movement = "STOP";

void setup() {

    Serial.begin(115200);

    pinMode(LEFT_IN1, OUTPUT);
    pinMode(LEFT_IN2, OUTPUT);

    pinMode(RIGHT_IN1, OUTPUT);
    pinMode(RIGHT_IN2, OUTPUT);

    pinMode(TRIG_PIN, OUTPUT);
    pinMode(ECHO_PIN, INPUT);

    pinMode(EMERGENCY_PIN, INPUT_PULLUP);
    pinMode(BUZZER_PIN, OUTPUT);

    stopMotors();

    WiFi.begin(ssid, password);

    while (WiFi.status() != WL_CONNECTED) {

        delay(500);

        Serial.println("Connecting to WiFi...");

    }

    Serial.println("WiFi Connected");

}

void loop() {

    bool emergency =
        digitalRead(EMERGENCY_PIN) == LOW;

    float distance = readDistance();

    if (emergency) {

        stopMotors();

        digitalWrite(BUZZER_PIN, HIGH);

        movement = "EMERGENCY_STOP";

    }

    else if (distance > 0 && distance < 30) {

        stopMotors();

        digitalWrite(BUZZER_PIN, HIGH);

        movement = "OBSTACLE_STOP";

    }

    else {

        digitalWrite(BUZZER_PIN, LOW);

    }

    delay(5000);

}

void moveForward() {

    digitalWrite(LEFT_IN1, HIGH);
    digitalWrite(LEFT_IN2, LOW);

    digitalWrite(RIGHT_IN1, HIGH);
    digitalWrite(RIGHT_IN2, LOW);

    movement = "FORWARD";

}

void moveBackward() {

    digitalWrite(LEFT_IN1, LOW);
    digitalWrite(LEFT_IN2, HIGH);

    digitalWrite(RIGHT_IN1, LOW);
    digitalWrite(RIGHT_IN2, HIGH);

    movement = "BACKWARD";

}

void turnLeft() {

    digitalWrite(LEFT_IN1, LOW);
    digitalWrite(LEFT_IN2, HIGH);

    digitalWrite(RIGHT_IN1, HIGH);
    digitalWrite(RIGHT_IN2, LOW);

    movement = "LEFT";

}

void turnRight() {

    digitalWrite(LEFT_IN1, HIGH);
    digitalWrite(LEFT_IN2, LOW);

    digitalWrite(RIGHT_IN1, LOW);
    digitalWrite(RIGHT_IN2, HIGH);

    movement = "RIGHT";

}

void stopMotors() {

    digitalWrite(LEFT_IN1, LOW);
    digitalWrite(LEFT_IN2, LOW);

    digitalWrite(RIGHT_IN1, LOW);
    digitalWrite(RIGHT_IN2, LOW);

    movement = "STOP";

}

float readDistance() {

    digitalWrite(TRIG_PIN, LOW);

    delayMicroseconds(2);

    digitalWrite(TRIG_PIN, HIGH);

    delayMicroseconds(10);

    digitalWrite(TRIG_PIN, LOW);

    long duration =
        pulseIn(ECHO_PIN, HIGH);

    float distance =
        duration * 0.034 / 2;

    return distance;

}

    
ESP32 | v n8n WEBHOOK | v JSON DATA | v AI AGENT | +------------------+ | | v v LOW BATTERY OBSTACLE | | v v TELEGRAM ALERT MOTOR STOP | v GOOGLE SHEETS | v THINGSPEAK CLOUD

Example n8n JavaScript Code


const data = $json;

let alert = "NORMAL";
let message = "";

if (data.emergency === true) {

    alert = "EMERGENCY";

    message =
    "Emergency stop activated.";

}

else if (data.distance < 30) {

    alert = "OBSTACLE";

    message =
    "Obstacle detected. Wheelchair stopped.";

}

else if (data.battery_percentage < 20) {

    alert = "LOW_BATTERY";

    message =
    "Battery level is low.";

}

return [

    {

        json: {

            ...data,

            alert: alert,

            message: message,

            timestamp:
            new Date().toISOString()

        }

    }

];

    
  1. Open Telegram.
  2. Search for BotFather.
  3. Use the command /newbot.
  4. Create a bot name.
  5. Copy the Telegram Bot Token.
  6. Add Telegram credentials to n8n.
  7. Use Telegram Send Message node.
  8. Use Text-to-Speech for voice alerts.
Example Telegram Alert:

🚨 AI SMART WHEELCHAIR ALERT
Status: EMERGENCY STOP
Battery: 62%
Distance: 18 cm
Movement: STOP
Timestamp Battery Current Power Distance Movement Alert
10:00 78% 3.8 A 47 W 145 cm FORWARD NORMAL
10:05 65% 5.1 A 62 W 20 cm STOP OBSTACLE

ThingSpeak can be used to display real-time sensor information.

  • Field 1: Battery Voltage
  • Field 2: Battery Percentage
  • Field 3: Current
  • Field 4: Power Consumption
  • Field 5: Distance
  • Field 6: Temperature
  • Field 7: Movement Status
  • Field 8: Emergency Status

The system calculates electrical power using:

Power = Voltage × Current Example: Voltage = 12.4 V Current = 3.8 A Power = 12.4 × 3.8 Power = 47.12 Watts

Historical data from Google Sheets and ThingSpeak can be analyzed to predict future energy consumption.

HIGH CURRENT + LOW BATTERY + HIGH TEMPERATURE | v HIGH POWER CONSUMPTION | v AI PREDICTION | v TELEGRAM WARNING
The safety system has the highest priority.

Emergency Button → Immediate Motor Stop
Obstacle Detected → Automatic Motor Stop
Wi-Fi Failure → Safe Stop Mode
Low Battery → Warning Alert
Invalid AI Command → No Movement
  • AI Camera-Based Object Detection
  • GPS Tracking
  • Fall Detection
  • Offline Voice Recognition
  • Advanced AI Power Prediction
  • Health Monitoring Sensors
  • Mobile Application
  • Autonomous Navigation
  • Obstacle Avoidance Using AI Vision
  1. Assemble the wheelchair motors.
  2. Connect motor driver to ESP32.
  3. Install ultrasonic and safety sensors.
  4. Install emergency stop button.
  5. Upload ESP32 firmware.
  6. Connect ESP32 to Wi-Fi.
  7. Create n8n webhook.
  8. Configure Telegram Bot.
  9. Connect Google Sheets.
  10. Create ThingSpeak channel.
  11. Configure AI Agent.
  12. Test voice commands.
  13. Test obstacle detection.
  14. Test emergency stop.
  15. Perform complete safety testing.

The AI Smart Voice-Controlled Wheelchair combines artificial intelligence, IoT, ESP32, voice recognition, n8n automation, Telegram notifications, Google Sheets and ThingSpeak Cloud.

The system follows an Agentic IoT architecture:

SENSE ↓ UNDERSTAND ↓ ANALYZE ↓ DECIDE ↓ ACT ↓ NOTIFY ↓ PREDICT
Important Safety Notice:

This project is intended for prototype and educational development. A real human-carrying wheelchair requires high-current electrical protection, mechanical braking, emergency-stop redundancy, battery protection, professional engineering validation and extensive supervised testing.

AI Smart Voice-Controlled Wheelchair Project

ESP32 | AI | IoT | n8n | Telegram | Google Sheets | ThingSpeak