Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Raspberry Pi 

Make: IP Security Camera

A few days (2) ago they broke into our car.We don't know who did it we don't have security cameras so they will likely get away with it.

This thing gave me an idea what would happen if we had a camera and an early warning system in place?
would it still happen or could we intervene in time?
we would have those important evidence for the insurance company and the police.

With a camera and software in place we could potentially stop them (Proud gun owner 🤝)

Owkey what do we actually need?
  • Raspberry-pi b+ (or better)
  • Supported webcam (PSeye from a playstation3)
  • Internet cable or wifi dongle
  • All the basic stuff required for the pi (sd card, rasbian os, power adapter,...)

I used a PSeye webcam from my old playstation 3 it's more then enough for this although it wouldn't provide 1080p quality (640x480 @30fps) it's still pretty decent for a security camera (if you have a better camera feel free to use it).

First things first!

Get yourself a nice clean microSD card with a fresh rasbian os distro
Code
https://www.raspberrypi.org/downloads/raspbian/

follow the installation steps here:
Code
https://www.raspberrypi.org/documentation/installation/installing-images/windows.md


Let's get the software!

Just get the software if you want to update the system first and do some other things feel free but this is just a security cam tutorial ✌
Code
sudo apt-get install motion

This will install the motion software packet this is your security system
at this point hook up the webcam if you haven't already and restart the motion service.

Code
sudo service motion restart

This are the basic POC steps.

Let's get it to work better!

Owkey, you could take this a bit further and tune the system a bit more
Let's open the motions.conf file

Code
sudo nano /etc/motion/motion.conf

You could alter a few setting here and there. I did the following
Code
daemon on

logfile /tmp/motion.log

width 640
height 480

framerate 27

threshold 1750

post_capture 5

stream_maxrate 20

stream_localhost off

webcontrol_localhost off

Try to read the file and replace edit the stuff you need appropriately

Next.. To ensure the service starts when the pi starts
Code
sudo nano /etc/default/motion
--> no to yes

Restart the service. at this point everything should work if you have problems with crashes you should change the rights to the /var/lib/motion folder
to 777 or equivalent

Code
sudo chmod -R 777 /var/lib/motion

Everything should work now!

Extra's!

I also installed Apache2 and made a virtual directory to the /var/lib/motion folder for easy access.

Pictures!
Example:
Spoiler (Click to View)

Spoiler (Click to View)



Code
https://www.raspberrypi.org/downloads/raspbian/
https://www.raspberrypi.org/documentation/installation/installing-images/README.md

https://rbnrpi.wordpress.com/project-list/setting-up-wireless-motion-detect-cam/
http://www.instructables.com/id/Raspberry-Pi-as-low-cost-HD-surveillance-camera/step7/Installing-the-motion-detection-software/
https://www.raspberrypi.org/forums/viewtopic.php?t=18314
https://www.raspberrypi.org/blog/turn-your-pi-into-a-low-cost-hd-surveillance-cam/
http://raspberrypi.stackexchange.com/questions/41342/how-to-start-motion-in-daemon-mode-on-rpi-running-raspbian-jessie
https://www.raspberrypi.org/forums/viewtopic.php?t=36009&p=302814
https://pimylifeup.com/raspberry-pi-webcam-server/

I've added a small update ✌

Phone notification:

It's pretty awesome 😅
reviewing the images on the go is much quicker then watching them all when you're back. That's why we should enable phone push notifications

I'm not going to build a from scratch android application my internship was 3 months native android and I hated it xD

This is the api we are going to use!
Code
https://instapush.im/
Download the app follow the registration instructions,...
and all that other basic steps

next you should make an app you can do this in the dashboard

Dashboard -> apps -> add application -> give it a name -> submit
Dashboard -> apps -> click on your application -> add event -> give it a name , add all the information,.... -> submit

Give the tracker a nice name and remember it you'll need it later also include the tracker inside the message {YOUR_TRACKER_NAME}

Also check if your phone is in the devices list.

For the code I chose this python code i found on the magic place called google Ideleted a few parts in it to make it run a bit smoother and make it work for my thing just a basic setup no fancy things...

