DEV Community

TechPulse Lab
TechPulse Lab

Posted on • Originally published at smarthomemade.com

Build a DIY Home Security System with Raspberry Pi (Under $150)

Commercial home security systems want $15-40/month for cloud recording, and they stop working the moment you cancel. Ring, Arlo, Nest — they all hold your footage hostage behind a subscription. A Raspberry Pi-based security system costs under $150 in hardware, stores everything locally, sends instant alerts to your phone, and never charges you a monthly fee. Here's how to build one.

What You'll Build

By the end of this guide, you'll have a security system that:

  • Captures video from 1-4 cameras with motion detection
  • Sends push notifications with snapshot images to your phone when motion is detected
  • Records 24/7 or motion-triggered clips to a local drive
  • Provides a web interface accessible from any device on your network
  • Optionally exposes a secure remote feed through a VPN or Tailscale tunnel
  • Costs nothing beyond the initial hardware investment

No cloud. No subscription. No company watching your footage.

Hardware Shopping List

Component Recommended Model Price
Raspberry Pi Pi 5 (4GB) $60
microSD card SanDisk Extreme 64GB $10
USB SSD (for recording) Kingston XS1000 1TB $60
Power supply Official Pi 5 27W USB-C $12
Case (with fan) Argon ONE V3 $15
Total $157

For cameras, you have two options:

Option A: USB Cameras (Simplest)

Plug a USB webcam directly into the Pi. The Logitech C920 ($50-70) is the classic choice — 1080p, decent night vision with an IR illuminator, and excellent Linux compatibility. You can connect 1-2 USB cameras to a Pi 5 before saturating the USB bandwidth.

Option B: IP Cameras (Better Quality)

Network cameras connect via Ethernet or WiFi and stream video over RTSP. The Reolink RLC-510A ($45) delivers 5MP resolution, built-in IR night vision, and PoE (Power over Ethernet) — meaning one cable provides data and power. IP cameras are better for outdoor use and longer cable runs.

You can mix and match — use USB cameras for indoor spots and IP cameras for outdoor coverage.

Software: Frigate NVR

We're using Frigate, the best open-source NVR (Network Video Recorder) for home use. Frigate provides:

  • Real-time object detection (person, car, animal, package) using a Google Coral TPU or CPU-based inference
  • Motion-triggered and continuous recording
  • Home Assistant integration
  • Web interface with live views and playback
  • MQTT notifications for custom automation

Why Frigate Over Motion or ZoneMinder?

Motion is lightweight but only detects pixel changes — it can't tell a person from a tree branch in the wind. You'll get hundreds of false alerts.

ZoneMinder is powerful but overly complex for a home setup. The UI is stuck in 2005, and configuration requires significant effort.

Frigate uses AI object detection to intelligently filter motion. When a person walks into frame, you get an alert. When the wind blows your bushes, you don't. This alone makes Frigate worth choosing over the alternatives.

Step-by-Step Setup

Step 1: Install Raspberry Pi OS

Download Raspberry Pi Imager from raspberrypi.com. Flash Raspberry Pi OS Lite (64-bit) to your microSD card. During the imaging process, click the gear icon and:

  • Set a hostname (e.g., security-pi)
  • Enable SSH
  • Set a username and strong password
  • Configure your WiFi (though wired Ethernet is more reliable for camera feeds)

Insert the card, connect Ethernet and power, and SSH in:

ssh your-username@security-pi.local
Enter fullscreen mode Exit fullscreen mode

Step 2: Prepare the USB SSD

The microSD card is for the OS; recordings go on the USB SSD for speed and longevity. Plug in your USB SSD and mount it:

sudo mkdir /mnt/recordings
sudo mount /dev/sda1 /mnt/recordings
Enter fullscreen mode Exit fullscreen mode

Add it to /etc/fstab for automatic mounting on boot:

echo '/dev/sda1 /mnt/recordings ext4 defaults,noatime 0 2' | sudo tee -a /etc/fstab
Enter fullscreen mode Exit fullscreen mode

Format the drive if it's new:

sudo mkfs.ext4 /dev/sda1
Enter fullscreen mode Exit fullscreen mode

Step 3: Install Docker

Frigate runs in Docker, which simplifies installation and updates:

curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
Enter fullscreen mode Exit fullscreen mode

Log out and back in for the group change to take effect.

Step 4: Configure Frigate

Create a directory for Frigate's config:

mkdir -p ~/frigate/config
Enter fullscreen mode Exit fullscreen mode

Create the configuration file ~/frigate/config/config.yml:

mqtt:
  enabled: false # Enable if using Home Assistant

cameras:
  front_door:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.100:554/stream1
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 5
    record:
      enabled: true
      retain:
        days: 14
        mode: motion
      events:
        retain:
          default: 30
          mode: motion
    snapshots:
      enabled: true
      retain:
        default: 30
    objects:
      track:
        - person
        - car
        - dog
        - cat

  living_room:
    ffmpeg:
      inputs:
        - path: /dev/video0
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 5
    record:
      enabled: true
      retain:
        days: 7
        mode: motion
    objects:
      track:
        - person

