Introduction: How to Make Your Raspberry Pi Into a Security Camera Step by Step!

About: I am a middle school student and I am passionate about Science and Electronics I want to share what I learn with other kids and people from around the world.

This is how to make a security system out of your Raspberry Pi by using the "MotionEyeOS" operating system. The type of camera or model of Raspberry Pi you are using does not matter, as the operating system is for all models and most cameras are supported by the OS. MotionEyeOS is an operating system made for Raspberry Pi to make a working surveillance camera that can notify you when the camera detects motion. it can even send emails with attachments and back up photos and videos taken by the camera! This Instructable will guide you step-by-step to achieve this.


Article Used: Random Nerd Tutorials

Supplies

Things you need to purchase:

1 x Raspberry Pi ($120+) from Amazon

1 x MicroSD Card (included with Raspberry Pi)

1 x Micro USB Cable (the power supply is included)

1 x Ethernet Cable (~$12) from Amazon

1 x USB Camera ($20+) from Amazon


Things you should have:

1 x Computer (With Ethernet port, MicroSD slot)

1 x USB Keyboard

1 x Monitor

1 x HDMI Cable


Other items that should be set up before starting this project:

Access to the Internet

Access to a DropBox account

Access to an Outlook email account

Step 1: Format Your MicroSD Card

(YOUR MicroSD MAY NOT HAVE THE SAME NAME AS SHOWN IN THE ATTACHMENT ABOVE!)

Go to the article to:

  1. Download the SD card formatting software or click on this link right here: https://www.sdcard.org/downloads/formatter_4/ and
  2. Open it
  3. Make sure you have the MicroSD card inserted in your computer/laptop.
  4. select the "Overwrite format" option and click "Overwrite Format"
  5. My 32GB MicroSD card took about an hour. So this might be a little time consuming.

CAUTION: When you format your MicroSD card, you will lose all the data stored on it. Be careful when selecting which device to format.

Step 2: Downloading and Extracting the MotionEyeOS Image.

Now, it is time to download and extract the OS image. This can be done while the MicroSD is being formatted. Either look on the article to find the GitHub page or

  1. Click here to go to the GitHub Repo:
  2. You want to make sure what version you're downloading has the "Latest" tag. If there is an update, you will be able to find it on the GitHub page.
  3. Scroll down until you find the version of the OS that matches the model of your Raspberry Pi. If you can't find it, click on "Show all 16 assets"
  4. Download the file. Download to your local computer
  5. Extract the compressed file by alternate clicking the file and select "Extract". This will create an uncompressed image file

Step 3: Flash/Write the Image Onto the MicroSD

Before you being this step, your SD card must have completed formatting.

  1. Leave the MicroSD inserted in your computer
  2. Download Etcher, which is open source located here https://etcher.balena.io/
  3. Open Etcher software
  4. To flash the OS image onto the MicroSD,
  5. Click on "flash from File" and select the image file
  6. Then select target and choose your MicroSD card
  7. select the image file you extracted earlier and click "Flash"

This can take a few minutes. When it is finished flashing, you are good to go! Remove your MicroSD card from your computer and insert it into the Raspberry Pi.

Step 4: Booting Up MotionEyeOS for the First Time

To begin the booting process

  1. Make sure you have connected an Ethernet cable to your Raspberry Pi to the same network your computer. You might need a network switch to do so.
  2. Now you can attach your camera to your Raspberry Pi
  3. Attach the HDMI cable from your monitor to the Raspberry Pi
  4. When you are ready to power it up, plugged in the micro USB to its port on the Raspberry Pi
  5. You will see the system booting and then it will prompt you to login, the default username is 'admin' and the default password is empty. I highly recommend that you change it to a secure password
  6. Write down the IP address assigned to the Raspberry Pi. You will need to type this into a browser on your computer later to configure the MotionEyeOS. The IP address is highlighted with a red circle.

Troubleshooting

To make sure you're connected to the internet, you can try pinging google.com to see if you get a reply. If there are no timeout errors, press CTRL + C to stop pinging.

Step 5: How to Configure MotionEyeOS

So, now that you have the IP address, we can configure the application

  1. Open a new tab on your computer browser and paste the IP for example http://192.168.1.1
  2. You will get a login screen. The login is the exact same as before.
  3. Username: admin
  4. Password: [LEAVE BLANK] but change it later to a secure password!
  5. You might also want to toggle the "Remember Me" option so it is turned ON.
  6. Once logged in, you have to add a new camera. It will most likely show up as "USB Camera".

After this, you should be all done. There is a variety of options to configure for your camera. The next few steps are optional, in case you wanted to get an email notification when your camera detects motion. You can even back those videos up with Dropbox!

Step 6: Motion Detection/notifications/backup

To link your DropBox account, you must:

  1. Have an account to begin with.
  2. Once created, click "Obtain Key".
  3. Copy and paste the key in the "Authorization Key" field.
  4. Make sure file path name matches the one in DropBox (NOT case sensitive)

Once that's all finished, I recommend you copy my settings from the attachments above. The 'Email Address', 'SMTP Account', and 'From Address' fields all need to be your Outlook email address. You cannot use G-Mail or Google Drive anymore because Google stopped people from turning on the "Less Secure Apps" setting. Therefore, you cannot connect MotionEyeOS to Google.

Step 7: Test the Motion Detection Notifications

Lastly, move in front of the camera so it knows you are moving. It should:

  1. Send you an email with 5 images and timestamps (This could be different depending on your settings.)
  2. Put backed-up videos of captured movement in your DropBox video folder.

If it works, you finally have a working security camera. Although, since DropBox only gives you 2GB of storage, you should click the 'Movies' section in MotionEyeOS and configure the "Preserve Movies" setting to 1 week so you don't have to worry about that 2GB limit. Also keep in mind every time you boot up your Raspberry Pi again, you'll have to click "Obtain Key" again so you can generate a new one.