Create a Day & Night Vision Surveillance Camera Using Raspberry-Pi with Motioneyeos and Google Drive
Background story: A few months ago I bought a Raspberry-pi because I’d seen many people create cool stuff with it such as talking robots and home automation. However, after getting the device I found myself indecisive about which project to take on. Some projects required tools that I never worked with before and other projects didn’t have enough guidance on how to get started.
Recently, I came across a project that caught my attention. It was on how to make your own surveillance camera using a Raspberry-pi. At that moment my eyes lit up and I knew it would be a great project. So I decided to continue researching and there is a lot of resources and projects leading towards the same goal. Here are a few resources that were helpful:
- A video tutorial that taught me which software to use in order to burn image file to an SD card and Motioneyeos — https://youtu.be/GamMnQdRo7c
- Article tutorial that explains how to set up raspberry-pi with Motioneyeos and its configurations — https://bit.ly/2rJlQfY
Now let’s jump into how I created my surveillance camera merging the two resources above, as an FYI, I used a windows computer to do the below steps.
Step 1: Collect the resources! — you will need the following:
- A Raspberry-pi (I am using a Raspberry-pi 3 Model B)
- A compatible USB camera (I bought a Day/Night vision indoor/outdoor camera from amazon) — https://amzn.to/2MihIMg
- Mini SD card 8GB or 16GB (I am using a 16GB to be in the safe zone) — https://amzn.to/2vmyl2L
- Mini SD card reader (in case your micro SD card didn’t come with one)
- Wired internet connection (there is an option for wireless but i have not researched enough to attempt to use it)
- OPTIONAL — Powered USB hub, Im using a spare USB hub to take stress away from the Raspberry-pi. However, this is not needed if you are using a Raspberry-pi 3 BUT if you are using other Raspberry-pi’s I highly recommend you get one because the Raspberry-pi will not power your camera properly. — https://amzn.to/2ObSMXa
Step 2: Downloading the required software
Go to the following GitHub link and download the proper Motioneyeos image for your Raspberry-pi — https://github.com/ccrisan/motioneyeos/releases. Once downloaded, open the zip file and save the image file in a folder where you know the location of (your desktop is a good place).
Next, download Win32 disk imager https://sourceforge.net/projects/win32diskimager/ (this is compatible for windows machines only). If you are using a Mac, please follow the steps on how to burn images in the Raspberry-pi site or google what is t the best tool to do so. https://www.raspberrypi.org/documentation/installation/installing-images/mac.md
Step 3: Prepare your micro SD card with Motioneyeos.
Before continuing, make sure your micro SD card is formatted properly to FAT32.
- Connect your micro SD card to your computer and pay attention to the drive letter that it is assigned to (i.e. ‘H:’).
- Next, open Win32 Disk imager as administrator, click on the folder icon and navigate to the Motioneyeos image file that you downloaded and open it.
- Make sure that the Device drop-down points to the correct letter of your micro SD card. Now, you are ready to click Write, wait a couple of mins while the image is written to the SD card.
- Once completed, safely remove your SD card from your computer.
Step 4: Preparing the Raspberry-pi with the components.
Assembling the pieces together before turning on the Raspberry-pi.
- First insert the micro SD card to your Raspberry-pi, the powered USB hub with the Webcam connected, provide power to the powered USB hub, insert your ethernet wire. (OPTIONAL — if you have a monitor with HDMI adapter and connect that as well to confirm that the script of the Motioneyeos is running).
- Connect the power adapter to the Raspberry-pi. (If you connected the HDMI cable to your monitor you should see the Motioneyeos scrip run and ask for a login and password, ignore).
Step 5: Configuring Motioneyeos
Once you have confirmed that the Raspberry-pi is up and running, you will need to do the following:
- Go to your network/router settings and find the IP address on which the Rasberry-pi is running. Most of the time it is either 192.168.0.1 or 192.168.1.1.
- In your router settings check for connected devices and you should see a device with the name of meye-xxxxxxxx. Copy the IP address and paste in a new tab.
- In this new tab, you should see the Motioneye display asking for a username and password.
- The username should be admin, and the password is nothing just press the enter key.
Congratulations! you should have now set up your raspberry-pi and see a window with the active camera.
The picture below shows a desktop view of my camera outside during the night.
You can also visit your camera using the same IP as before through your phone. The picture below is how the view is from my iPhone.
Motioneyeos provides a vast amount of settings and resources that allow you to modify your camera according to your needs, so feel free to venture on and customize your device as needed.
Here is a video that explains some of the settings of Motioneyeos: https://youtu.be/sw_vGbxdQys
Step 6: Connecting your Motioneyeos feed to your Google Drive!
In order for this to be a real surveillance camera, we need to be able to go back and see what it has captured. The solution to this is saving any motion detected by the camera to your Google Drive. Follow the below steps:
- Login to your Google Drive account, create a folder in your Drive, and open its sharing setting and copy the shed URL.
- Go back to your Motineyeos IP address display, and click the circle with the three bars to open the settings tab, click on General settings > Turn Advance Settings On > Scroll down and click on File Storage > Click the Upload Service drop-down and select Google Drive > Under Location paste the shared URL you copied > Now click on the blue link that says Obtain Key > You should be taken to a series of steps to grant access to Google Drive > Once this is completed you are given an access key, Copy and paste it to Motioneyeos Authorization Key field > Next click the button Test Service and you should get a message “Accessing the upload service succeeded”. If you get a different message or a failed message please retrace your steps.
- Now click the red Apply button on the top.
- If you are successful, you should see a new folder created in your google drive that the device created mine says “https:” (Do not delete this new folder) if you click to open the folder you will encounter several embedded folders that will lead to your saved motion video/snapshots.
- The path looks something like:
Once I had figure out how to get my camera working and linked to my storage device, I decided to make a mini Raspberry-pi holder. I used a small piece of wood and placed the Raspberry-pi with the USB hub on the piece of wood. I then drilled a hole to make space for a screw so i could mount it on the wall. see the pictures below:
Thanks for reading! I hope this was helpful.