Thursday, 28 May 2026

AI-Based Smart Vehicle Theft Detection with Face Recognition and GPS

AI-Based Smart Vehicle Theft Detection with Face Recognition and GPS Using ESP32 + Camera + GPS + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak + AI Agentic IoT Dashboard
AI-Based Smart Vehicle Theft Detection with Face Recognition and GPS Using ESP32 + Camera + GPS + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak + AI Agentic IoT Dashboard 1. Project Overview This project is an AI-powered smart vehicle security system that detects unauthorized access using: Face Recognition GPS tracking ESP32-CAM AI automation workflows Telegram voice alerts Cloud dashboards Google Sheets logging ThingSpeak IoT analytics n8n automation workflows The system continuously monitors the vehicle. When someone enters or tries to start the vehicle: ESP32-CAM captures face image AI compares face with authorized users If unauthorized: GPS location is captured Telegram alert sent Voice notification generated Data stored in Google Sheets Event uploaded to ThingSpeak dashboard Owner can remotely monitor activity 2. System Architecture ┌─────────────────────┐ │ ESP32-CAM │ │ Face Detection AI │ └─────────┬───────────┘ │ │ WiFi ▼ ┌─────────────────────┐ │ n8n │ │ Automation Server │ └──────┬───────┬──────┘ │ │ ┌─────────────────┘ └────────────────┐ ▼ ▼ ┌─────────────────┐ ┌────────────────────┐ │ Telegram Alerts │ │ Google Sheets Log │ │ Voice Messages │ │ Theft Records │ └─────────────────┘ └────────────────────┘ │ ▼ ┌──────────────────┐ │ ThingSpeak Cloud │ │ GPS + Analytics │ └──────────────────┘ 3. Features Main Features Vehicle Theft Detection Detects unauthorized access Face Recognition Authorized face database GPS Live Tracking Sends real-time vehicle location Telegram Alerts Instant notifications Voice Alerts AI-generated voice message Cloud Dashboard Real-time monitoring using ThingSpeak Data Logging Event history in Google Sheets AI Prediction Predicts power usage trends 4. Components List Component Quantity Purpose ESP32-CAM 1 Main controller + camera OV2640 Camera 1 Face capture NEO-6M GPS Module 1 GPS tracking SIM800L GSM (Optional) 1 GSM backup Relay Module 1 Vehicle ignition lock Buzzer 1 Alarm PIR Sensor 1 Motion detection OLED Display 1 Status display Lithium Battery 1 Backup power Voltage Regulator 1 Stable power Jumper Wires — Connections Breadboard/PCB — Assembly 5. Circuit Schematic Diagram ESP32-CAM Connections Module ESP32 Pin GPS TX GPIO16 GPS RX GPIO17 PIR OUT GPIO13 Relay IN GPIO12 Buzzer GPIO15 OLED SDA GPIO14 OLED SCL GPIO2 6. Working Principle Step-by-Step Working Step 1: Vehicle Monitoring ESP32 stays in monitoring mode. Step 2: Motion Detection PIR sensor detects movement. Step 3: Face Capture ESP32-CAM captures image. Step 4: AI Face Verification Face matched with authorized database. Step 5: Unauthorized Detection If face not recognized: Alarm activated GPS fetched Alert workflow triggered Step 6: n8n Automation n8n receives webhook data. Step 7: Notifications Telegram sends: Text alert GPS location Voice alert Step 8: Cloud Logging Event stored in: Google Sheets ThingSpeak 7. Flowchart START | Initialize ESP32 | Connect WiFi | Wait for Motion | Motion Detected? | NO └──> Continue Monitoring | YES | Capture Face Image | Recognized? | YES └──> Allow Access | NO | Activate Alarm | Get GPS Location | Send Data to n8n | Telegram Alert | Store in Google Sheets | Upload to ThingSpeak | END 8. ESP32 Source Code (Arduino IDE) Required Libraries Install: WiFi.h HTTPClient.h TinyGPS++ ESP32 Camera ArduinoJson ESP32 Code #include #include #include const char* ssid = "YOUR_WIFI"; const char* password = "YOUR_PASSWORD"; String webhookURL = "https://your-n8n-webhook-url"; TinyGPSPlus gps; #define PIR_PIN 13 #define BUZZER 15 void setup() { Serial.begin(115200); pinMode(PIR_PIN, INPUT); pinMode(BUZZER, OUTPUT); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); } Serial.println("WiFi Connected"); } void loop() { int motion = digitalRead(PIR_PIN); if (motion == HIGH) { digitalWrite(BUZZER, HIGH); float lat = 17.3850; float lng = 78.4867; if(WiFi.status()== WL_CONNECTED){ HTTPClient http; http.begin(webhookURL); http.addHeader("Content-Type", "application/json"); String jsonData = "{"; jsonData += "\"alert\":\"Unauthorized Access\","; jsonData += "\"latitude\":" + String(lat) + ","; jsonData += "\"longitude\":" + String(lng); jsonData += "}"; int response = http.POST(jsonData); Serial.println(response); http.end(); } delay(10000); digitalWrite(BUZZER, LOW); } } 9. Telegram Bot Setup Step 1: Open Telegram Search: Telegram Step 2: Open BotFather Search: BotFather Step 3: Create Bot Commands: /newbot BotFather gives: Bot Token Save it securely. Step 4: Get Chat ID Open browser: https://api.telegram.org/bot/getUpdates Find: "chat":{"id":12345678} 10. n8n Automation Setup Install n8n Using Docker docker run -it --rm \ -p 5678:5678 \ -v ~/.n8n:/home/node/.n8n \ docker.n8n.io/n8nio/n8n Workflow Steps Node 1: Webhook Receives ESP32 data Node 2: IF Node Checks alert condition Node 3: Telegram Node Sends alert Node 4: Google Sheets Node Stores records Node 5: HTTP Request Uploads to ThingSpeak Node 6: Text-to-Speech Generates voice alert 11. n8n Workflow JSON { "nodes": [ { "name": "Webhook", "type": "n8n-nodes-base.webhook" }, { "name": "Telegram", "type": "n8n-nodes-base.telegram" }, { "name": "Google Sheets", "type": "n8n-nodes-base.googleSheets" } ] } 12. Google Sheets Integration Step-by-Step Create Sheet Columns: | Time | Alert | Latitude | Longitude | Status | Connect with n8n Google Cloud Console Enable Sheets API Create OAuth Credentials Connect inside n8n 13. ThingSpeak Dashboard Setup Create Account Use: ThingSpeak Official Website Create Channel Fields: Field Data Field 1 Latitude Field 2 Longitude Field 3 Alert Status Field 4 Battery Voltage API Example https://api.thingspeak.com/update?api_key=YOUR_KEY&field1=17.3850 14. Face Recognition System Options Option 1: ESP32 Basic Face Recognition Lightweight Limited accuracy Option 2: Python AI Server Recommended Use: OpenCV FaceNet DeepFace Python Face Recognition Example from deepface import DeepFace result = DeepFace.verify( img1_path="captured.jpg", img2_path="authorized.jpg" ) print(result) 15. AI Power Consumption Prediction Logic Objective Predict: Battery drain Vehicle idle usage Theft-related abnormal consumption Parameters Parameter Description Battery Voltage Current voltage GPS Usage Tracking frequency WiFi Usage Data transmission Camera Runtime AI processing load AI Logic Simple Linear Regression: power = camera_usage*0.5 + wifi_usage*0.3 + gps_usage*0.2 16. Telegram Voice Notification Automation Process n8n receives theft event Generate TTS message Convert text to MP3 Send MP3 to Telegram Example Alert Warning! Unauthorized vehicle access detected. Current GPS location shared. 17. AI Agentic IoT Logic Agent Decision System The AI agent can: Decide theft probability Trigger emergency mode Disable ignition Notify multiple users Detect repeated attempts Sample AI Rule if unknown_face and motion_detected: trigger_theft_alert() 18. Cloud Dashboard Design Dashboard Widgets Live GPS Map Intrusion Counter Battery Analytics Face Detection Log Vehicle Status 19. Future Enhancements Advanced Features Number Plate Recognition Voice Assistant Remote Engine Lock AI Behavior Prediction Edge AI Processing Mobile App Blockchain Security Logs 4G LTE Connectivity 20. Deployment Guide Step-by-Step Deployment Hardware Assembly Connect all modules Flash ESP32 Upload firmware Configure WiFi Add credentials Setup n8n Import workflow Setup Telegram Bot Add token Connect Cloud APIs ThingSpeak Google Sheets Testing Simulate theft Vehicle Installation Hide device securely 21. Security Recommendations Important Use HTTPS Secure API Keys Encrypt Face Data Enable OTP Access Use Backup Battery 22. Testing Procedure Test Expected Result Motion Detection Camera activated Unknown Face Alert triggered GPS Tracking Coordinates updated Telegram Alert Notification received Cloud Upload Dashboard updated 23. Real-World Applications Smart Cars Bike Security Fleet Monitoring Logistics Vehicles Rental Cars School Buses 24. Software Tools Required Software Purpose Arduino IDE ESP32 programming Python AI processing n8n Automation ThingSpeak Cloud dashboard Telegram Notifications 25. Final Output of the System When theft occurs: ✅ Face captured ✅ GPS tracked ✅ Telegram alert sent ✅ Voice warning generated ✅ Google Sheet updated ✅ ThingSpeak dashboard updated ✅ AI theft analysis performed 26. Suggested Folder Structure SmartVehicleSecurity/ │ ├── ESP32_Code/ ├── AI_Server/ ├── n8n_Workflow/ ├── GoogleSheets/ ├── ThingSpeak/ ├── Documentation/ └── Images/ 27. Recommended Upgrades Hardware ESP32-S3 AI accelerator LTE module Software YOLOv8 Firebase MQTT Broker Node-RED 28. Conclusion This project combines: AI IoT Automation Cloud Computing Vehicle Security to create a modern intelligent anti-theft solution using low-cost hardware and scalable cloud services. The project is suitable for: Final year engineering projects IoT research Smart transportation systems AI security applications Startup prototypes

No comments:

Post a Comment

AI-Powered Home Automation Using Voice and Face Recognition

🏠 AI-Powered Home Automation Using Voice & Face Recognition (ESP32 + Agentic IoT + n8n + Telegram + Google Sheets + ThingSpeak) 🏠 AI-...