AI Smart Security Camera with Suspicious Activity Detection
Project Overview
This project is an advanced IoT security system using ESP32-CAM, AI detection, n8n automation, Telegram voice alerts, Google Sheets logging and ThingSpeak cloud dashboard. The system detects suspicious activities and sends instant alerts.
System Architecture
Camera / Motion Sensor
|
v
ESP32-CAM
|
v
AI Activity Detection
|
v
n8n Automation
/ | \
Telegram Sheets ThingSpeak
Features
- AI suspicious activity detection
- Motion monitoring
- ESP32-CAM surveillance
- Telegram voice alerts
- Google Sheets logging
- ThingSpeak dashboard
- IoT Web Control Panel
Components List
| Component | Quantity |
|---|---|
| ESP32-CAM | 1 |
| PIR Motion Sensor | 1 |
| Buzzer | 1 |
| LED | 2 |
| Relay Module | 1 |
| Power Supply | 1 |
Circuit Connection
PIR Sensor VCC -> ESP32 5V GND -> ESP32 GND OUT -> GPIO13 Buzzer GPIO12 -> Buzzer LED GPIO4 -> LED
Working Flowchart
START | Initialize ESP32 | Connect WiFi | Start Camera | Motion Detected? | YES | Capture Image | AI Analysis | Suspicious? | YES | Activate Alarm | Telegram Voice Alert | Google Sheet Log | ThingSpeak Update
ESP32 Source Code
#include WiFi.h
#define PIR 13
#define BUZZER 12
void setup()
{
pinMode(PIR,INPUT);
pinMode(BUZZER,OUTPUT);
WiFi.begin(
"SSID",
"PASSWORD"
);
}
void loop()
{
if(digitalRead(PIR))
{
digitalWrite(
BUZZER,
HIGH
);
// Send n8n alert
}
}
n8n Workflow
ESP32 Webhook
|
AI Agent
|
Decision Node
|
Telegram Alert
|
Google Sheets
|
ThingSpeak
Telegram Bot Setup
- Open Telegram
- Search BotFather
- Create New Bot
- Copy Bot Token
- Add token in n8n
Google Sheets Integration
| Date | Event | Status |
|---|---|---|
| 25-06-2026 | Suspicious Movement | Alert |
ThingSpeak Dashboard
Cloud fields:
- Motion Count
- Alert Count
- Power Usage
- Temperature
AI Power Prediction
Power = Camera Usage + WiFi Usage + Alarm Usage AI predicts remaining battery time.
Voice Notification Automation
Detection | AI Decision | Text Generation | Voice Conversion | Telegram Voice Message
Future Enhancements
- Face Recognition
- Night Vision Camera
- YOLO AI Detection
- Smart Door Lock
- Cloud AI Analytics
Deployment Steps
- Upload ESP32 Program
- Connect WiFi
- Create n8n Workflow
- Configure Telegram
- Connect Google Sheets
- Create ThingSpeak Channel
- Test Security Alerts






