Build a Raspberry Pi Security Camera Network

In this project, I am going to make a Raspberry Pi security camera simply using the standard Pi camera such as the one I used in the time-lapse tutorial.

Raspberry Pi Security Camera

This project is a cost-effective way of getting a security camera up and running that you can view over the network and also have it, so it is motion activated.

Remember the Raspberry Pi isn’t a powerhouse, so performance will degrade if you try to do too much by adding too many high definition cameras.

With that said, it’s still an excellent way of building your own affordable camera network. So let’s get to it.

Equipment

You will need the following equipment to complete this Raspberry Pi security camera project.

Raspberry Pi

Raspberry Pi camera or USB WebCam

Power Supply

Micro SD Card (8GB + Recommended)

Ethernet Cord (Recommended) or WiFi Dongle

Raspberry Pi Case (Optional)

Video

If you want to see how to set up the Raspberry Pi security camera visually, then check out the video I have prepared below.

As always, if you like what you see and want to stay up to date with all the latest and greatest projects, guides and much more, then please subscribe.

Adblock blocking the video? Support us by subscribing to our ad-free service.

Installing the Raspberry Pi Camera

Firstly before we do anything, we need to have a Raspberry Pi camera. In this tutorial, I use the regular IR camera, and it works fine however if it gets dark it can’t see at all. (Which is probably not much good for a security camera). You can find the regular camera here or the non-IR camera here.

If you’re after for more information check out my Raspberry Pi camera guide for everything you need to know.

Secondly, we will need to install the camera (If you haven’t got one you can get one here), to do this go to the ribbon slot (the one directly behind the Ethernet port) using two fingers gently pull up on both sides of the connector.

Clips & Ribbon Cabble

Now the connector is open insert the ribbon cable with the metal leads facing away from the Ethernet port. Make sure it is nicely lined up and then gently press back down on the connector. The cable should now be locked in place, and we can now move onto the software.

On a side note, if you want to install this into a more secure enclosure, there is some great equipment you can buy or even design to do this. To keep this tutorial pretty basic I am not going to go into a heavily customized camera enclosure.

Installing MotionPie

I settled on using MotionPie as it seems to be an all in one solution for what I require and it also didn’t involve as much fiddling around to get it to work.

The MotionPie Logo

Download & Format the SD Card

1. Download the Motion Pie SD Card Image from the Motion Pie GitHub repository.

2. You will need a formatting tool. Visit the SD Association’s website and download SD Formatter for either Windows or Mac.

3. Follow the instructions to install the formatting software.

4. Insert your SD card into the computer or laptop’s SD card reader and check the drive letter allocated to it, e.g. G:/

5. In SD Formatter, select the drive letter for your SD card (eg. G:/) and format

Install the Motion Pie Image onto the SD Card

1. Download the Win32DiskImager.

2. Now unzip the MotionPie img file so you can install it onto the Pi safely.

3. Select the MotionPie img file and the drive letter your SD card is assigned (Eg. G:/)

4. Confirm you have the correct details and click on Write.

5. Once done you can safely remove your SD card from the computer.

win32diskimager motionpie

Booting/Setting up MotionPie

Now we’re ready for boot up, so insert the SD Card, an Ethernet cord, and the power cord. We will need to communicate to the Pi over the network rather than directly as I have done in most of the previous tutorials.

So now go ahead and boot the Pi up and then we can move onto getting it set up correctly.

Setting up the Raspberry Pi Security Camera

Once the Pi has booted you will need to do the following:
1. First, we will need the IP or hostname, so we’re able to connect to the Pi.

  • If you’re using Windows, then simply go to network on the right-hand side in the File Explorer.
  • You should see a computer names something like MP-E28D9CE5
  • Go to your browser and add this to your browser bar e.g. http://MP-E28D9CE5
  • You should now have the Motion Pie interface up.

2. Alternatively, you can find out the IP of the Pi by going to your router. Since all routers are different, I will not go into how to do this. Please refer to your manufacturer’s manual.

3. To log in as the admin go to key symbol in the upper left corner. The username is admin and the password is blank, this can be changed later.

