Raspberry Pi CCTV – Using MotionEye (Formerly MotionPi)
There’s a few alternative ways to set up your own Raspberry Pi CCTV system and I find MotionEye to be the easiest and most efficient. So, without further hesitation I’ll start with my Raspberry Pi CCTV project.
I’ve found from my own searching that not only does MotionEye provide a live stream for you, it also has the ability to save images and video clips of motion and keep them for however long you wish to them last. This unique option allows you to set the stored videos to expire after a day, week, month or if you prefer; never!
In my case I’m using a Raspberry Pi 2 and a Raspberry Pi Camera for my Raspberry Pi CCTV setup. I can also confirm this works well on the New Raspberry Pi 3 B as an alternative if you have the latest version.
You will require a few things to get started with your Raspberry Pi CCTV setup:
- Raspberry Pi
- Raspberry Pi Camera or compatible Webcam
- Ethernet cable
- Micro-SD Card (8GB or Larger)
- Wireless Adapter
- Large SD Card or NAS storage
*Anything featured in bold is an essential requirement. Please note you will need an ethernet cable initially to connect to the Raspberry Pi, once connected you will be able to modify the settings to allow for Wifi connectivity.
1) Firstly, you will need to download MotionEyeOS from Github, this is available for download from the following location: MotionEyeOs releases. It’s best to select the one compatible with your device, once downloaded extract the .img.gz file and it should contain a .img file. You can exctract an img.gz file using the likes of 7-Zip.
2) Secondly, Format the MicroSD card to FAT32 ready for burning the MotionEyeOS image file to the MicroSD Card.
To do this I am using Apple-Pi Baker as I frequently use an Apple Macbook but there are Windows alternatives such as Win32DiskImager that are capable of doing the same thing.
Once you have formatted the MicroSD Card you shall now be able to write the MotionEyeOS image (file extension: .img) file to the MicroSD Card.
As seen below, I have selected from my file location the image file I wish to burn to the MicroSD Card. You can commence the process of burning on Apple-Pi Baker by pressing the ‘Restore Backup’ button.
3) Insert the Micro-SD card into the Raspberry Pi and turn on the device, make sure that the ethernet cable is connected to the device and that the camera whether it’s a USB connected webcam or ribbon Raspberry Pi Camera is connected to the device.
4) Navigate to your router, as this is the easiest way to find the local IP address of the Raspberry Pi, in which case mine is 192.168.0.19!
As seen above, this is shown in a connected devices menu on my router. However, there are some alternatives to finding the IP Address of devices on the network; such as on Mac OSX by using the command below. I have also included the results of this command so you can familiarise yourself. Hopefully if you have not got a lot of network devices you should be able to distinguish which one is the Raspberry Pi quickly from the list, or alternatively follow the next step with each IP address until a page loads.
My result of the arp -a command:
Matthews-MacBook-Pro-2:~ Matthew$ arp -a
? (192.168.0.1) at c4:*:**:**:**:** on en0 ifscope [ethernet]
? (192.168.0.2) at (incomplete) on en0 ifscope permanent [ethernet]
? (192.168.0.5) at (incomplete) on en0 ifscope [ethernet]
? (192.168.0.6) at (incomplete) on en0 ifscope [ethernet]
? (192.168.0.8) at (incomplete) on en0 ifscope [ethernet]
? (192.168.0.9) at (incomplete) on en0 ifscope [ethernet]
? (192.168.0.10) at (incomplete) on en0 ifscope [ethernet]
? (192.168.0.11) at (incomplete) on en0 ifscope [ethernet]
? (192.168.0.12) at (incomplete) on en0 ifscope [ethernet]
? (192.168.0.17) at (incomplete) on en0 ifscope [ethernet]
? (192.168.0.18) at (incomplete) on en0 ifscope [ethernet]
? (192.168.0.19) at (incomplete) on en0 ifscope [ethernet]
? (192.168.0.250) at (incomplete) on en0 ifscope [ethernet]
? (192.168.0.255) at (incomplete) on en0 ifscope [ethernet]
? (184.108.40.206) at (incomplete) on en0 ifscope permanent [ethernet]
5) You will be presented with a web page named MotionEye when you enter the IP address of the Raspberry Pi in your web browser, the page is best viewed on the Google Chrome web browser.
6) You must login to edit any settings on MotionEye and to do this you can select the person icon on the top left. You will then be presented with a login box. The username by default is admin and leave the password field blank.
7) Once logged in, press the 3 horizontal lines next to the login icon and this will open up a menu. Within this you will be able to add custom settings, I advise navigating to General tab and enabling Advanced Settings as this allows you to enable Wifi by navigating to the Network tab and filling in your Network name (as it shows on your wifi list) and the password. You will be able to unplug the ethernet port once you’ve entered the wifi details and pressed apply and the Raspberry Pi CCTV device has restarted. Now your IP address may have changed but this is because the Raspberry Pi is now Wireless.
8) By default MotionEye will save any “Motion Movies” or captured movement to the SD card, this can be customised to save to a Network Attached Storage (NAS) device or a USB stick. To avoid this, you could purchase a larger Micr0-SD card and set the file retention to a day or a week so all files are cleared and there is free space for new files to be re-wrote.
9) The best technique is to modify a few of the settings and make sure the resolution of the camera is set to what you want, I have mine set as 640×480 as this makes the whole view visible on a small monitor. Within the options you can also disable the red recording LED, which is enabled by default on the Raspberry PI Camera! Have fun!
Extra info and FAQ:
Help the video is a bit jumpy!
Sorry, this may be the case as the performance of the Raspberry Pi is limited. Best to modify a few settings to fit your needs but as it’s only a Raspberry PI CCTV system and not an expensive alternative it does it’s job. To improve this, you could lower video quality and resolution. I found everything may jump a little on stream but on the recording the quality is improved.
What’s the login to SSH?
The login to SSH is “admin” or “root” – the password is the text that appears in the header of the page on the MotionEyeOS IP address.
In my case it’s the following, remove the “meye-” and the password, in this images case would be “cdd1488d”.
How do I stream just the camera?
If you enable Movie Stream on the camera and enter the IP address of Motioneye and port in your URL box on the browser for example: http://192.168.0.19:8081 it will show you a direct stream of the camera!
It takes ages to load?
If you’ve just booted the device or made a change be patient as it may take a while to change and then reboot, reconnect to the network. The device works better on Ethernet, as it’s quicker and more responsive however still functions relatively well on Wireless networks.
Feel free to share your MotionEye CCTV projects and experiences below, I love to hear the fun things that people have used this project for!