Friday, 29 May 2026

AI Smart Autonomous Delivery Robot with Obstacle Avoidance

AI Smart Autonomous Delivery Robot with Obstacle Avoidance AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI Smart Autonomous Delivery Robot with Obstacle Avoidance AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard 1. Project Overview This project combines: Autonomous delivery robot Obstacle avoidance navigation ESP32 Wi-Fi connectivity AI-powered decision making Agentic IoT architecture n8n workflow automation Telegram voice notification alerts Google Sheets data logging ThingSpeak cloud dashboard AI power consumption prediction Remote monitoring through web dashboard The robot can: ✅ Navigate autonomously ✅ Detect and avoid obstacles ✅ Monitor battery level ✅ Send live telemetry to cloud ✅ Log data into Google Sheets ✅ Generate AI-based battery usage predictions ✅ Send Telegram text and voice notifications ✅ Trigger automation workflows using n8n 2. System Architecture ┌─────────────────┐ │ Autonomous Robot │ │ ESP32 │ └────────┬────────┘ │ ┌────────────────┼─────────────────┐ │ │ │ ▼ ▼ ▼ HC-SR04 Battery Sensor Motor Driver Obstacle Monitoring L298N │ ▼ WiFi Connection │ ▼ n8n Automation │ ┌───────────┬───────┼──────────┐ ▼ ▼ ▼ ▼ Telegram AI Agent Google ThingSpeak Voice Alerts Sheets Dashboard 3. Components List Controller ESP32 DevKit V1 Navigation HC-SR04 Ultrasonic Sensor Servo Motor SG90 Motor Section L298N Motor Driver 2 DC Geared Motors Robot Chassis Wheels Power 18650 Battery Pack Battery Holder TP4056 Charging Module Sensors Voltage Divider Battery Sensor Optional: IR Sensors MPU6050 IMU Communication WiFi (ESP32 Built-in) Cloud Services Telegram Bot Google Sheets ThingSpeak n8n Server OpenAI API (optional) 4. Pin Connections HC-SR04 VCC → 5V GND → GND TRIG → GPIO5 ECHO → GPIO18 Servo Signal → GPIO19 VCC → 5V GND → GND L298N IN1 → GPIO26 IN2 → GPIO27 IN3 → GPIO14 IN4 → GPIO12 Battery Sensor Voltage Divider Output → GPIO34 5. Circuit Schematic Diagram HC-SR04 ┌─────────┐ Trig│ GPIO5 │ Echo│ GPIO18 │ └─────────┘ ESP32 ┌────────────────┐ │ │ │ GPIO26 ─ IN1 │ │ GPIO27 ─ IN2 │ │ GPIO14 ─ IN3 │ │ GPIO12 ─ IN4 │ │ GPIO19 ─ Servo │ │ GPIO34 ← Batt │ └────────────────┘ │ ▼ L298N ┌────────────┐ MotorA│ │MotorB └────────────┘ 6. Working Principle Step 1 Robot moves forward. Step 2 HC-SR04 continuously measures distance. Step 3 If obstacle detected: Distance < 20 cm Robot stops. Step 4 Servo rotates ultrasonic sensor. Left Scan Right Scan Step 5 Robot chooses best path. Step 6 Status uploaded to: ThingSpeak n8n webhook Step 7 n8n workflow: Stores data Runs AI analysis Sends Telegram alerts 7. Flowchart START │ ▼ Connect WiFi │ ▼ Read Sensors │ ▼ Obstacle? │ │ NO YES │ │ ▼ ▼ Move Stop Forward │ ▼ Scan Left │ ▼ Scan Right │ ▼ Best Direction │ ▼ Move │ ▼ Upload Data │ ▼ Repeat 8. ESP32 Source Code Required Libraries WiFi.h HTTPClient.h ESP32Servo.h WiFi Setup const char* ssid="YOUR_WIFI"; const char* password="YOUR_PASSWORD"; ThingSpeak String apiKey="THINGSPEAK_API_KEY"; n8n Webhook String webhook = "https://your-n8n-instance/webhook/robot"; Main Functions void moveForward() { digitalWrite(IN1,HIGH); digitalWrite(IN2,LOW); digitalWrite(IN3,HIGH); digitalWrite(IN4,LOW); } void stopRobot() { digitalWrite(IN1,LOW); digitalWrite(IN2,LOW); digitalWrite(IN3,LOW); digitalWrite(IN4,LOW); } Distance Measurement long readDistance() { digitalWrite(TRIG,LOW); delayMicroseconds(2); digitalWrite(TRIG,HIGH); delayMicroseconds(10); digitalWrite(TRIG,LOW); long duration=pulseIn(ECHO,HIGH); return duration*0.034/2; } Upload Data void sendData() { HTTPClient http; String url= webhook+ "?distance="+String(distance)+ "&battery="+String(battery); http.begin(url); http.GET(); http.end(); } 9. n8n Workflow Design Workflow Nodes Webhook │ ▼ Function │ ▼ OpenAI │ ▼ Google Sheets │ ▼ Telegram Workflow Logic Webhook receives: { "distance": 35, "battery": 72, "status": "MOVING" } Function Node: return [{ battery:$json.battery, distance:$json.distance, status:$json.status }] 10. AI Agent Logic AI Agent receives: Battery = 72% Distance = 35cm Current State = Moving Prompt: Analyze robot health. Predict battery life. Suggest maintenance action. Output: Battery healthy. Estimated operation: 2.8 Hours Remaining. No maintenance required. 11. n8n Workflow JSON Template { "nodes":[ { "name":"Webhook" }, { "name":"OpenAI" }, { "name":"Google Sheets" }, { "name":"Telegram" } ] } Import this JSON into n8n and configure credentials. 12. Telegram Bot Setup Create Bot Open Telegram. Search: @BotFather Commands: /newbot Provide: Robot Delivery Bot Receive: BOT TOKEN Get Chat ID Send message to bot. Open: Telegram Bot API Documentation Retrieve: chat_id 13. Telegram Voice Alert Automation n8n Telegram Node Message: Warning! Obstacle detected. Battery below 20%. Voice Conversion Use: Google Cloud Text-to-Speech or ElevenLabs Workflow: Webhook │ ▼ AI Analysis │ ▼ Text-to-Speech │ ▼ Telegram Send Audio Voice Alert Example: Attention. Delivery robot battery is low. Please recharge soon. 14. Google Sheets Integration Create Sheet: RobotData Columns: Timestamp Distance Battery Status Prediction Example: Time Distance Battery Status Prediction 10:00 45 75 Moving 3 hrs n8n Configuration Add: Google Sheets Node Authentication: OAuth2 Operations: Append Row 15. ThingSpeak Cloud Dashboard Setup Create account: ThingSpeak Official Website Create Channel: Fields: Field1 Distance Field2 Battery Field3 Status Field4 AI Prediction Upload API https://api.thingspeak.com/update Example: field1=35 field2=78 field3=1 16. AI Power Consumption Prediction Inputs Battery Voltage Motor Speed Distance Travelled Obstacle Count Operating Time Formula Basic estimation: Remaining Time = Battery Capacity / Current Consumption Example: 2200mAh / 750mA = 2.93 Hours For visualization: t= I C ​ Where: t = operating time C = battery capacity I = current consumption Advanced AI Model Features: Battery Voltage Motor PWM Obstacle Frequency Average Speed Temperature Model: Linear Regression or Random Forest Prediction: Remaining Battery % Expected Runtime Maintenance Alert 17. Web Dashboard Recommended stack: ESP32 ThingSpeak n8n Telegram Google Sheets Advanced dashboard: React Node.js MQTT Broker AI Analytics Useful platforms: Node-RED Grafana MQTT HiveMQ Cloud 18. Future Enhancements AI Navigation Computer Vision Object Classification Dynamic Route Planning Use: OpenCV YOLO Object Detection Mapping SLAM Indoor Navigation GPS Delivery Modules: NEO-6M GPS Voice Assistant Commands: Start Delivery Return Home Battery Status Emergency Stop Edge AI Models: TinyML TensorFlow Lite Micro Use: TensorFlow Lite for Microcontrollers 19. Deployment Guide Phase 1 Hardware Assembly Assemble chassis Install motors Connect ESP32 Connect sensors Phase 2 Firmware Upload ESP32 code Verify sensor readings Phase 3 Cloud Setup Configure ThingSpeak Configure Telegram Configure Google Sheets Phase 4 Automation Deploy n8n workflow Connect OpenAI API Test alerts Phase 5 Field Testing Obstacle avoidance test Battery monitoring test Cloud connectivity test Telegram voice alert test Phase 6 Production Deployment Waterproof enclosure High-capacity battery OTA firmware updates Secure API keys Fleet monitoring dashboard Final Deliverable Features ✅ Autonomous obstacle avoidance robot ✅ ESP32 Wi-Fi enabled ✅ Agentic AI decision layer ✅ n8n automation workflows ✅ Telegram text and voice alerts ✅ Google Sheets logging ✅ ThingSpeak real-time dashboard ✅ AI battery prediction ✅ Cloud monitoring ✅ Future-ready for computer vision, SLAM, GPS, and multi-robot fleet management This architecture is suitable as a complete final-year engineering project, IoT research prototype, smart campus delivery robot, hospital medicine delivery robot, or warehouse autonomous delivery system.

No comments:

Post a Comment

AI Smart Autonomous Delivery Robot with Obstacle Avoidance

AI Smart Autonomous Delivery Robot with Obstacle Avoidance AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google ...