4. You can access all the setting for the camera stream here. If you’re interested in altering these settings, keep reading as I explain them as much as possible below.

Now we should have a working security hub that we can configure! Require the security camera to be wireless? No problem! Require to alert you with an email? No problem! Read more to find out what the settings do in Motion Pie.

How to set up multiple network Raspberry Pi security cameras

If you want to run more than one Pi cameras, it is pretty easy to set this up, so you have all the streams under in one window. You can even add a stream that has been set up using the Raspberry Pi Webcam server tutorial.

1. First, click on the three lines with dots on them in the upper left-hand corner.

2. Now up in the upper-left hand corner and click on the drop-down box and select add camera.

3. In here you have four settings to set up.

  • Device: This allows you to select where the camera is located(network/local) and type. (Eg. MotionEye, MJPEG camera)
  • URL: This is the URL to the other network camera. Eg. http://othercamera:8080
  • Username: This is the username of the camera device. (If no username/password is required, then leave the fields blank)
  • Password: This is the password for the username chosen above.
  • Camera: Select the camera you wish to add.

In the example below camera1 (Pi Camera) and camera2 (USB WebCam) are connected to the Pi running Motionpie while camera3 is coming from a different Pi that was set up using the webcam server tutorial.

This method is a great way to set up a strong Raspberry Pi security camera network.

Raspberry Pi Multiple Cameras

Connecting to the surveillance outside your network

Now that you have your Raspberry Pi security cameras setup it might be worth considering allowing access to the central Pi so you can monitor your cameras elsewhere.

To do this just head over to my guide on how to setup port forwarding and also how to setup dynamic DNS, you can find the guide at Raspberry Pi Dynamic DNS & Port Forwarding.

A few important bits of information you will need for the setting up the port forwarding.

  • The IP of your Raspberry Pi for example mine is 192.168.1.108
  • Internal port is 80.

Ensure you also have set up passwords on both the admin and the surveillance user to help avoid unwanted visitors.

Once set up, you should now be able to connect using your external IP address such as XX.XXX.XXX.XXX:80 (80 should be changed to something else, I would recommend changing it to avoid easy access for unwanted visitors)

Configuring the Settings in MotionPie

Raspberry Pi MotionPie Interface

General Settings

In here you can set the administrator username and password. This account will have access to all the settings you see at the moment.

Surveillance username and password can also be set in here this can be used to just to access the camera interface.

To view all the settings available to set turn the show advanced settings to on.

Wireless Network

Turn this on if you plan on connecting to the network via a wireless dongle. There are two things you will need to fill in here.

  • Network Name: Enter the network name/SSID you wish to connect to in here.
  • Network Key: Enter the network password/network key in here for the network you’re connecting to.

Once done you should be able to disconnect the Ethernet cord and remain connected to the network.

Video Device

Under this menu, you’re able to set certain settings regarding the Raspberry Pi camera device.

  • Camera Name: Set this to whatever you would like the camera to be named. For example, the name kitchen would work well for a camera in a kitchen.
  • Camera Device: You’re unable to edit this one, but this is the device name of the camera.
  • Light Switch Detection: Enable this if you want sudden changes such as a light being switched on not to be treated as a motion. (This will help prevent false positives)
  • Automatic Brightness: This will enable automatic software brightness, this means the camera software will make adjustments for the brightness. You don’t need to activate this if your camera already handles this. In here you change the brightness, contrast, and saturation of the video of the camera.
  • Video Resolution: Here you can set the video resolution of the camera. The higher the resolution, the more room it will take up and the more bandwidth it will need to use to stream the footage. I set mine to 1280×800, and that seems to work perfectly fine.
  • Video Rotation: You can rotate your video from the Raspberry Pi security if you’re finding that it is looking the wrong way.
  • Frame Rate: This sets the number of frames that will be sent be every second. The higher this is, the smoother the video, but again this will increase the storage used and bandwidth.

File Storage

Under this menu, you can specify where you would like the files stored for the Raspberry Pi security camera. This location can be a custom path on the Pi, the predetermined path or the network path.

Text Overlay

In here you can set the text overlay on the output of the camera. By default, the left text reads the camera name and the right read the time stamp (Today’s date and current time).

