How to Build a Raspberry Pi Security Surveillance Camera with MotionEye
Turning your Raspberry Pi into a security surveillance camera is a cheap alternative to setting up a security system in your house or office. The Raspberry Pi 3 is more then powerful to capture video with the Official Raspberry Pi camera. Today we will be installing MotionEye on our Raspberry Pi to turn it into a security camera. We will be able to view live video in our browser as well as auto record videos when motion is detected. This is great for saving precious space on our microSD card and only keeping the videos we need. We can also save the videos and delete them after a set amount of time. Setting up a Raspberry Pi security camera with MotionEye is very easy and works right out of the box with the default settings.
We will also be able to setup a network of security cameras with multiple Raspberry Pi’s and monitor all of camera over one interface. If cost and space is an issue it is possible to upload all our videos to your Dropbox or Google Drive account for easy access anywhere. This is a great low cost solution to building a security system in your house and you can also use it as an outdoor system as well to monitor your front door. There are a ton of Raspberry Pi compatible cameras you can use for the Raspberry Pi security camera and the choice is your’s depending on your needs. You can use the official Raspberry Pi camera that plugs into the camera port or you can use an old webcam that you have laying around and plug it into the USB port.
To build a Raspberry Pi security surveillance camera system that is run and controlled over your own network
You will need the following:
- Raspberry Pi
- 8GB Micro SD Card (Bigger SD card if you plan on saving the video to the SD card)
- 2.5A Power Supply
Let’s get started. We will first need to install our camera onto the Raspberry Pi by plugging it into the camera port. I am using the official NOIR Raspberry Pi camera in this tutorial, however you can use whatever camera is compatible with the Raspberry Pi. Plug your camera’s ribbon cable into the camera ribbon slot on the Raspberry Pi board, the camera ribbon port is the one located behind the Ethernet port. You your fingers to pull up on both sides of the connector to open it up and insert the ribbon cable with the metal leads facing away from the Ethernet port. Once the ribbon cable is seated all the way inside the connector you can push down on the connector to lock the camera’s ribbon cable in place. It is important that the metal leads face away from the Ethernet port or your camera may not work or even worse it can be shorted.
Install the MotionEye Image
I will not be going into detail on how to burn the MotionEye image onto your microSD card. Just follow the same steps as if you were burning the Raspbian image onto your microSD card. If you need help putting the MotionEye image on your microSD card you can follow the official tutorial here.
You will need to go to the MotionEye downloads page to download the image for our Raspberry Pi. The Raspberry Pi images should be located toward the bottom of the page, download the zip file which will contain the image.
Setting up your Raspberry Pi Security Camera and Logging In
You will need to setup your Raspberry Pi security camera before using it so you can make adjustments on how you want your security system to work. You can change the resolution of the video being recorded as well as changing the framerate. The first time you boot your Raspberry Pi security camera you will need to connect it over an Ethernet cable, you can set it up for WiFi after. Plug in your Ethernet cable and boot up your Raspberry Pi. You do not need a keyboard or monitor attached to make any adjustments, we will be changing all the settings through our browser.
Once the Raspberry Pi is booted we will need to find the IP Address of our Raspberry Pi security camera. The way I do it is through my router. You should be able to go to your routers configuration screen and see attached devices. Once you find the IP Address open up your web browser and type in the IP Address for your Raspberry Pi, in my case my router assigned 192.168.1.49 as my Raspberry Pi security cameras IP Address. You should see your camera being displayed in your browser.
Login to your MotionEye security camera by clicking the little face icon, you should see a login screen popup. The default login for MotionEye is admin and no password. Login to MotionEye and you will be able to configure all your security camera’s settings.
Overview of the MotionEye Raspberry Pi Security Camera Settings
Below is a short list of options you can configure for your surveillance camera.
The general settings tab will have many of the basic settings like allowing you to change the admin name and password and enabling advanced settings. You’ll want to enable the advanced settings to show more menus and make more changes to your Raspberry Pi surveillance camera. The general settings tab will show you MotionEye’s current version and allow you to check for updates and perform the updates if they are available.
The network settings tab will allow you to enable WiFi access for your surveillance camera. You will be able to enter in your SSID and password so that the Raspberry Pi surveillance camera will be able to connect to your WiFi network and you can remove the Ethernet cable.
Enable extra services with the service settings menu. The extra services you can enable with MotionEye are FTP, Samba and SSH support. These will come in handy depending on how you want to transfer your security cameras videos and pictures.
Video Device Settings
The video device setting will configure your Raspberry Pi security cameras settings. You’ll be able to adjust the resolution that video will record as well as the frame rate to record the video at. The higher the frame rate is the smoother the video being recorded will be, however the video file will be larger and take up more space on your storage system.
File Storage Settings
The file storage settings will allow you to define the path for where to store the security cameras videos and photos. The file storage screen will also display the disk usage which you can monitor and check whether you need to delete videos to free up space. The important option here is you can setup external storage like Google Drive or Dropbox on this screen. This will allow you to upload your Raspberry Pi’s security camera system to upload to the cloud and access your videos anywhere in the world.
Video Streaming Settings
The video streaming settings will allow you to configure the settings for when you stream video through the browser. The main setting to lookout for here is the frame rate that is being streamed. This is all dependent on your network for smooth streaming, but can be adjusted higher in most cases because the video is not being recorded and will not use up disk space. If you do end up viewing your camera live from outside your network then you may want to choose a lower frame rate.
Motion Detection Settings
The motion detection settings will allow you to configure your security cameras settings for recording a change in motion. You’ll be able to adjust your frame change threshold and adjust how many frame to record before and after motion is detected. You can play around with these settings and see which settings work best for your setup.
I didn’t cover each and every setting that can be done with the MotionEye security system but you should now have a solid stepping stone into setting up your own Raspberry Pi security camera. The Raspberry Pi works great because of it’s cheap price and multiple cameras you can choose from to setup your surveillance system. IF you have any questions or tips about setting up a security system on the Raspberry Pi leave a comment below.