← Martin Koudela04 / 13

Robotics & hardware

RaspiVision

Raspberry Pi 4 · security camera

Security camera on a Raspberry Pi 4. A PIR sensor detects motion and triggers YOLOv8 detection of people, animals and objects; clips are saved from a circular H264 buffer and browsable in a web gallery, with a live MJPEG stream.

Status
Completed
Context
Annual school project
Source
github.com/MartinKoudela/rpi-cam

Architecture

CameraCamera Module 3 NoIR
MotionPIR sensor
Raspberry Pi 4YOLOv8 detection:people, animals, objectsCircular H264 bufferFastAPI
Live viewMJPEG stream
Recordingsclips from buffer
Web UIvanilla JS
Galleryin the web UI
Fig. 1 · System diagram. Shaded block runs on the Pi.

Specifications

12
Board
Raspberry Pi 4 Model B
BCM2711, quad-core Cortex-A72 @ 1.8 GHz
Memory
4 GB
Camera
Camera Module 3 NoIR
12 MP Sony IMX708, no IR filter; CSI-2 via 15-pin ribbon
Motion sensor
HW-416 PIR
Detection
YOLOv8
People, animals and objects; runs when the PIR sensor detects motion
Recording
Circular H264 buffer
Live view
MJPEG
FastAPI backend
Stream
640×420, 42 FPS
Live view overlay
Web UI
Vanilla JS
Remote access
Tailscale
No ports exposed to the internet
Schematic
KiCad
Status
Completed
Annual school project

How it works

05
Capture
A Raspberry Pi Camera Module 3 NoIR supplies the video feed. An HW-416 PIR sensor reports motion.
Detection
When the PIR sensor detects motion, YOLOv8 runs on the Pi 4 and detects people, animals and objects.
Recording
Footage goes into a circular H264 buffer, so the most recent stretch is always kept. Clips are saved from the buffer and can be browsed in a web gallery.
Live view
A FastAPI backend serves a live MJPEG stream to a web UI written in vanilla JavaScript.
Remote access
The web UI is reached over Tailscale. No ports are exposed to the internet.

Parts

03
Raspberry Pi 4 Model B
Detection, recording, web server
Camera Module 3 NoIR
Video input
HW-416 PIR motion sensor
Motion input

Figures

06