Skip to content
Advanced 5 hours

Raspberry Pi Motion-Detection Security Camera

By Amit1379
July 13, 2026

This security camera project uses a Raspberry Pi Zero 2 W (or Pi 4) with an official camera module and the MotionEyeOS image — a purpose-built, lightweight OS for IP cameras. Motion detection triggers local video recording to an SD card or USB drive, and sends email notifications with a snapshot attachment. The live stream is accessible from any browser on your network (or over VPN from anywhere).

What You’ll Need

  • Raspberry Pi Zero 2 W (or Pi 3/4)
  • Raspberry Pi Camera Module v2 (or HQ camera for better quality)
  • MicroSD card (32 GB minimum — recording fills space fast)
  • USB drive or network share for video storage
  • Pi Zero camera ribbon cable (shorter than standard Pi cable)
  • 5 V / 2.5 A micro-USB power supply
  • Weatherproof camera enclosure (if mounting outdoors)
  • Gmail account for email notifications (with App Password set up)

Step-by-Step Instructions

  1. Flash MotionEyeOS: Download MotionEyeOS image for your Pi model from github.com/motioneye-project/motioneyeos/releases. Flash to SD card with Raspberry Pi Imager → Use custom image.
  2. Network setup: Before first boot, mount the SD card’s boot partition and edit /boot/wpa_supplicant.conf with your WiFi credentials. MotionEyeOS gets its IP from DHCP on first boot — check your router’s client list.
  3. First access: In a browser, go to http://[IP] port 80. Log in as admin (no password by default). Change the admin password immediately.
  4. Configure camera: In Video Device settings, set resolution (1080p for Pi Camera v2 at ~10 fps, or 720p for smoother 25 fps). Enable still images and movies under File Storage.
  5. Motion detection: Enable Motion Detection. Set frame change threshold to ~2% to avoid false triggers from shadows. Set minimum event frames to 5 to filter brief glitches.
  6. Email notifications: Under Notifications → Email, enter your Gmail SMTP settings, your address as sender, and recipient. Use a Gmail App Password (not your main password — enable 2FA first, then create an App Password in Google Account settings).
  7. Storage management: Under File Storage, mount a USB drive. Enable automatic cleanup when storage exceeds 80% — oldest recordings deleted first.

Safety Notes

  • Change the default admin password immediately — leaving it blank exposes your camera stream to anyone on your network.
  • Do not expose the MotionEye web interface directly to the internet — use a VPN for remote access.
  • Camera placement outdoors must comply with local laws regarding recording public spaces and neighbours’ properties.

Tips & Troubleshooting

  • Night-time recording: add an IR cut filter camera and IR LED ring for invisible illumination. MotionEyeOS doesn’t control IR LEDs directly — wire them to a separate timer or photoresistor switch.
  • For multiple cameras, install motioneye (not MotionEyeOS) on a Pi 4 and add each camera as an IP camera source.
  • Stream drops frequently: reduce resolution or frame rate — Pi Zero W’s CPU and WiFi radio share bandwidth and thermal budget, limiting sustainable stream quality.

Leave a Comment

Your email address will not be published. Required fields are marked *