Video Streaming

This menu you’re able to set the video streaming options, this is the video you see in the browser.

  • Streaming Frame Rate: This is the same as mentioned above under video device.
  • Streaming Quality: You can reduce the video streaming quality. This setting is good to reduce if you need to access the camera on a low bandwidth device often.
  • Streaming Image Resizing: Enable this if you want MotionPie to resize the images before being sent to a browser. (Not recommended on a Pi)
  • Streaming Port: This is the port that the device will listen to for connections looking to view the stream. Eg. http://motionpie:8081
  • Motion Optimization: This will reduce the frame rate whenever no motion is detected. This setting will save you bandwidth.

You can also see three URLs that can be used to access different footage. These URLs are very important if you have multiple cameras per Pi as each camera will have a unique port that you listen to the stream.

Still Images

Here you can set the Raspberry Pi security camera to take still images whenever motion is triggered, during specific intervals or all the time.

Motion Detection

In here you can activate the Raspberry Pi security camera motion detection that is included in the software. You can make adjustments to the settings here so that you can get better motion detection.

Motion Movies

In here you can set the Pi to record movies whenever motion is detected.

Motion Notifications

You’re able to set up email notifications, webhook notifications or even run a command whenever motion is detected. This option will allow you to be notified whenever activity is detected on the cameras, perfect if they are monitoring areas with low traffic.

Working Schedule

Here you can set the days, and the hours of operation you would like the system to be monitoring (If you leave this off then it is 24/7). This option is perfect if you only need it running during specific hours.

Summary

The Raspberry Pi security camera system is a great way to have multiple cameras hooked up both locally and over a network. All the extra setting Motionpie provides allows you to have a strong functioning security hub for your home, office or wherever you’re setting this up.

I hope this tutorial has helped you in creating a fantastic Raspberry Pi security camera network. If you have had any problems, provide feedback or have a great setup you would like to share then feel free to drop a comment below. If you’re after more great Raspberry Pi projects, then be sure to check out many other great tutorials.

