Introduction
With growing urbanization and security concerns, traditional CCTV systems are no longer sufficient for modern monitoring. A Smart Surveillance System uses IoT, AI, and sensors to detect, track, and alert security personnel in real time. It can detect motion, objects, faces, and unusual activities, making security systems smarter and more efficient.
This system is widely used in homes, offices, industries, and public areas to ensure safety.
Objective of the Project
- To provide real-time surveillance and monitoring
- To detect motion, objects, and unauthorized entry
- To alert authorities instantly
- To enable remote monitoring via IoT
Working Principle
- Camera captures live video
- Motion sensors (PIR / IR) detect movement
- AI model processes video for object or face detection
- Alerts are sent via IoT to mobile or cloud
- Optional: Record video footage or trigger alarms
Components Required
- ESP32-CAM / IP Camera / USB Camera
- PIR Motion Sensor
- Microcontroller (ESP32 / Raspberry Pi)
- Buzzer / Alarm (optional)
- Wi-Fi / Internet Connection
- IoT Platform (Blynk / ThingSpeak / Firebase)
- Computer / Cloud for AI processing (optional)
Block Diagram
Camera + PIR Sensor
↓
ESP32-CAM / Raspberry Pi
↓
Motion / AI Detection
↓
Buzzer / Alarm
↓
Wi-Fi
↓
Cloud / Mobile App
Circuit Connections (ESP32-CAM Example)
PIR Sensor
OUT → GPIO13
VCC → 5V
GND → GND
Buzzer
+ → GPIO12
- → GND
Camera
- ESP32-CAM module has built-in camera
- Connect 5V and GND properly
- Use AI code via Arduino IDE or Python
AI + IoT Python Code Example (Motion & Object Detection)
import cv2
from datetime import datetime
from twilio.rest import Client
# Load pre-trained AI model (YOLO / OpenCV DNN)
net = cv2.dnn.readNet("yolov3.weights", "yolov3.cfg")
classes = []
with open("coco.names", "r") as f:
classes = [line.strip() for line in f.readlines()]
# Initialize camera
cap = cv2.VideoCapture(0)
while True:
ret, frame = cap.read()
if not ret:
break
# Object detection
blob = cv2.dnn.blobFromImage(frame, 1/255, (416,416), swapRB=True, crop=False)
net.setInput(blob)
layer_names = net.getUnconnectedOutLayersNames()
outputs = net.forward(layer_names)
# Display results
for output in outputs:
for detection in output:
scores = detection[5:]
class_id = int(scores.argmax())
confidence = scores[class_id]
if confidence > 0.5:
center_x, center_y, w, h = (detection[0:4] * [frame.shape[1], frame.shape[0], frame.shape[1], frame.shape[0]]).astype('int')
cv2.rectangle(frame, (center_x-w//2, center_y-h//2), (center_x+w//2, center_y+h//2), (0,255,0), 2)
cv2.putText(frame, classes[class_id], (center_x, center_y-10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0,255,0), 2)
cv2.imshow("Smart Surveillance", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
Code Explanation
- Camera captures live video frames
- YOLO model detects objects in real time
- PIR sensor triggers AI processing when motion is detected
- Bounding boxes and labels are displayed
- Alerts can be sent via IoT or SMS
Advantages
- Real-time monitoring
- Motion and object detection
- Remote surveillance via IoT
- Enhances security in public and private spaces
Applications
- Home security
- Industrial surveillance
- Traffic monitoring
- Smart city security
- Banks, airports, and campuses
Future Enhancements
- Face recognition for authorized access
- Cloud storage of video footage
- AI-based anomaly detection
- Integration with alarm systems and drones
Conclusion
The Smart Surveillance System combines AI, IoT, and sensors to provide real-time intelligent security monitoring. This system is ideal for enhancing safety and ensuring rapid response in emergencies.
