Jump to content
zapptheman

[Tutorial] Creating a home made surveillance system - MotioneyeOS

Recommended Posts

Posted (edited)

Hi guys. 

 

Welcome to my first Raspberry Pi Tutorial. 

 

As usual, i have a video below showing how to achieve a simple installation and set up the OS to work how you want it to work. Below i will have some written instructions you can follow :) feel free to ask any questions you may have below. 

 

Video:

 

 

Written Tutorial:

 

What you will need:


Pi Kit

Wifi Dongle

Fan

- Camera

Enclosure

- Micro SD card (4GB or more)

 

Optional Extras if you are adding the Alarm System:

Siren

12V Power Supply

Relay

Wire

Jumper leads
 

Downloads:

MotioneyeOS Image

- Imaging tool for SD card

- Putty (if you are adding extra buttons and features)

 

WARNING! Before we continue, I am not responsible for anything you do which may damage any of your hardware, or cause you to loose any files/folders or data on your computer if you are not careful.

 

Step 1 - You need to purchase the Pi and components to get this running. 

Step 2 - Download the appropriate downloads for the project\

Step 3 - Format your SD card to Fat 32 (insert into your PC and right click on it --> format --> Fat32

Step 4 - open Win32DiskImager and install it

Step 5 - Open installed Win32DiskImager

Step 6 - Click on the folder icon next to the drive letter and seek to the .img file you downloaded. Should be named something like "motioneyeos-raspberrypi3-dev20180712.img"

Step 7 - Select the drive you want to install to (make sure this is your SD card otherwise you may wipe the wrong thing). Then click write, followed by Yes to continue.

Step 8 - Once complete, safely eject the SD card and insert into your raspberry Pi.

Step 9 - Connect your Pi to a USB keyboard, Ethernet, HDMI, and plug in the power cord to boot for the first time. If all worked well you should see a red light on your Pi, followed by a blinking green light. (if you don't see the green light blinking, check to see if there is any output on your screen, if not, you probably did not format the SD card correctly.)

Step 10 - If the Pi booted successfully, you should see a terminal on screen. You should be able to login by typing 'Admin' as the username, and leave the Password blank, this should work. (if not, please let me know so i can try help you, you may be on a different version of the OS)

Step 11 - If booted without any issues, you should now be able to access the lovely GUI webpage through your browser. You will need to find out the IP address of the PI, you can do this through your router, or with phone apps such as fing

Step 12 - Once you know the IP address of your Pi, Enter it into your web browser of choice, and you should see the Lovely GUI pop up. 

Step 13 - Plug in your cameras via USB (i recommend using no more than 2 as the Pi may not be powerful enough to run them depending on the applications you are using them in)

Step 14 - click on the 3 horizontal bars on the top left, then click the 'Add Camera Button' you can add the cameras here.

Step 15 - Go through the settings and tweek them for your use. 

Step 16 - Set a Static IP so your Pi doesn't randomly change addresses on you

Step 17 - That's it! if you are just setting up the simple version, you are done! Congrats!!! If you would like to know some more advanced things, stick around for more.

 

Advanced:

Step 18 - If you would like to receive email notifications whenever your camera senses motion, simply enable Motion Detection This can be enabled through the Motion Detection Menu.

Step 19 - It is recommended to set up an email account which belongs to your PI with Gmail, and make sure it has been enabled to accept insecure sessions.

Step 20 - You will need to put in the following details for Motion Notifications

 

Email Addresses: <write your email address which you want the notifications sent to>

SMTP Server: smtp.gmail.com

SMTP Port: 587

SMTP Account: <Write the email address you created for your Pi to use>

SMTP Password: <Write the password for the email address above here so the OS can access the account>

From Address: <it is recommended you use the same address as the SMTP Account>

Use TLD: "ON"

Attached Pictures Time Span: <You will need to play with this time as it will be dependent on your internet speed, i would recommend putting it as low as you can before it starts sending emails without images. This is the time the device will wait for images to be uploaded before sending the email (i use 40)

 

Step 21: Profit?

 

That's all if you are satisfied with the current outcome. If you would like to know more such as how to connect an alarm/light, or anything to the system, and you want to make it remotely triggered, then keep reading

 

Part 2:

 

Video:

 

Step 1 - Wire up the pi and alarm according to the wiring diagram i will attach below

 

l3f5xc9.png

Step 2 - Once wired correctly, you will need to now configure the software on the pi. Make sure to boot your pi into motioneyeOS

Step 3 - Download and install a tool to SSH into your pi (eg. Putty, or if you are using mac or linux then terminal will suffice) 

Step 4 - SSH into your pi with the following credentials (User = admin, Password = <Password you set in the web GUI for the admin>)

 

You can do this through terminal by typing the following code

 SSH admin@<YourPi'sIPAddress> 

It will then ask you for the password.

 

Step 5 - Once logged in, you will need to go to the correct directory and make some files to run. Enter the following commands to get to the correct DIR

CD /data/etc

Step 6 - You need to decide what icon you would like your button to have, you can choose from any of the following

lock
unlock
light_on
light_off
alarm_on
alarm_off
up
right
down
left
zoom_in
zoom_out
preset1 to preset9

Step 7 - You will now need to create the text documents which will be executed on demand. So pick an icon and enter the following commands. I chose <alarm_on> (Make sure that you substitute "alarm_on" for the icon you want to use)

nano alarm_on_1

Notice i include the "_1" at the end, this is because i have multiple cameras connected. If you only have one, then you only need to do "_1" at the end. Then type the following into the text editor.

GPIO=18
test -e /sys/class/gpio/gpio$GPIO || echo $GPIO > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio$GPIO/direction
echo 1 > /sys/class/gpio/gpio$GPIO/value

The code above will TURN ON whatever device you have connected, Or in other words, toggle it on. 

 

NOTE: IF YOU USE A DIFFERENT GPIO PIN, THEN YOU WILL NEED TO CHANGE THAT AT THE TOP LINE WHERE IT SAID "GPIO=18" CHANGE IT TO WHATEVER PIN YOU USED.

 

Step 8 - You now need to save the file you just made. Do so by pressing [CTRL + X] and followed by [Y]

Step 9 - You now need to create the toggle off switch. So similarly, we are creating a new text file with the following commands

nano alarm_off_1:

And enter the following text into the text editor

GPIO=18
test -e /sys/class/gpio/gpio$GPIO || echo $GPIO > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio$GPIO/direction
echo 0 > /sys/class/gpio/gpio$GPIO/value

Step 10 - save this by pressing [CTRL + X] and followed by [Y]

Step 11 - Repeat steps 7 - 10 changing the number at the end of the file "_1" to "_2" or "_3" if you have multiple cameras and want the button to show up on all of them.

Step 12 - Repeat steps 6 - 10 if you would like a different button to show up for a different toggle of your choosing, remembering to change the GPIO=18 to whatever pin you have used.

Step 13 - Now we need to make them executable... Do this by typing the following command.

CHMOD +x <alarm_off_1>
CHMOD +x <alarm_on_1>

Step 14 - reload the web interface for your pi and see if the buttons show up (if not, just do a software reboot from the pi)

Step 15 - Test it if you dare! You should now be able to toggle it on and off!

Step 16 - Profit?

 

Hope you guys enjoyed. If i helped, please feel free to leave a like so i know you are interested in seeing more tutorials like this XD Let me know if there is anything you need help with or you think i could have improved on. 

 

Thumbnail: 

WmtiuzA.jpg

Edited by zapptheman
Adding Part 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×