Code
I can't upload the code  here hackforums keeps blocking it xD
http://pastebin.com/cU7X1GXa

You can find your api and secret key on the basic info tab.

Upload it to your pi give it execute permissions and your done now you just need to go into the config file /etc/motion/motion.conf

find your event there are a few:
Code
on_motion_detect
on_movie_end
on_movie_start
on_area_detected
on_picture_save
.....

As you can see you could add many things to it maybe do some ftp when the movie file has been written or simply save the pictures,...

Well I'm just interested in the push notification so.. I added my script to the on_movie_end why? I don't wan't to slow down the frame rate when the cam is capturing the movements so I just call the script when everything is done and everything is saved...

Code
on_motion_detected python /var/lib/motion/test.py

source.
Code
http://videos.cctvcamerapros.com/digital-io-alarm-in-out/send-push-notifications-from-raspberry-pi.html


If you're having trouble setting this up please pm me everyone should have a security cam in these brutal and dark times!
Public Honeypot Project: https://github.com/Slober3/PotHead
Honeypot Twitter: https://twitter.com/HoneyHive9
BTC: 1Anime1QrjwsEmz8bC2FwVcNXDLxP3SWAJ

Erin Wrote:It’s fine. There’s nothing to be afraid of. Calm down, Lilan
Very nice post! I was expecting a question asking how to build this, but instead got a nice tutorial showing the process.

I don't have a pi, but if anyone else does this, I'd love to see some pictures.
I've gotta say, nice job on tutorial. I was thinking of doing the same thing but my pi is currently acting as my test server and is enclosed in a weird case :p (Makes it hard to put near a window)
[Image: wOdD4yf.gif]
Nice post. I used a Raspberry Pi kit that came with a camera and WiFi adapter for a project before (albeit I didn't need either and just used the Ethernet port). It didn't come with an SD card, but nonetheless, the kit would be perfect for this project.

Looking quickly on Amazon I found a bunch of kits with everything for ~$70.
Well this is a refreshing tutorial..
I've been thinking of how I could make a small security camera in my room for while I'm gone.
Unfortunately, I have to yet pick up a Raspberry Pi :/
(Jul 3, 2016 02:38 AM)ᴴᴬᴺᴷᴷ ツ Wrote:  Well this is a refreshing tutorial..
I've been thinking of how I could make a small security camera in my room for while I'm gone.
Unfortunately, I have to yet pick up a Raspberry Pi :/

you could also use your normal computer or vm running a debian based system
Motion should run fine on it maybe even better/smoother ✌


I've also added a small update ✌

Phone notification:
Spoiler (Click to View)
Public Honeypot Project: https://github.com/Slober3/PotHead
Honeypot Twitter: https://twitter.com/HoneyHive9
BTC: 1Anime1QrjwsEmz8bC2FwVcNXDLxP3SWAJ

Erin Wrote:It’s fine. There’s nothing to be afraid of. Calm down, Lilan
Very nice post keep it up man
Thanks for the share man, I have a similar setup -

Waiting on my rpi zero camera then will test this out.
This looks like a fun project, nice share 🤝
awesome will be using this been trying to get my theif
Thanks a lot, i just start to do it.
thank for effort, good issue (:
I made one using an FPV camera and a tilt/pan system. The only issue I had was when it would rain, motion would fill up the disk. Nice toot.
Looks very interesting, how much does this setup cost. Sorry for being lazy :D
~The name is Mark.~
Awesome that you made a tutorial rather than asking for help, as I expected.


Possibly Related Threads...
Thread / Author Replies Views Last Post
by phodkiewiczAug 31, 2025 06:35 AM 8 511 Aug 31, 2025 06:35 AM
Last Post: migalo57x
by NoobstickyAug 31, 2025 06:35 AM 2 463 Aug 31, 2025 06:35 AM
Last Post: migalo57x
by SIM-3327349Aug 4, 2017 02:55 PM 17 1,569 Aug 4, 2017 02:55 PM
Last Post: SIM-3327349