In this project you will learn how to turn your PI into a video surveillance system with motion detection and cloud hosted media backup. This is a great project for monitoring pets while you are away or as a security system for your home.

At the end of this project you will have a fully functioning surveillance system triggered by activity in the camera’s field of view with a video record saved to Google drive

1. Get your Pi ready

  • You should start with a switched-on Raspberry Pi connected to mouse, keyboard and monitor, you can learn here how to do it using an Okdo Pi kit
  • Ensure that you have the latest version of Raspbian installed on your Pi. You can learn here how to do it directly from your Pi using Terminal and here using a micro SD card.

2. Connect the camera

  • Connect the camera module to the PI’s camera connector using the ribbon cable provided with the camera. Make sure that the silver contacts on the cable face towards the mini HDMI connectors. Gently pull the connector lock up, slide in the cable and push the lock back down.
  • Connect an ethernet cable to the PI. This can be changed to a Wifi connection later. No keyboard or monitor are necessary.

3. Install motionEye

4. First boot

  • Your SD card should now contain motionEye OS for Raspberry Pi, eject it and place it in the card reader of your Pi. Connect the power supply and the system should start up. Allow about 60 seconds for the system to fully boot.
  • Open a browser on your host PC. Use your routers network settings to locate the IP address of the new device on your network. On our router this was in the advanced settings menu. The new device can be seen with hostname meye-ff6ec1e5 on IP address 192.168.1.100 in the LAN segment in this example.

  • Open another browser window and enter the device IP address in the search box. If all went well, this will open the web interface of motionEyeOS and you should see a streaming image from the Pi’s camera.

5. motionEye settings

  • Initially motionEyeOS logs in as user. To change the configuration log in as admin by clicking the user icon, there is no password. You can then display the settings by clicking the menu icon on the top left . At this point it is advisable to set passwords for admin and user and to set your time zone. Any changes need to be saved by using the Apply button that will appear.

6. Network configuration

  • Initially motionEyeOS uses DHCP to configure its network IP address but as this can change, it is recommended to set a fixed IP address for the device. To do this you need to know the IP address range for DHCP on your router and choose an unused IP address that is out of this range. This will enable your device to have a constant IP address.
  • Once a suitable address has been chosen, click on the Network settings dropdown and select Manual IP configuration. Enter your chosen IP address and the Default gateway address, this is usually the address of your router. This will give your device internet access. At this stage you can also enable Wifi by turning on Wireless Network and entering your credentials. When these changes are applied a reboot is required.
  • Re-attach your device by typing the new IP address in your browser.

7. File storage

The final configuration step is to setup access to Google Drive so that copies of the video capture are stored online for easy access and backup.

  • Select the File Storage dropdown and switch on Upload Media Files.
  • Select Google Drive as the upload service.
  • Set a name for the remote directory on the drive. This should start and end with a forward slash. The directory will be created automatically.
  • Click on Obtain key to access the service, this will open a window asking you to sign in to your Google account and allow motionEye access to your drive. It has full access so it may be wise to set up a separate Google account specifically for this purpose. Once access is granted the obtained key can be copied into the Authorization Key textbox and a test performed. If all goes well the settings can then be saved. motionsEyeOS will now upload any video files to you Google drive so you can access them from any device.

If you have any problems with your device you can check the log for debug information. Use a terminal on your host to gain ssh access and check the log at /var/log/motioneye.log:

You should now have a fully functioning motion activated surveillance system that will automatically upload any video files to your Google Drive where you can access them from any device.

There are lots of settings to fine tune the performance of the system:

  • Email notifications and even web hooks so you can integrate with other services like SMS
  • Setup a network of cameras that are attached to a central motionEyeOS server to extend the reach of the system.
  • Write your own scripts in Python or Bash that trigger when motion events occur, the possibilities are endless…

8. Safe shutdown

  • Always use the shutdown button in the admin interface before removing the power from the Pi to avoid corruption of your SD card

Like what you read? Why not show your appreciation by giving some love.

From a quick tap to smashing that love button and show how much you enjoyed this project.

Privacy

Our website uses cookies and similar technologies to provide you with a better service while searching or placing an order, for analytical purposes and to personalise our advertising. You can change your cookie settings by reading our cookie policy. Otherwise, we’ll assume you’re OK with our use of cookies.