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

by Shayan09 in Circuits > Raspberry Pi

345 Views, 4 Favorites, 0 Comments

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

IMG_5708.jpg

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

Format Your MicroSD Card

Image 5-21-23 at 4.14 PM.jpg

(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.

Downloading and Extracting the MotionEyeOS Image.

Screenshot 2023-05-21 122254.png
Screenshot 2023-05-21 123059.png

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

Flash/Write the Image Onto the MicroSD

Screenshot 2023-05-21 at 1.52.35 PM.png

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.

Booting Up MotionEyeOS for the First Time

IMG_5697(1).jpg
IMG_5706.jpg
IMG_5707.jpg

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.

How to Configure MotionEyeOS

Screenshot 2023-05-21 131056.png
Screenshot 2023-05-21 151926.png

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!

Motion Detection/notifications/backup

Screenshot 2023-05-21 153710.png
Screenshot 2023-05-21 152544.png
Screenshot 2023-05-21 152355.png
Screenshot 2023-05-21 152216.png

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.

Test the Motion Detection Notifications

IMG_5709.jpg
Screenshot 2023-05-21 155246.png
Screenshot 2023-05-21 155534.png

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.