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.

Recommended

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 removing the video? Subscribe to premium for no-ads.

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 MotionEye OS

I settled on using MotionEye OS 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.

Download & Format the SD Card

1. Download the MotionEye OS SD Card Image from the MotionEye OS 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 MotionEye OS Image onto the SD Card

1. Download the Win32DiskImager.

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

3. Select the MotionEye OS 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 MotionEyeOS

Booting & Setting up MotionEye OS

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 MotionEye OS 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 the key symbol in the upper-left corner.

The username is admin and the password is blank (Don’t enter any password), 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 MotionEye OS.

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 MotionEye OS. 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 MotionEye OS

Raspberry Pi MotionEyeOS 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 MotionEye OS 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 MotionEye OS 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. Avatar for matt
    matt on

    I have now tried two computers to follow these steps and am getting the same error on both machines when trying to install Win32 Disk Imager (“Unable to execute file: C:\Program Files (x86)\ImageWriter\Win32DiskImager.exe CreateProcess failed; code 740. The requested operation requires elevation.”). Anyone seen this before? Any suggestions to get around it or another tool that would do the same task? Thanks!

    1. Avatar for Gus
      Gus on
      Editor

      Hey Matt! It should of installed however there is a weird bug when when it tries to launch the program.

      To launch it correctly find and locate “win32diskimager” (It should have installed to -> C:\Program Files (x86)\ImageWriter) and right click on and then press “Run as administrator”

    2. Avatar for matt
      matt on

      Gus, I have not made it all the way through all the steps yet, but that did seem to work for the error I was getting. Many thanks!!

      Matt

  2. Avatar for Kevin
    Kevin on

    Where do i go to acesss the files being recorded? Or is that in the interface, in which case why isn’t it saving the stream?

  3. Avatar for Kevin
    Kevin on

    Can’t seem to make the pi connect wireless with this even when editing the settting, and when i goto my router page it says “unknown device” instead of the Mp setup.

  4. Avatar for Brian
    Brian on

    I used the most recent image for the RPi2 from the github repos and tried to follow the dynamic dns guide that you linked to. None of the commands shown in the example function with whatever os is being used on the motion pie image. I’m not sure where to install noip to and sudo is not supported by the os…

    Any help is appreciated.

  5. Avatar for Danny Martin
    Danny Martin on

    Sounds like good suggestions Casper.

  6. Avatar for Casper
    Casper on

    Hi Gus,

    Great project, nice and friendly interface. Got it working in now time, (using pi-filler on a mac to copy the image).
    I have two suggestions (sorry, it’s never enough):
    – a test button for email settings
    – ftp file storage
    However, great and thanx.

  7. Avatar for Al
    Al on

    Excellent work Gus!
    Couldn’t get over how easy this was to install and get going.
    This will suit my need for a weather webcam project I am currently working on.
    Thank you very much for the effort you put into this.

  8. Avatar for Begginer
    Begginer on

    I am using straight cable to connect my laptop to raspberry pi.
    But, I can not access to raspberry pi from my laptop. How to do it?
    I tried to setup the Raspberry Pi’s ip address in cmdline.txt such as:
    ip=192.168.137.2::192.168.137.1

    I could not get the IP address or hostname of Raspberry Pi.

    1. Avatar for Iain
      Iain on

      When you say “straight cable” are you referring to a network cable or something USB?

      You can enable ssh on the pi and use Putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) to ssh from a PC over a network. From a Mac you can ssh from the terminal.

      You can also install VNC to remote desktop into the Pi. I installed Tight VNC on the Pi and VNC Viewer on the Mac. I think Windows Remote Desktop, installed with Windows, can be used too.

  9. Avatar for Fernando
    Fernando on

    Hey, you can use the camera with external battery? when it detects motion to start recording.
    I want to buy Arlo cameras, battery operated, but their autonomy are 4-6 months active and recording only when motion is detected.
    It is possible to do this with Raspberry?

    Greetings!

  10. Avatar for deecee
    deecee on

    I could use some help please. I got it all up and running with 2 cameras. Cool. Now I want to save video and stills, but on to a USB flash drive. I’ve never found a good way to auto-mount a flash drive, so I usually just ‘apt-get install usbmount’, but there is no apt-get on MotionPi. How do I go about installing it? Thanks.

    1. Avatar for Allen
      Allen on

      hiya, when you say with two cameras, are both cameras running of the one pi? for example two usb camera’s?
      thanks
      Allen

    2. Avatar for Gus
      Gus on
      Editor

      Hi Allen,

      Yes this is correct!

      I also tried this with the Raspberry Pi camera + USB camera.

    3. Avatar for Allen
      Allen on

      awesome thanks Gus. any posibility of getting sound?
      see the PS3 EYE TOY i used has a mic on it, or so do some webcams. but it would just be a nice to have.
      another question i have is, after a long day of taking timelapse photo’s the software wont do a zip or timelapse vid. have you had this befor? anyway thanks for the software its awesome, i have now passed it on to my peeps all over, south africa, canada, and more. cheers

    4. Avatar for Allen
      Allen on

      sorry another question, If i leave the survailince log in empty, can you still use the software. Ie if i post the link then it auto loads the camera no log in screen. thanks

  11. Avatar for Vishal
    Vishal on

    Hi guys,

    I bought a raspberry pi yesterday. Its my my first time using the pi.
    I followed all the procedures mentioned above. I formatted the micro SD and installed the image file to the SD using DiskImager. Then i inserted power cable, Ethernet cable and SD card in the pi and powered it up. But i was unable the find the raspberry Pi on my network.

    So alternatively I went to my router settings and found the Pi name and IP address. I tried to used this IP address to access the Cam but it says “Webpage not available”.

    1. Avatar for john p
      john p on

      make sure that if it is a raspberry pi 2, you use the raspberry pi 2 image not just a raspberry pi image

    2. Avatar for Vishal
      Vishal on

      Thanks john p
      The problem was resolved. Another problem i’m facing is im unable to SSH using putty. When i enter the password for the R Pi it says wrong password and access denied. But the R Pi has got its default login credentials.
      Please shoot in some help ! 🙂

    3. Avatar for Archie
      Archie on

      The password is the last digits of the name given to your camera. In the above example, the camera is called mp-40489697
      Therefore the password is 40489697

  12. Avatar for Vishal
    Vishal on

    Hi fellow coders,

    I followed the steps to write the program correctly. But for some reason the Pi is not appearing in the network section of computer. As a result, im unable to access it. Let me know if there,s a solution. Thanks 🙂

  13. Avatar for Nick
    Nick on

    Gus, I had a mental lapse. I was thinking the file had to be an iso. WRONG. I Extracted the image, formatted the SD card, wrote the image with WinDisk32. Voila!!!!! Booted up, works as advertised. I hope I did not waste your time. Thanks.

  14. Avatar for Nick
    Nick on

    Gus, I really like the project idea, however, I am unable to extract the pi2 motionpie.img.gz file correctly. The file extracts with an .img extension, but the Windows 7 disc image burner says the image file is invalid and will not create the iso file. What am I doing incorrectly? I have made many Raspbian cards and other op sys cards for the pi. This one has me stumped. Thanks for any help.

    1. Avatar for Joe
      Joe on

      I am having the same issue.

  15. Avatar for Frank
    Frank on

    Hi Gus,

    great Job, i’m searching such an image for a long time.
    easy to use, thank you.

  16. Avatar for Danny Martin
    Danny Martin on

    Thanks again for this great project. I was able to get everything running in just a short time. Can you shed some light on Fast Network Camera? I had everything working with three cameras and I went to the advanced setup and changed the camera configuration to Fast Network Camera and lost all of my camera feeds. Not know what to do I switched back and all is well. Can you maybe refer me to some additional help on this issue?
    Thanks again,
    Danny

    1. Avatar for Gus
      Gus on
      Editor

      Hey Danny,

      Sorry to hear you’re having problems, here is an article (MotionPie Fast Network Camera) on Fast Network Camera as well as some troubleshooting! Hopefully this helps you out!

    2. Avatar for sunil
      sunil on

      how to configure network camera or ip camera to rpi3 …error in URL…..

  17. Avatar for Andromeda
    Andromeda on

    Hi,
    it is possible to continuously record video on a file for example one per day and disable after certain hours (working schedule) ?

    Thanks

  18. Avatar for Gary reardon
    Gary reardon on

    Will this work if using remote desktop?

    1. Avatar for Bil
      Bil on

      I have it all working but image quality is not good and the its VERY slow. Im not sure what settings to look at. im using a generic USB camera. I upped the frame rate to 15. resolution 680. Im using a wifi dongle (could that cause the latency?). Can you not connect more that one usb camera? It allows me to add a second but the image does not show, this could be the camera, i cant get it to show an image by itself. The interface takes forever (couple mins) to load. The camera constantly cuts out (the camera with a cross through sign). It was super easy to setup but im having a hard time using in practically. im a noob. raspberry pi B. Can i have it email me still images when i senses movement?

  19. Avatar for nick57
    nick57 on

    Thanking you for the nice sw, I tried to install it and all is working perfectly on my local network, but for me it was impossible to use a dyn DNS with noIP because, you need to install the client portion iof noIP on raspberry ..but, before to do it, you need to compile it…. at this point you do not have nor a make tool, nor a compiler gcc, not only but I was not able to get it: it is missing also the apt-get tool!!!. I’m new on Rpi… I’m sure I miss something, so please a little help for me… thank you very much. nick57

  20. Avatar for jim
    jim on

    Good morning. Your camera system looks fantastic. I have just tried to ssh into the pi to change some network settings. The default pi – raspberry username-password seems to have been disabled, could you tell me how I now log into the pi using ssh ?

    1. Avatar for Jon
      Jon on

      Default password for motion pie is the serial number of your pi. For example, motion pie mp-8181d18g has a default admin account with 8181d18g as the password. If you’ve changed the admin password via the web interface, then that overrides the default and so you use that.

      Cheers

      Jon

    2. Avatar for jim
      jim on

      Hi Jon,

      Thanks for your response. I can now ssh in, but I can’t sudo or su – these seem to have been disabled and /etc/fstab can only be editted by su…

      Cheers

      James

    3. Avatar for Dale Arnett
      Dale Arnett on

      So what is the login: ????
      admin or pi? I understand the password is the serial number.

    4. Avatar for Steve Bloom
      Steve Bloom on

      Hi Jon, This looks very interesting but I can not use it at all because of how locked up everything is. Since we don’t have a root password and we cant sudo anything then we can even change the setting for the wireless network. Could you please respond back with the password you used for root. Thank Steven

    5. Avatar for jaco
      jaco on

      Hi can you help?

      If i switch it on in give me a login mere-22c7bd0!

      What is the login and password I want it on wifi?

    6. Avatar for Gaute Eriksrød
      Gaute Eriksrød on

      Hi I’ve been trying to log on to the system but i only get “login incorrect “. Do you know what I’m doing wrong?

    7. Avatar for Anthony Pearia
      Anthony Pearia on

      What’s the username?

    8. Avatar for Zach
      Zach on

      Hello, so I’m not sure about your problems, but I had trouble with ssh until I found out the username was admin and leave the password field empty. If you change the admin name or password via the web interface then the ssh name or password will likewise change.

    9. Avatar for Manny
      Manny on

      user is Admin, leave pwd blank

    10. Avatar for jagath
      jagath on

      Can i use a mobile device as a camera? if so how to do it?

    11. Avatar for James
      James on

      Hi had the motion pie working I ve had to reinstall motion on the sd card it’s not showing up in my router how can I login

    12. Avatar for Thomas Allsop
      Thomas Allsop on

      Hi,

      I installed motion Pi on my Raspberry PI 3 but when I put the IP address of the PI into my browser nothing works? Please help 🙂

    13. Avatar for Rusty
      Rusty on

      Please help, you lost me at step 3. To login 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.

      I have the ip address of my Raspberry pi 3 it’s http://192.168.1.70/ I got the ip from my router.

      I entered the ip in my web browser and it just times out.

      I booted up my Pi and after about 10 min? the screen went black I assumed it was a screen saver???? but after messing with the keyboard and mouse and nothing happening I pulled the power cord on the Pi3 so it would reboot, it boots back up to a
      “Welcome to meye-dead8c9!
      meye-dead8c9 login: ”

      What is the login and trying to log in on the Pi3 screen do anything?

      Any screen shots or instruction videos of the setup?

      Thanks.

Leave a Reply

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