How to setup a Raspberry Pi security camera with motionEyeOS

When you want to turn your unused Raspberry Pi into a security camera, you can take a look at motionEyeOS.

So what is motionEyeOS? In short, motionEyeOS is a Linux distribution that turns your single board computer into a video surveillance system. Therefore, it is convenient to setup a Raspberry Pi security camera with motionEyeOS.

Given these points, let us look at how we can setup a Raspberry Pi security camera with motionEyeOS.

Steps to setup a Raspberry Pi security camera with motionEyeOS

Typically, setting up a Raspberry Pi security camera with motionEyeOS involves the following steps:

  1. Gather the hardware parts for your Raspberry Pi security camera.
  2. Download the motionEyeOS image for the Raspberry Pi board version that you are using for the security camera.
  3. Install motionEyeOS on your microSD card.
  4. Assemble the hardware parts for your Raspberry Pi security camera.
  5. Get the IP address of your Raspberry Pi security camera.
  6. Configure motionEye settings for your Raspberry Pi security camera.

1. Gathering the hardware parts for your Raspberry Pi security camera

If you are an ardent fan of Raspberry Pi, then you may find it easy to gather the hardware parts. However, if you are unable to do so, here are hardware combinations that you can procure for your Raspberry Pi security camera:

Parts to build a Raspberry Pi Zero W security camera

Parts to build a Raspberry Pi 3B+ security camera

Parts to install motionEyeOS onto the microSD card

2. Downloading the latest motionEyeOS image for the Raspberry Pi board version that you are using for the security camera

Once you have gotten the hardware parts to build your security camera, proceed to download a copy of motionEyeOS image. Given that, go to motionEyeOS latest release page with your web browser to find the image for your security camera.

When you do so, you should find a list of motionEyeOS images to download. For example, I got the following list at this point of writing:
motionEyeOS 20190911 release page on Github

So which motionEyeOS should you download? As shown above, you should look for an image with raspberrypi as part of the file name. In addition to that, you should download the one with the same version number as the Raspberry Pi board that you choose. When you have a Raspberry Pi Zero W, you will download the image for Raspberry Pi version 1.

If you are using a Raspberry Pi Zero W, then you will download motioneyeos-raspberrypi-20190911.img.xz.

However, if you are using a Raspberry Pi 3B+, then you will download motioneyeos-raspberrypi3-20190911.img.xz.

3. Installing motionEyeOS on your microSD card

Once you have downloaded a copy of motionEyeOS for your Raspberry Pi security camera, install it onto your microSD card.

In order to do so, you will need a tool like balenaEtcher. Given that, insert your microSD card into the microSD card drive/adapter of your computer and flash the image onto your microSD card:
writing motioneyeos-raspberrypi-20190911.img onto microSD card with balenaEtcher on macOS

Making your Raspberry Pi security camera connect to WiFi on first boot

If you are connecting your Raspberry Pi security camera through your WiFi network, then you may want to make it do so on first boot.

In order to do so, prepare a wpa_supplicant.conf file with the following contents:

update_config=1
ctrl_interface=/var/run/wpa_supplicant
 
network={
        scan_ssid=1
        ssid="wifiSsid"
        psk="wifiPassword" 
}

Once you have done so, reinsert your microSD card into the drive/adapter. When your computer detects your microSD card again, copy the file into the root directory of your microSD card:
root directory of motioneyeos-raspberrypi-20190911.img after pasting wpa_supplicant

4. Assembling the hardware parts for your Raspberry Pi security camera

At this point in time, you are ready to assemble the hardware parts for your Raspberry Pi security camera.

For Raspberry Pi Zero W security camera

Connect Raspberry Pi camera module to Raspberry Pi Zero W and the official case.

For Raspberry Pi 3B+ security camera

Connect the Raspberry Pi Camera Module to Raspberry Pi 3B+ and put it into the case.
When you have done so, your Raspberry Pi security camera should look like the following:
Raspberry Pi Zero W and Raspberry Pi 2 3 camera with mobile phone clips

5. Getting the IP address of your Raspberry Pi security camera

After you had assembled your Raspberry Pi security camera, supply power to it. If you are using an RJ45 cable, then connect the cable with your Raspberry Pi and switch port of your router.

When motionEyeOS loads, it will get an IP address from your router. Therefore, you can either get the IP address from your router portal or an IP scanning tool.

For example, if you are using a Linksys router, you can get the IP address of your Raspberry Pi security camera from Network map.
Linksys network map entry for MEYE-56F13C6F

As shown above, motionEyeOS will take a hostname in the form MEYE-XXXXXXXX. In this case, the motionEyeOS had gotten 192.168.1.136 as the IP address.

6. Configuring motionEye settings for your Raspberry Pi security camera

Given the IP address that you had gotten, access it with a browser from a computer in the same network. When you do so, you will find a video stream from your Raspberry Pi security camera.
First browser screenshot for motioneyeos-raspberrypi-20190911

At this point in time, you will be able to configure motionEye settings for your Raspberry Pi security camera.

Changing the login credentials for the admin user and surveillance user

When you click on the second button at the top left corner, you will be presented with the login screen. In order to change the login credentials, you need to login as the admin user. Therefore, enter admin in the Username field, leave the Password field empty and click Login:
Login screen for motioneyeos-raspberrypi-20190911 with admin in the Username field

After you had logged in, you will be presented with the video stream of your camera again. Next, click on the first button at the top left corner to access the settings drawer:
raspberrypi-20190911 with settings drawer collapsed

In addition to the admin user, there is a surveillance user as well. While the admin user can configure every setting on your security camera, the surveillance user can only view the video feed.

Another point to note is that we can create a custom username for the surveillance user but we cannot change the username for admin.

Given these points, provide a value for Admin Password, Surveillance Username and Surveillance Password. Once you have done so, click Apply to save the changes.
raspberrypi-20190911 dashboard with Admin Password Surveillance Username and Surveillance Password filled up

Changing video resolution of video feed

If you wish to increase the video resolution of your video feed, then you can do so via the Video Device section:
raspberrypi-20190911 dashboard showing video resolution settings

After you select your ideal video resolution, click on Apply to apply the changes. When you do so, you should see the video feed in the new resolution.

Enabling recording of still images and movies

If you wish to record your video feed, then you will want to enable recording of still images and movies:
raspberrypi-20190911 dashboard showing Still Images and Movies settings

As shown above, you can also decide the mode of capture, preservation periods and other relevant configurations.

Configuring motionEye to only capture video if there are movements in particular sections of the surveillance area

When you only want motion detection to trigger if parts of the video feed changes, you can check out the Motion Detection section. Given that, this is how to configure motionEye to only capture video if there are movements in particular sections of the surveillance area.

About Clivant

Clivant a.k.a Chai Heng enjoys composing software and building systems to serve people. He owns techcoil.com and hopes that whatever he had written and built so far had benefited people. All views expressed belongs to him and are not representative of the company that he works/worked for.