Skip to content
/ picam Public

Using webcam for secure home, with motion in raspberry and google drive as hosting

Notifications You must be signed in to change notification settings

p-kos/picam

Repository files navigation

picam

Using webcam for secure home, with motion, NodeJS, AngularJS in raspberry

Installation

NodeJS

There are many versions of NodeJS to download but is better to choose one working with all npm packages need, I found issues with lasted version with sqlite3 so you can download what I used.

wget http://nodejs.org/dist/v0.10.10/node-v0.10.10-linux-arm-pi.tar.gz

Then uncompress it

tar xvfz node-v0.10.10-linux-arm-pi.tar.gz

Test if it is working

./node-v0.10.10-linux-arm-pi/bin/node --version

It should show you v0.10.10

Then add the path to you profile, in raspbian the file is .profile (make sure you are at home cd ~ )

sudo vi .profile

Then add the following lines to the file

NODE_JS_HOME=/home/pi/node-v0.10.10-linux-arm-pi
PATH=$PATH:$NODE_JS_HOME/bin

That should be enought, try with the following command again

node --version

It should show you v0.10.10

Motion

First we need to update then install motion

sudo apt-get update
sudo apt-get install motion

Open the configuration file and replace the lines by

sudo vi /etc/motion/motion.conf

width 320
height 240

also

threshold 3000

interval

snapshot_interval 60

target directory

target_dir /home/pi/picam/captures

The most important

on_picture_save node /home/pi/picam/processImage.js /home/pi/picam/dbImages.db %f

What you did in last line is when a new image is saved after capture run a NodeJS script and use the file dbImages.db as SQLite3 database any file in %f

The save the file by pressing Esc :wq! in vi

Clone the Project

First make sure you have git installed by

whereis git

if the command returns any result that means you have git installed. In case you don't have any results, you can install it by

sudo apt-get install git

In raspberry choose a folder and clone the project (make sure to give it the proper rights). I used ~ (home)

cd ~
git clone https://github.com/p-kos/picam.git 
chmod 777 picam

cd picam
mkdir captures
chmod 777 captures

The last line is to captured images by motion (see Motion section)

Packages

Go to folder picam and install the packages needed

cd ~/picam
npm install

Let's get it work

Server

First add the permission to run the picam server

sudo chmod +x picam.sh

Then run the server

./picam.sh

The server will run under port 3705

Client

Open your favorite browser the raspberry pi url

http://192.168.1.123:3705 

Mine is under that IP address.

All the captures images will be saved under /home/pi/picam/captures and the database file will index those

From client the motion can be started by a left up button

Motion

Motion can be started by separte through command line

motion

To cancel Ctrl + C

Autostart

In order to autostart the picam server edit the rc.local file at the end with the following

sudo vi /etc/rc.local

add

/home/pi/picam/picam.sh &

before line

exit 0

Restart the system

sudo shutdown -r now

Author

Marco Zarate (P-KoS)

[email protected]

@p_kos

Linked in

Thanks

Thx to many post I saw before writing my own.

Video Vigilancia con el Raspberry Pi

Jeremy's Blog

About

Using webcam for secure home, with motion in raspberry and google drive as hosting

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published