Raspberry Pi Zero W Surveillance Camera using MotionEye OS

Published  September 30, 2021   0
Raspberry Pi Zero W Surveillance Camera using MotionEye OS

Security is one of the main concerns now days, and there are numerous technologies available to keep your home/office safe and monitored. CCTV and IP cameras are an excellent way to monitor your home or office but setting up these cameras remain prohibitively expensive.  So, in this tutorial we are going to build a Surveillance Camera using Raspberry Pi zero W, Pi camera module and MotionEYE OS. This is a fantastic and inexpensive security tool with numerous configurable features that can be set up in a matter of minutes. Although it cannot wholly replace the role of CCTV and IP surveillance cameras but will make it easy for low-income home owners to monitor their homes at a very affordable price.

Introduction to MotionEYE OS

MotionEye OS is a free open-source application that turns a Raspberry Pi with a camera into a home video surveillance system, with photographs and movies that may either stay on your device (and home network) or can be automatically sent to a cloud-storage service like Google Drive or Dropbox. It is a Linux-based OS that transforms a single-board computer into a security system. The operating system is based on BuildRoot, with motion as the backend and motionEye as the frontend.

Features

  • Easy installation and setup
  • Web-based, mobile/tablet-friendly user interface
  • Compatible with most USB cameras as well as with the Raspberry PI camera module
  • Support for IP (network) cameras
  • Motion detection with email notifications and working schedule
  • JPEG files for still images, AVI files for videos
  • Timelapse movies
  • Connects to your local network using ethernet or wifi
  • File storage on SD card, USB drive or network SMB share
  • Uploading of media files to cloud storage services (Google Drive, Dropbox)
  • Media files are visible in the local network as SMB shares
  • Media files can also be accessed through the built-in FTP server or SFTP server

Components Required Building a Surveillance Camera

  • Raspberry Pi Zero W
  • Monitor
  • USB Hub
  • OTG Cable
  • Micro HDMI
  • Micro SD card

Installing MotionEYE OS on Raspberry pi zero W

Step-1 Open this link and download the MotionEYE OS for Raspberry Pi zero W. Keep in mind that it itself is an OS, and you should not install any other operating system on Pi zero W. In the below image, you can see all the MotionEYE OS available. Click on the red circle link and your MotionEYE OS will start downloading. After downloading, extract the downloaded file by using WinRAR software. Here, we have used WinRAR for extraction but you can use any software for extraction like WinRAR or Easy 7-zip.

Installing MotionEYE OS on Raspberry pi zero W

Step-2 You should insert a micro-SD card into your computer. Here, I am going to use 16GB micro-SD card.  Now, open this link to download the raspberry pi imager software then install and open Raspberry Pi imager software. Select the extracted MotionEYE operating system by using the choose OS option. Select your micro-SD card by using storage option and then click on the write button. MotionEYE OS will be installed in few minutes.

Raspberry Pi Imager

Step-3 Now, you need to connect the Raspberry Pi zero W with Wi-Fi network. To do this, open the micro-SD card and create a text file named wpa_supplicant.conf in the root directory of the micro-SD card.  This file will help you to setup a Wi-Fi connection on Raspberry Pi zero W so paste the below lines of code in the config file

country=IN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
scan_ssid=1
ssid=" Wifi Name "
psk=" Wifi Password"
}

I have written IN country code here. You can enter your country code. For example, if you are from the United States of America, then use country code US instead of IN. Use your actual WiFi name and password in ssid and psk.

Raspberry Pi Surveillance Camera

Step-4 Connect your monitor with Raspberry Pi zero W by using micro-HDMI cable and connect OTG cable to Raspberry Pi zero W. Now, connect mouse and keyboard to Raspberry Pi zero W using USB hub. Lastly, connect your Pi camera with Raspberry Pi zero W board. We have explained pi camera interfacing with raspberry pi zero W in our previous tutorial. In above image, you can see all connections on Raspberry Pi zero W. Now, every connection has been completed so power up the Raspberry Pi zero W by using micro-USB cable. Raspberry pi zero W starts booting and you will see below image on your monitor display. Make sure after booting your Pi camera red light should glow.

MotionEye OS Booting

Step-5 You can see meye-77f2ebad login: line on your monitor display. Here, you have to put user name. Enter admin as a user name with a blank password. You don’t need to type any password, just press enter. Now your monitor display should be look like this.

MotionEye OS Booting

Step-6 Open web browser in your PC and make sure that your PC is connected to same Wi-Fi network as Raspberry Pi zero W. Now, enter the IP address of your Raspberry Pi zero W in web browser. If you could not find IP address of your Raspberry Pi zero W, you can get it by using some applications. Here, we have connected our Raspberry Pi zero W and PC with mobile hotspot. You should download Wi-Fi router manager android app in your mobile phone. Connect all the devices including Pi zero W to your mobile hotspot network. Open Wi-Fi router manager app, it will automatic starts searching the connected device. Now, select the device details option and then you will get IP address of your Raspberry Pi zero W board.

Raspberry Pi Wi-FI Router Manager App

After entering the IP address of your Raspberry Pi in your browser, you will see below screen in your browser. Enter the username and password same as before.

MotionEye OS Login Window

Now, you will be able to see live surveillance on your browser from Pi camera. In the below picture, you can see surveillance from pi zero camera. We can add more cameras to same MotionEYE OS.

Raspberry Pi Zero W Surveillance Camera using MotionEye OS

3D Printing of Security Camera Case

As this project will be used in surveillance purpose, I decided to 3D print an enclosure for raspberry pi security camera. I measured the dimensions of the setup using vernier to design a casing. Once it was done, my design looked something like this.

3D Printing of Security Camera Case Design

After I was satisfied with the design, I exported it as an STL file, sliced it based on printer settings, and finally printed it. The STL file is also available for download from Thingiverse and you can print your own casing using it. You can see printed security camera case in below image.

3D Printed Casing

After the print was done, I proceeded with assembling the project set-up in a permanent enclosure for future use. Once the complete connection was done, I assembled the circuit into my casing and everything was nicely fit as you can see below:

Raspberry Pi Surveillance Camera

Finally. I have wrapped some stickers on it and I have mounted the Raspberry Pi zero security camera on the wall. You can see final view of Wi-Fi security camera in below images.

Surveillance Camera using Raspberry Pi Zero W

So, this is how you can install MotionEYE OS on Raspberry Pi zero W and built Raspberry Pi surveillance camera. In the upcoming tutorial of Raspberry Pi Zero W series, we will make Alexa using Raspberry Pi zero W by using API. Hope you enjoyed the project and learned something useful, if you have any questions, please leave them in the comment section below or use our forum to start a discussion on this.

Video

Have any question realated to this Article?

Ask Our Community Members