Skip to content

Latest commit

 

History

27 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SecCam

A versitile day/night security camera system using radar-based motion detection, UART/GPIO communication with a Raspberry Pi, and a machine-vision human detection pipeline that generates animated GIF alerts and sends them to Telegram.

Examples w/ telegram captions

Left (day): "2 Humans spotted at 2025-11-28 16:25:52"

Right (night): "Human spotted at 2025-11-28 17:59:39"

Alt text Alt text

YOLO was able to detect the correct amount of people reliably in ~5 seconds with optimization (tested up to four people)

Overview

SecCam is a hybrid hardware/software security system designed for continuous outdoor or indoor monitoring, even in low-light or no-light environments.

Updated recently using process groups to prioritize frame capture and minimize downtime.

Pipeline:

  1. Human radar sensor connected to an ESP32 via GPIO
  2. Serial UART connection to RaspberryPi3b+
  3. YOLO based machine-vision human detection
  4. GIF generation -> Telegram API alerts

SecCam is optimized for low power, low false positives, and real-time responsiveness.

Tech Stack

Hardware / Communication

  • HMMD-MMWave-Sensor Buy
  • ESP32 Dev Board (handles radar data) Buy
  • UART Serial (Radar <-> ESP32)
  • Raspberry-Pi3b+ (primary processing unit) Buy
  • GPIO (power, triggers)
  • Arducam 1080p night/day camera with automatic light detection Buy

Software

  • Python
  • Bash
  • C++ (ESP32 firmware)
  • Ultralytics YOLOv8n
  • RPi.GPIO
  • fmpeg (camera + GIF generation)
  • curl (Telegram API sending)
  • Telegram Bot API

System Architecture/Wiring

       ┌─────────────────────────┐
       │    HMMD Radar Module    │
       └─────────┬───────────────┘
                 │ Module: (Radar) ──► (ESP32)
                 │ Data:       TX  ──► RX2
                 │ Power:      3V3 ──► 3V3
                 │ Ground:     GND ──► GND
            ┌────┴───────┐
            │   ESP32    │
            └────┬───────┘
                 │ Module: (ESP32) ──► (Pi)
                 │ Data:    GPIO23 ──► GPIO17
                 │ Power:    VIN  ───► 5V
                 │ Ground:    GND ───► GND
       ┌─────────┴──────────────┐
       │    Raspberry Pi 3B+    │
       │ - Frame Capture        │   USB   ┌───────────────┐
       │ - Human Detection      ├─────────┤ Camera module │
       │ - GIF Generation       │         └───────────────┘
       │ - Telegram API         │
       └─────────┬──────────────┘
                 │
                 ▼
         Smartphone Alerts

Setup and Installation on Pi

Clone the repo

git clone https://github.com/MearlyAMortal/SecCam.git
cd SecCam

Setup Enviroment

  1. Create virtual environment:
    python3 -m venv ~/ml-env
    
  2. Activate it:
    source ~/ml-env/bin/activate
    
  3. Install dependencies (Depenting on pi OS):
    sudo apt install -y python3-pip ffmpeg curl
    pip install RPi.GPIO ultralytics 
    
  4. Set up directory
    mkdir -p photos
    touch config.sh
    
  5. Set up config.sh
    nano config.sh
    
    config.sh
    #!/bin/bash
    
    #Working directory
    export CONF_PARENT_DIR="should be .../SecCam"
    export CONF_VIRTUAL_ENV="should be .../ml-env/bin/activate"
    
    #Telegram
    export CONF_BOT_TOKEN="YOUR BOT TOKEN"
    export CONF_CHAT_ID="YOUR CHAT ID"
    
    #Child directories
    export CONF_PHOTOS_DIR="$CONF_PARENT_DIR/photos"
    export CONF_FRAMES_DIR="$CONF_PHOTOS_DIR/frames"
    export CONF_GIF_DIR="$CONF_PHOTOS_DIR/gifs"
    export CONF_LOG_DIR="$CONF_PARENT_DIR/log"
    
    #Scipts
    export CONF_SEND_SCRIPT="$CONF_PARENT_DIR/send.sh"
    
  6. Edit permissions
    chmod +x listen.sh send.sh vision.sh
    

ESP32

Upload the firmware in SecCam/esp32_send.ino using Arduino IDE (ESP32 Dev Board, speed 115200).

Telegram Bot setup

Full guide to setup bot HERE

Usage

To start:

./listen.sh

To stop:

CTRL+c (SIGINT)

Logs

Can be found in the generated log directory. (12-12-25_12-12-25.txt) The files are generated using the start date and the end date is appended after program execution. Duplicate file names will not overwrite old ones and instead increment a number at the end. (12-12-25_12-12-25_2.txt)

© License and Contact

This project is licensed under the MIT License. See the LICENSE file for details.

Contact me: GitHub profile

About

Security camera system using : ESP32/Radar/RaspberryPi/YOLOv8/TelegramAPI

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages