Motion Camera - Smart Doorbell & Motion-Triggered Camera System
timeline: 2026
tech stack: Python, Raspberry Pi, OpenCV, MediaPipe, FastAPI, PostgreSQL, MinIO (S3), Docker Compose
links: GitHub
Overview
A smart doorbell and motion-triggered camera system built on Raspberry Pi. When motion is detected — whether someone approaching the door or wildlife passing through — the system captures high-resolution images, logs them to a local SQLite database with timestamps and motion metadata, and serves them through a lightweight web dashboard for browsing the capture history.
How It Works
The Pi client uses OpenCV frame differencing to detect motion in real-time video streams, with a PIR sensor as a secondary hardware trigger to reduce false positives. When motion exceeds a configurable threshold the camera captures snapshots and short clips, then uploads them to a FastAPI backend. Media lands in MinIO (S3-compatible object storage) and is referenced by URL from a PostgreSQL events table, with detections stored as extensible JSONB so new models — like MediaPipe hand-gesture recognition — plug in without schema changes. The whole backend runs as a Docker Compose stack, and a local spool with retry keeps uploads reliable over flaky Wi-Fi.
Results
The system runs 24/7 on a Raspberry Pi 4, reliably capturing and cataloguing motion events with configurable sensitivity. The event database grows automatically and can be browsed from any device on the local network. Low power consumption and efficient storage management make it practical as a long-running doorbell camera or wildlife monitor.
