Using a Raspberry Pi and MotionEyeOS To Create a Home Security Camera

A few years ago, I had the desire to create a home security system. I at least wanted the ability to be notified when someone arrived at my house, and an image of them would be even better. I wasn’t as into Arduino and other microprocessors back then as I am now, however, I did like to tinker with Raspberry Pi’s.

So of course, I had an extra laying around. I started to see if anyone else had done something similar before. That was when I discovered MotionEyeOS. It is a lean Linux distribution designed for small computers like the Raspberry Pi. It is a very well made system, and I have been using it with few, although there have been some, errors for years.

In this project, I used all these parts:

The reason I’m using two Raspberry Pi’s is because I wanted to store the photos long-term on my own HDD. My HDD is being used, however, to house my media on another Raspberry Pi that is running LibreELEC as a media center. I’ll have another post about that, soon. This isn’t an issue for me, however. LibreELEC supports mounting the HDD on the network as a SAMBA share, and MotionEye supports saving images to SAMBA shares. If you wanted to only use one RPi and a USB Flash Drive that would work fine, too.


Here are some photos that show system and its functionality:

Encased with a 3D printed case, with the Xbox WebCam cord visible on top
Raspberry Pi with NoIR Camera mounted onto it, pointed towards the driveway
The Xbox 360 WebCam mounted towards the front Door
A screenshot of a motion notification from Pushover
Password Protected image viewing
The online image viewer that uses h5ai


The software I used to make this all happen includes:

Alright, now I’ll go ahead and explain how I set it all up. I’m not going to go into detail for every step, however if someone wants more depth on a specific part let me know.

First, I installed MotionEyeOS onto my RPi using this tutorial. After getting it set up, I plugged in each of my cameras and configured them how I wanted. Then, I set the following options as follows:

File Storage settings

I added the SAMBA share here, using the IP from my other RPi and the appropriate folder on the HDD. The command that I run to upload the picture to my external site is here, too. The whole command is

/root/ %H-%M-%S Doors %Y-%m-%d

Now, the script contains this code:



ssh EXTERNALDOMAIN “mkdir -p /usr/share/nginx/www/security/$CAMERA/$DATE”
echo “mkdir -p /usr/share/nginx/www/security/$CAMERA/$DATE”
scp $FILENAME user@EXTERNALDOMAIN:/usr/share/nginx/www/security/$CAMERA/$DATE/$1.jpg

This script is pretty simple. It creates the current day’s folder on the server if it doesn’t exist, then uploads it. The RPi uses certificates so that it doesn’t require a password every time it uploads a photo.

Still Images settings

I set the RPi to save still images when it detects motion. I also set the filename to match what I have in my scripts.

Motion notification settings

I could have easily just used a web hook to interface with Pushover, however I wanted to have my own script, as I may redo this project using an ESP8266 and a camera module. The command here is

/root/ %H:%M Doors %Y-%m-%d

and the code inside is



curl –data “token=REVOKED&user=REVOKED&message=$CAMERA&title=Motion Detected&url=https://EXTERNALDOMAIN/security/$CAMERA/$DATE/&sound=pushover”

This uses the API from Pushover, which is a paid app that lets you send yourself push notifications. I could have written my own app for this, however Pushover was quick and easy to use.

For a password protected link I used NGINX and its .htpassword support. A good tutorial on how to do that can be seen here.

The default folder browser for NGINX is ugly and doesn’t let you view the images easily. To make it look slightly prettier and easier to use I installed h5ai. Their website is a good place to start if you have never used it before.

This setup has been running well for a few years now, like I said. But I’d also like to redo it, using motion sensors and ESP8266’s. A setup like that would be cheaper and allow me to have cameras all around the house, not just the front door and driveway. If I ever get around to making a setup like that, I’ll make a new post! Thanks for reading.

9 thoughts on “Using a Raspberry Pi and MotionEyeOS To Create a Home Security Camera”

  1. Hi. I have checked your and i see you’ve got some duplicate content
    so probably it is the reason that you don’t rank hi in google.
    But you can fix this issue fast. There is a tool that creates content like human, just search in google:
    miftolo’s tools

  2. I like rock bands! I really do! And my favourite hard rock band is Hootie&Blowfish! All band members has came together to perform more than 50 concerts to their fans in 2019! To know more about Hootie & Blowfish in 2019 visit website Hootie and the Blowfish tour USA 2019. You won’t miss any concert this year if you visit the link!

  3. Good day!

    We advance

    Sending your message through the Contact us form which can be found on the sites in the contact section. Feedback forms are filled in by our software and the captcha is solved. The profit of this method is that messages sent through feedback forms are whitelisted. This technique increases the chances that your message will be read. Mailing is done in the same way as you received this message.
    Your message will be seen by millions of site administrators and those who have access to the sites!

    The cost of sending 1 million messages is $ 49 instead of $ 99. (you can select any country or country domain)
    All USA – (10 million messages sent) – $399 instead of $699
    All Europe (7 million messages sent)- $ 299 instead of $599
    All sites in the world (25 million messages sent) – $499 instead of $999

    Discounts are valid until April 20.
    Feedback and warranty!
    Delivery report!
    In the process of sending messages we don’t break the rules GDRP.

    This message is automatically generated to use our contacts for communication.

    Contact us.
    Telegram – @FeedbackFormEU
    Skype – FeedbackForm2019
    Email –

    Thanks for reading.

  4. Woah! I’m really loving the template/theme of this site. It’s simple, yet effective.
    A lot of times it’s difficult to get that “perfect balance” between user friendliness and appearance.
    I must say you have done a superb job with this.
    Also, the blog loads extremely fast for me on Firefox. Superb

Leave a Reply

Your email address will not be published. Required fields are marked *