184 Comments

  1. Alexandru on

    Hi,

    If you wish to install montioneye software on Raspbian please follow the tutorial made by the maintainer of the software here:
    https://github.com/ccrisan/motioneye/wiki/Install-On-Raspbian

    Don’t forget to add “sudo” to the Pip commands and some of the copy commands.
    Especially Pip since it will compile while installing some of the dependencies and it needs super user rights.

  2. nata on

    How much up to add camera in the web server, can I add more 10 camera?
    Thank

    1. Alexandru on

      Hi Nata,

      First of all realistically you could run max 2-3 pi cameras on one pi with a decent frame rate.
      Don’t forget getting image from a camera it is very intensive computing task and requires memory.
      I recommend to buy several Pi’s and attach to each of them max 2 cameras.
      You can do that by buying a pi camera adapter from the ebay.

  3. Venkat on

    Suggest me, how to connect through wifi. There is no option of Searching for Available wifi network..

    1. Gus on

      The WiFi point you wish to connect to should have an SSID/network name (You would usually click to on the name to join it), enter this for the name. Then enter the required password.

  4. JJ on

    This OS and PI camera software is nearly perfect.

    I have a request.

    Simple FTP uploading.

    Is this something that can be added in the next update?

  5. Sierra on

    Hi,
    Thanks very much for the tutorial. I did install MotionEyeOS on the RPi 3 and it’s working great.
    My problem is that I use Blue Iris for my security software and I can’t figure out how to configure it to see the stream.
    I also have Pogoplug Arch Linux cams (running motion) and they are visible in Blue Iris.
    Can you help?
    Thanks,
    Sierra

  6. David S on

    Hi, Ive just got a Pie3 starter kit and bought the Pie camera to set up a home CCTV. The 8GB micro-SD card is all pre-configured and set up, but when I try and do the Win32DiskImager thingy it only shows as having a few MB of available space. Ive tried just downloading the image file to a memory stick and moving straight to the file directory but that doesn’t work. Does anyone know what I should try next (other than learn some basic computer skills!!)?

  7. Luke on

    Whenever I extract the IMG file and use

    sudo dd if=/Users/*MyUserName*/Downloads/motioneyeos-bananapi-20161212.img of=/dev/rdisk2 bs=8m

    the files copy to the SD card fine, it’s just that the Pi doesn’t want to boot after inserting the SD card and plugging in power. The red led stays solid. Please Help!

    1. Gus on

      In your command I notice you’re trying to use the bananapi version of motioneyeos, this will not work/boot on the Raspberry Pi. (I am assuming you’re using a Raspberry Pi) If you’re using the Pi you will need to redownload the correct image over at their github.

  8. Bruce on

    So I am trying to use the motion detect feature but am getting afternoon shadows setting off the motion. I have the Light Switch Detection set to 0 – what else can I tweak to fix this issue?

  9. JP on

    Hi Gus,

    I’m stuck in this part..

    Welcome to meye-41d31c50!
    meye-41d31c50 login:admin
    Password:
    root@meye-41d31c50~]#

    What’s next after this??

    Please do reply. I appreaciate it

    1. Trip on

      Hi JP,

      I currently have the same problem. I’m using a Raspberry Pi 3. Did you solve it? Any help would be great.

      Thanks.

  10. John S on

    This is a great guide and very cool OS/Software. Works flawlessly and turns my otherwise useless/trash webcam into a useful gadget in about 10 minutes. Thank you for this!!!!

  11. Adam on

    how do I add more camera for the surveillance system? or I can’t?

  12. fokozuynen on

    just in case anyone is trying this with reolink camera i found that the adress is something like this: rtsp://192.168.1.112/h264Preview_01_main only problem is that no image came from camera

  13. Malcolm Peill on

    Excellent project, and I have it working without any problems, thank you.
    Just a couple of questions:
    Once in operation, is there any way of powering off the Rpi cleanly, rather than just removing power?
    Is there any way of reviewing any captured stills or video on a USB memory stick installed locally on the Rpi, or does the stick need to be removed and viewed offline?

    1. Malcolm Peill on

      Oh, Just found the answer to my own first question, a shutdown option within the general settings…sorry.

  14. Peter Hofman on

    Hi,
    Great project. I am trying to set up multiple pi’s with cameras en one central one that will stream all cameras to the outside world. For that I need to install hostapd and dnsmasq on one of the pi’s. But I can not figure out how to do so. All standard install tools seem to be removed. Please advice.
    Best regards, Peter

  15. Tony on

    Jon, I am looking to build one of those for my front door. Would you tell me how much it cost and what I need for the whole project?
    Thank you very much,
    Tony

  16. Pankaj on

    Has anyone used PiNoIR Camera with IR LED using MotionPi? Any tutorials out there on using external IR source?

    1. Tony on

      Pankaj, you actually can build or purchase a set that already built online. The IRs are the external source that you don’t really need to hook it with the camera circuit (it’s an independent circuit). Except, you just need to make sure the camera needs the IR filter lens to be removed.

  17. Mike on

    I can’t seem to make this load for me. When I try to extract the .img file using Wind32DiskImager, it doesn’t matter what size of SD card I use, it changes it to 19.9mb (from 16gb) and only installs a couple of files totalling 8.69mb in size. When I insert this into my Pi2, it never boots up. Only stays on the rainbow splash screen. (yes, I’m using the Pi2 Image)

    What am I doing wrong?

    1. Malcolm Peill on

      Hi, not sure if you still have this problem, but I had similar issues and found I had to first remove all partitions from the SDcard, then recreate just one partition ocupying the whole card, then formatting that to FAT32. I used a free utility “EaseUS Partition Manager” that did the job. After that, burn the image with the DiskImager.

  18. mark on

    Please can you guys tell me how to set up more than one camera to the same PI2 in a wireless configuration?

  19. Rob on

    Hi guys,

    I would love to see you create this tutorial or similar for the Pi Zero and let us know your opinion about it (regarding stability, etc.).
    Looking forward to it!

    Thanks in advance,

  20. Laurens on

    Hi!

    What a nice Raspberry Pi project. I want to try this project this week when my camera is received. I have one question. Is it possible to save the image on my online FTP Webserver?

Leave a Reply

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