Setting up a security camera system can be expensive and complicated. However, with a Raspberry Pi and some basic components, you can build your own simple motion-activated security camera that's both affordable and easy to configure. In this guide, I'll walk you through step-by-step how to build a Raspberry Pi security camera using motion detection and live video streaming.

Overview of the Raspberry Pi Security Camera Project

The goal of this project is to build a security camera that will automatically start recording when it detects motion. Here's an overview of how it will work:

The end result will be an inexpensive DIY security camera that can help monitor areas like entryways, garages, backyards, etc. And since it's based on a Raspberry Pi, the entire setup should cost less than $100.

Hardware Required

To build the Raspberry Pi security camera, you'll need the following components:

In addition to the core components above, you may also want to connect an external hard drive to store footage for a longer duration. But this is optional, as footage can be saved directly to the SD card as well.

Software Configuration

With the hardware ready, we can now set up the Raspberry Pi. Follow these steps:

Install the Raspberry Pi OS

  1. Download the latest Raspberry Pi OS image.
  2. Flash it onto the microSD card using balenaEtcher.
  3. Insert the card into the Pi and power it on.
  4. Complete the initial setup prompts.

Enable the Camera Module

  1. Open the Raspberry Pi configuration menu.
  2. Go to Interfaces and enable the camera module.
  3. Reboot the Pi to apply the changes.

Install Motion Detection Software

  1. Update the OS packages: sudo apt update && sudo apt full-upgrade
  2. Install Motion: sudo apt install motion

Configure Motion Detection

  1. Edit the Motion config file: sudo nano /etc/motion/motion.conf
  2. Adjust the frame rate, resolution, and text overlay settings as needed.
  3. Save and exit the file.

Stream Video Over the Network

  1. Edit the daemon configuration file: sudo nano /etc/motion/motion.conf
  2. Set stream_localhost off to enable remote streaming.
  3. Set webcam_localhost off to enable remote viewing.
  4. Save and exit the file.
  5. Restart the Motion service: sudo service motion restart

The Pi security camera should now be accessible over the local network!

Viewing the Live Video Feed

With Motion installed and configured, our DIY security camera will begin detecting motion and recording video. Here's how to view the live stream:

The stream page also shows information like whether motion has been detected. We can now monitor the camera's feed from any internet-connected device!

Automating Security Camera Operation

Manually starting the motion detection software whenever you want to use the camera can be tedious. Here are some tips for automating camera operation:

Automating the camera makes it easy to capture security footage any time without needing physical access to the Pi.

Advanced Features and Customization

The steps above help you build a basic functioning Raspberry Pi security camera using Motion software. But there are many additional features you can add:

So while a simple motion-activated security camera can certainly be built with just a Pi and camera module, there's lots of room for customization to suit your needs. The possibilities are endless!


Building a Raspberry Pi security camera with motion detection requires just a few affordable components and software configuration. Now you know how to set up motion detection, record footage when movement is detected, and view the live video stream remotely.

Compared to commercial security systems, a DIY Raspberry Pi solution gives you more flexibility and customization options. And the ability to learn new skills along the way is invaluable! You can add features like automated control, alerts, AI analysis and more.

I hope this guide gave you a good overview of constructing a motion-activated Raspberry Pi security camera from scratch. Let me know if you have any other questions!