lelandg / Raspberry-Pi-Security-Camera

This project requires custom hardware. Schematics are included as a Fritzing file. Uses ePIR to detect motion. Emails a list of people when detected. Also is a Linphone server, so you can simultaneously connect to the camera for a live picture! (Right now is one-way on the Pi.)
MIT License
25 stars 5 forks source link

Raspberry-Pi-Security-Camera

JamPi Logo

Copyright (C) 2016 Leland Green... All rights reserved. Released under MIT license so you can use for any purpose. See License.md for the licensing text.

Definitions

If you make significant changes I require only two things: the graphic (JamPi Logo) and JamPi name must be removed. You are free to use those (name and graphic) in a non-commercial , or educational setting, only. For a project with significant changes, you must (1) remove them from any place they are shown to the end-user and (2) state that your project was derived from the JamPi project in the documentation and/or the comments of the source code. In that case you must also include a link to the original project page. (This will suffice: https://github.com/lelandg/Raspberry-Pi-Security-Camera)

Since the graphic is currently not used, you can just delete it, and then do not show the name JamPi to the end-user and we will be OK with each other. :-) Simply search/replace in the file security_camera.py for "JamPi" and replace it with your product name ; simple... especially since that's only used in the initialization log message. You are allowed to leave that in, until you make significant changes , when you must rename it. Fair? Thank you for your cooperation.)

See Requirements and then Installation below if you want to jump right in!

Features

Requirements

Sending video is resource-intensive so you should boot to Console mode (probably with auto-login if this is to be a remote deployment). To be clear, I could never get video to work when I booted my Pi to X desktop. So that is unsupported at this time. (This may be a misunderstanding of something on my part so please speak-up if you have info that may help me.)

First, change to the directory with: cd Raspberry-Pi-Security-Camera

Because it uses an I/O device you need elevated permissions to run it. So you will need to run the script with: .startscript.sh or sudo python security_camera.py. However, you should always use .startscript.sh. If you want something different, edit the script once and it will be changed from then on! :)

TIP If you want to find programs in your home directory without typing the preceding ./, whether or not you're running as sudo, you can add to your .bashrc with:

This project also represents my first (serious) attempt at using GitHub as it was intended. You may see me open issues and then close them after a commit/merge. I hope that these comments prove useful to you.

Installation

Optionally

Operation

Three shell scripts are included to make operation of the Python script a snap. They have very different names to aid you in starting, stopping and showing the process (if any) for the currently running script.

You do not need to prefix these with "sudo". The scripts do that for you! :) These scripts are:

NOTES

If you see an error like this: WARNING: ./share/sounds/linphone/rings/oldphone.wav does not exist, you can run:

sudo find / -iname '*.wav' > /home/pi/soundfiles.txt && less ~/soundfiles.txt

to find all sound files on your machine. Once the list is displayed (and stored in ~/soundfiles.txt, if you see a line with /usr/local/lib/python2.7/dist-packages/linphone/share/sounds/linphone/ringback.wav, use the parent directory as input to this command sudo ln -s /usr/local/lib/python2.7/dist-packages/linphone/share/sounds/linphone; such that, for this example:

sudo ln -s /usr/local/lib/python2.7/dist-packages/linphone/share/sounds/linphone /usr/share/sounds/linphone

IMPORTANT NOTE In your home directory you will find the file .linphonerc ( ~/.linphonerc should always access it). This file has a line for contact=. I recommend opening this file and changing it to contain your current SIP account so that it does not conflict with that given in the script. Depending on how you've used Linphone on RPi, you may have other options that conflict! I cannot hope to document all of those, so you need to look up the documentation for these.

WARNING Do not run more than one instance of the script! The shell scripts attempt to prevent you from doing this by calling security_off before it actually "turns it back on".

WARNING Running multiple instances of the script is certainly unsupported and behavior is undefined, at best!