Instructables

Raspberry Pi DropCam Alternative

Picture of Raspberry Pi DropCam Alternative
I was looking for a way to check in on my house while away as well as have any motion captured and uploaded to the internet as a security camera. Doing a little research online and realizing that I had a raspberry pi and a usb webcam not being used for anything else, This is what I put together.

Please note, this is a brute force method and does not provide any type of security to the webcams stream but its my first time working on something like this.
 
Remove these adsRemove these ads by Signing Up

Step 1: Resources

I have to start with credit to the websites that I used for my research:

http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome - The software I used was called Motion, it handles the streaming of the webcam to the web as well as detecting motion and saving the movie files.

https://github.com/andreafabrizi/Dropbox-Uploader - This software allow you to sync your files into a Dropbox Account

http://www.slblabs.com/2012/09/26/rpi-webcam-stream/ - This site explains a few different ways to setup the camera on the raspberry pi to set up a simple web stream of the image.

http://mogshade.wordpress.com/2012/12/23/simple-home-security-with-raspberry-pi-and-dropbox/ - This site is where i started with for implementing the upload of the movie files to a Dropbox account

http://www.instructables.com/id/Host-your-website-on-Raspberry-pi/ - This Instructable was used to set up a simple website to view your Web Stream from.

Step 2: Setting Up Your Raspberry Pi

Picture of Setting Up Your Raspberry Pi
First things first. The raspberry pi should be setup with a standard version of Raspbian. If any help on doing this is needed please refer to http://www.raspberrypi.org/ or http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-and-sd-card-for-your-raspberry-pi

We also need to setup a SSH connection to access the Raspberry Pi remotely. So do this refer to http://raspberrypi4dummies.wordpress.com/2013/03/17/connect-to-the-raspberry-pi-via-ssh-putty/

Now You should setup port forwarding for your raspberry pi for both port 80 and 8081
while you are in your router settings also write down your Raspberry Pi's Public IP address as it will be what we use in the next few steps.

sudo service motion restart << for start motion

sudo apt-get install motion << it's work for me

Am I correct in thinking with dropbox uploader you have to specify the destination folder as well as the local location nowadays?

This works-

cmd = "/home/pi/Dropbox-Uploader/dropbox_uploader.sh upload %s %s %s" %(path + file_name," ",path + file_name)

tmv221 month ago

uploader.py is not working. i get this error message "Uploaded

Traceback (most recent call last):

File "/home/pi/uploader.py", line 15, in <module>

upload_files()

File "/home/pi/uploader.py", line 12, in upload_files

os.remove(path + file_name)

OSError: [Errno 13] Permission denied: '/tmp/motion/01-20140316154001.avi'"

tmv221 month ago

i followed all the steps! everything worked EXCEPT step 8. when login to my dropbox, the folder is empty. what went wrong?

nochanceinhell3856 (author)  tmv221 month ago

Hmmmm I know I had trouble with the dropbox upload at first. Did everything else seem to go well? Is the basic web page streaming the image? Did you get any errors when running through Step 6? I have to update Step 7 but I believe the code in the image is correct and the code in the text of step 7 is not. Python is also indent driven so all of the indents needs to be correct.

When it works properly, in your dropbox home folder you will see a folder called Apps. and your videos will be in there.

everything is working EXCEPT:

1- i dont see anything in my dropbox APPs. i see the files in tmp/motion though

2- the old files are not being deleted every hour as you mentioned

basic web page streamed the image good. in step 5, your forgot / for <html> but its ok!

no errors during step 6

in step 7, i have everything same as your image. with indentation using TAB on my keyboard.

thanks for your help! i know everyone appreciates your hard work

ScreenHunter_02 Feb. 26 22.29.gif
nochanceinhell3856 (author)  tmv221 month ago

I need to think about why the temp directory isnt clearing out every hour.

But for the Uploader, I think I see the issue stopping the uploader from running.

See the image below, but i think you you make change files_name to file_name to match the other references. This should correct the uploader issue.

Capture.JPG

yes, i made changes as you mentioned but still not working. can you share image of your uploader.py and cleartmp.py

nochanceinhell3856 (author)  tmv221 month ago

I am not currently at staying at my house (part of the reason I set this camera up) but I will try to stop by and get these screen shots this weekend.

oh yes please post image of your 2 python script!

also, do those 2 script automatically start doing the upload? meaning, if i boot up the raspberry pi, motion auto start...but what about the python scripts?

Guy_Moquet2 months ago

Thanks - really useful.

Being very new to Python I got stuck at step 7 - I can't get the code uploader.py to work. I noticed that the code in the picture is slightly different from the text. Which one is the correct version to use? Thanks

nochanceinhell3856 (author)  Guy_Moquet1 month ago

Sorry about the confusion. I believe that the Picture is the correct code because that's a screen shot from my running program. Unfortunately, I am away from my home for the last few weeks and cant double check the running system but I believe the code in the picture is correct.

camblonie3 months ago
"Now follow the instructions in the README.txt file in order to link the Raspberry Pi to your DropBox account using OAuth."
Could you link to this txt file please?
I had to download an updated driver for my camera from one of your links but I dont know where i should be unzipping it. I put it in the home folder but thats not working.

Thanks for the instructable!
nochanceinhell3856 (author)  camblonie3 months ago

Sorry I realized I messed up step 6. I have updated it. See my post above.

mikestevens!3 months ago

I second the OAuth command and readme.txt file. I have the camera displaying a video feed that is extremely laggy (3 to 5 seconds delay time). Is this an issue still once you are motion capturing and sending the video to dropbox?

nochanceinhell3856 (author)  mikestevens!3 months ago

After looking at these comments I realized that I messed up step 6 and have updated it (See my post above)

As for the extremely lag, that is actually going to be common for this setup. This is meant to be used for a home security type of setup where you can pop in from your cell phone or work computer to see what is going on in the house or in the case of something horrible (like a break in) you can hopefully have a picture of the bad person in your dropbox account. I think the lag is because what the Motion software is doing is taking a snapshot or still picture a few times each second (you can change this setting in the config file for motion). If you are looking to reduce the lag you could try dropping the image quality (also in the config for motion) or even update the frames per second. If that doesnt work, there may be another setup that may suit your needs.

I hope this helps.

nochanceinhell3856 (author) 3 months ago

I am sorry about the confusion. I see that i messed up a bit on Step 6. I have updated it but I will also put it here

What I should have said is:

Now run the script and follow its instructions

./dropbox_uploader.sh

The readme.txt file really just gives the same information I gave above but here is the link to the readme.txt

https://github.com/andreafabrizi/Dropbox-Uploader/blob/master/README.md

I am still very new to working with linux and the command prompt.

I just unzipped the files to my home directory.

I hope this helps

Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!