Skip to content

Latest commit

 

History

History

README.md

SENTRI Hardware

The ESP32-CAM + operator-console hardware companion to SENTRI — a face-detection gate console that streams video, flags visitors, and drives real accept/reject hardware. This directory was previously its own repository (sentri-hardware) and has been merged into the main SENTRI repo.

Python OpenCV ESP32

Overview

SENTRI Hardware is a small, judge-demo-ready security prototype: an ESP32-CAM streams live video into a Flask + OpenCV dashboard, which detects faces, overlays them in real time, and lets an operator approve or deny access with one click. The decision is sent to a second ESP32 dev board that drives a red/green LED and buzzer, and can pan a servo to track the detected face.

Features

  • Live video streaming from an ESP32-CAM into a browser dashboard
  • Real-time face detection with overlay rendering (OpenCV)
  • One-click operator decisions — approve/deny from the console
  • Physical accept/reject feedback — LEDs + buzzer on a second ESP32 dev board
  • Face-following servo tracking — pans toward the detected face's center
  • Automatic fallback — falls back to snapshot polling (/capture) if the video stream port is blocked

Tech Stack

Layer Technology
Dashboard backend Python, Flask
Vision OpenCV
Camera firmware ESP32-CAM (Arduino CameraWebServer)
Control board firmware ESP32 dev board (Arduino, servo + LED + buzzer control)

Getting Started

One-command launch (Windows)

.\run_demo.ps1

or

run_demo.bat

This creates .venv if needed, installs dependencies, starts the Flask server, and opens the dashboard in your browser.

Manual run

pip install -r requirements.txt
python server.py

Set device URLs if they differ from the defaults:

Variable Default
CAM_STREAM_URL http://10.12.238.163:81/stream
DEV_BOARD_URL http://10.12.238.24

Open http://127.0.0.1:5000.

Hardware Wiring

Component GPIO
HC-SR501 PIR output 13
Pan servo signal 25
Tilt servo signal 26
Buzzer 12
Red LED 14
Green LED 27

Servos require an external 5V supply with common ground shared to the ESP32.

The backend sends incremental pan updates to http://<board-ip>/track?pan=<angle> based on face position. Tunable via environment variables:

Variable Purpose
TRACK_DEADBAND_PX Ignore small face movement around center
TRACK_STEP_DEG Pan-angle change per update
TRACK_MIN_INTERVAL_SECONDS Minimum delay between tracking updates
PAN_MIN, PAN_MAX, PAN_CENTER Servo angle limits

Project Structure

server.py                              # Flask app: dashboard, camera feed, decision endpoints
templates/index.html                   # Live operator console UI
esp32cam_sentri/CameraWebServer/       # ESP32-CAM firmware (standard camera web server)
esp32dev_wifi/esp32dev_wifi.ino        # ESP32 dev board firmware (accept/reject, servo tracking)
run_demo.ps1 / run_demo.bat            # One-command launchers

Troubleshooting

  • The ESP32-CAM must already be connected to Wi-Fi and streaming on port 81.
  • If port 81 is blocked on your network, SENTRI automatically falls back to http://<camera-ip>/capture.
  • The ESP32 dev board must expose /accept and /reject over HTTP.
  • If the stream is offline, check power, Wi-Fi credentials, and the camera's IP address.

Related

  • ../ — the full SaaS-style dashboard/app this hardware feeds into (same repo, root directory)

License

No license file is currently present in this repository.