record:
  enabled: true
  retain:
    days: 14
    mode: motion
  events:
    retain:
      default: 30

snapshots:
  enabled: true

detectors:
  cpu1:
    type: cpu
    num_threads: 4
Enter fullscreen mode Exit fullscreen mode

Step 5: Launch Frigate

docker run -d \
  --name frigate \
  --restart=unless-stopped \
  --mount type=tmpfs,target=/tmp/cache,tmpfs-size=1000000000 \
  --device /dev/video0 \
  -v ~/frigate/config:/config \
  -v /mnt/recordings:/media/frigate \
  -p 5000:5000 \
  -p 8554:8554 \
  -p 8555:8555/tcp \
  -p 8555:8555/udp \
  ghcr.io/blakeblackshear/frigate:stable
Enter fullscreen mode Exit fullscreen mode

Open a browser and navigate to http://security-pi.local:5000. You should see your camera feeds with object detection overlays.

Step 6: Set Up Notifications

For push notifications without a subscription service, we'll use ntfy — a free, open-source push notification system.

Install the ntfy app on your phone (available on both iOS and Android). Subscribe to a topic — make it random and unique, like my-home-security-abc123.

Create a simple notification script ~/frigate/notify.sh:

#!/bin/bash
EVENT_TYPE=$1
CAMERA=$2
LABEL=$3

curl -H "Title: Motion Alert" \
  -H "Priority: high" \
  -H "Tags: warning" \
  -d "$LABEL detected on $CAMERA" \
  https://ntfy.sh/my-home-security-abc123
Enter fullscreen mode Exit fullscreen mode

For more sophisticated notifications (including snapshot images), integrate Frigate with Home Assistant and use the Frigate notification blueprint.

Adding a Google Coral TPU (Optional but Recommended)

CPU-based object detection works on a Pi 5, but it uses significant processing power and limits you to about 5 FPS detection across all cameras. A Google Coral USB Accelerator ($35-60) offloads AI inference to dedicated hardware.

With a Coral TPU:

  • Detection runs at 100+ FPS
  • CPU usage drops dramatically
  • You can run more cameras simultaneously
  • Detection accuracy improves

Update your Frigate config to use the Coral:

detectors:
  coral:
    type: edgetpu
    device: usb
Enter fullscreen mode Exit fullscreen mode

This is the single best upgrade you can make to a Pi-based Frigate system.

Storage Calculations

How much storage do you need? It depends on recording mode and camera count:

  • Motion-only recording, 2 cameras: ~5-10 GB/day → 1TB lasts 100-200 days
  • 24/7 recording, 2 cameras at 1080p: ~40-60 GB/day → 1TB lasts 17-25 days
  • 24/7 recording, 4 cameras at 1080p: ~80-120 GB/day → 1TB lasts 8-12 days

Frigate automatically manages storage — it deletes the oldest recordings when the drive fills up, maintaining your configured retention period.

Remote Access (Without Port Forwarding)

You want to check your cameras from work or vacation. Do not open ports on your router. Instead, use Tailscale — a zero-config VPN that creates a secure private network between your devices.

curl -fsSL https://tailscale.com/install.sh | sh
Enter fullscreen mode Exit fullscreen mode

Install Tailscale on your Pi and your phone, authenticate both with the same account, and access Frigate at http://[pi-tailscale-ip]:5000 from anywhere.

Tailscale is free for personal use (up to 100 devices) and requires zero networking knowledge. Your camera feeds are encrypted end-to-end and never pass through a third-party cloud.

Cost Comparison: DIY vs Commercial

DIY (Pi + Frigate) Ring Alarm Pro Arlo Pro 5
Upfront cost ~$150 + cameras $350 + cameras $200-600
Monthly fee $0 $20/month $13-18/month
Year 1 total ~$300 (w/ 2 cameras) $590+ $350-800
Year 3 total ~$300 $1,070+ $680-1,400
Local storage ✅ (limited) ❌ (cloud only)
No internet required
Object detection ✅ (with Coral)
Custom automation ✅ (unlimited) Limited Limited

By year 3, the DIY system has saved $770-1,100 compared to commercial alternatives.

Troubleshooting Tips

  • USB camera not detected: Check ls /dev/video* for available devices
  • RTSP stream won't connect: Test the URL in VLC first; some cameras need auth in the URL
  • High CPU usage: Reduce detection FPS to 3, lower resolution, or add a Coral TPU
  • Motion false positives: Adjust motion thresholds, add masks for trees/roads, rely on object detection filtering
  • SD card corruption: This is why we record to USB SSD — SD cards fail under constant write workloads

The Bottom Line

A Raspberry Pi security system with Frigate gives you everything commercial systems offer — motion detection, object recognition, push notifications, remote viewing — without the monthly fee. It requires more setup effort upfront, but the result is a system you fully control, with footage that never touches anyone else's servers.


Originally published on SmartHomeMade.

Top comments (0)