Project

AEGIS - Automated Edge based Guardian Intelligence System

Built by Akshat Srivastava (iamkahanikaar)

An edge-first surveillance and safety monitoring system that turns old iPhones into privacy-aware camera nodes, combines on-device detection with ESP32 smoke/gas/panic sensors, and sends event-based alerts through Firebase, Cloud Functions, and optional Telegram notifications.

Overview

AEGIS stands for Automated Edge-based Guardian Intelligence System. It is a final-year major project built around the idea of turning old iPhones into privacy-aware camera nodes for safety monitoring. Instead of continuously streaming video to the cloud like traditional CCTV systems, AEGIS is designed to process video locally on the device and send alerts only when important events are detected. The system combines iOS camera processing, edge AI concepts, live monitoring, event recording, Firebase backend services, and ESP32-based hardware sensors.

Problem

Traditional CCTV systems often depend on continuous cloud streaming, which increases bandwidth cost, server load, privacy risk, and alert latency. They also usually require dedicated camera hardware, making them expensive to deploy. AEGIS explores a more cost-effective and privacy-aware approach by reusing old iPhones as intelligent camera nodes and pairing them with low-cost ESP32 sensors for environmental and emergency alerts.

My Role

I worked on the Apple-platform and hardware integration side of AEGIS. My work included the SwiftUI app shell, Firebase authentication flow, camera and microphone permission handling, AVFoundation camera session logic, Agora streaming configuration, event recording/upload flows, and integration planning for motion and weapon detection. I also worked on the ESP32 sensor layer, including MQ-2 smoke/gas monitoring, panic button input, OLED status display, buzzer/LED alert feedback, Wi-Fi event posting, and serial fallback events for local demos.

What I Built

I built the SwiftUI iOS app foundation with Firebase authentication, sign-up, login, session persistence, Firestore user session updates, and a global loading overlay. The app routes users through a splash screen, authentication flow, and a post-login tab shell with Home and Settings sections. The Home flow includes entry points for camera broadcasting, monitoring hub viewing, recording access, motion alert mode, and clip recording mode. I worked on AVFoundation camera session helpers, camera/microphone permission handling, local camera preview, and Agora-based live video broadcasting and viewing. I also built event and recording infrastructure through Firebase. Event payloads are sent to a Cloud Function ingest endpoint, recordings are uploaded to Firebase Storage, and recording metadata is written to Firestore. On the hardware side, I built an ESP32 sensor prototype using an MQ-2 gas/smoke sensor, OLED display, panic button, LED, and buzzer. The firmware reads sensor values, detects smoke/gas threshold events, handles panic button presses, shows status on OLED, triggers local alarms, and sends event payloads to the AEGIS Cloud Function.

Technical Highlights

AEGIS uses SwiftUI with a shared ViewState architecture for authentication, session state, camera permissions, and global UI state. The camera layer uses AVFoundation for capture sessions and local previews, while Agora is used for live broadcaster/viewer flows through configurable channel and token settings. The detection architecture includes separate services for motion detection and weapon detection. Motion detection uses frame-level luma delta heuristics, while weapon detection is designed around Vision and Core ML classification with weapon keyword mapping for alert generation. Firebase powers the backend layer through Authentication, Firestore, Storage, and Cloud Functions. The ingestEvent Cloud Function validates event payloads, stores events in Firestore, optionally sends Telegram alerts for weapon/motion events, and pushes notifications through registered web push tokens. The recording flow uploads MP4 clips to Firebase Storage under user-specific paths and stores recording metadata in Firestore. This supports the event-based recording idea where only meaningful clips are uploaded instead of continuous video. The ESP32 firmware uses GPIO34 for MQ-2 analog readings, GPIO23 for panic button input, GPIO13 for buzzer output, GPIO2 for LED alerts, and I2C OLED display output. It includes event hold/cooldown logic, panic button debouncing, Wi-Fi retry backoff, HTTPS event posting, and serial event fallback for local relay.

What I Learned

AEGIS taught me how to think about mobile apps as part of a larger system instead of just standalone screens. I learned how camera capture, edge detection, live streaming, event ingestion, cloud storage, push alerts, and hardware sensors can work together in one safety-focused architecture. I also learned how important reliability and privacy are in safety systems. The project pushed me to think about local processing, event-triggered uploads, fallback paths, hardware debounce/cooldown logic, and how to design alerts without depending on continuous cloud streaming.