What do we need?
- Raspberry Pi model B
- SD Card, 16 GB
- Logitech C310 usb camera
You can also use Raspberry Pi model A, but you will need a Wifi dongle to connect to your network. For camera you can use more advance camera with higher resolution. Unless you really need HD quality pictures, the one I use is more than sufficient. Higher resolution you use will generate bigger file size, so you will need more space to store them in your pi.
View Captured Pictures Later
I follow this article to make for my own. In the article it even has a nice outdoor cctv housing.
Additional step that I did is to save the picture files into different folder. You can save them also to your server for you to few the pictures later. Open terminal and type:
sudo mkdir /home/pi/monitor
chgrp motion /home/pi/monitor
chmod g+rwx /home/pi/monitor
chmod R g+w /home/pi/monitorTo see the pictures from other computer, you will have to setup Samba, follow this article to set it up. Then from your computer, open the folder and view what happened during the day using any picture or video viewer.
Reason to do this is by default pictures is saved to /tmp/motion which will be automatically deleted by the OS. Some people send the pict to email automatically when the camera detected a motion, so you can received email notification with picture from your email.
Setting up automatic email
You must have a Google account to do this. The video will be save in your Google drive. From there you optionally can send to other email account. First, you need to install python:
sudo apt-get install python-pipsudo pip install gdataThen download uploader.py and uploader.cfg:
sudo wget http://files.mihevc.org/raspi/motion/uploader -O /etc/motion/uploader.py
sudo wget http://files.mihevc.org/raspi/motion/uploader.cfg -O /etc/motion/uploader.cfg
sudo chmod +x /etc/motion/uploader.py
sudo nano /etc/motion/uploader.cfg Complete your credentials, change the fields entry with yours:
[gmail]
# GMail account credentials
name = your_user_name
user = your_account_name
password = your_password
sender = your_email_address
# Recipient email address (could be same as from_addr)
recipient = destination_email_address
# Subject line for email
subject = Motion detected
# First line of email message
message = Video uploaded
[docs]
# Folder (or collection) in Docs where you want the videos to go
folder = motion
[options]
# Delete the local video file after the upload
delete-after-upload = true
# Send an email after the upload
send-email = true
Make sure you have created a folder named "motion". This is where the video files will be stored.
Testing if the uploader works:
python ./uploader.py /etc/motion/uploader.cfg /home/pi/monitor/*.avi
If everything is okay, then open motion.conf, add the following line at the end of the file.
on_movie_end python /etc/motion/uploader.py /etc/motion/uploader.cfg %fNext is to run python uploader scheduler using crontab.
crontab -eAdd the following line at the end of the crontab.
* * * * * python /etc/motion/uploader.py /etc/motion/uploader.cfg /home/pi/monitor/*aviThen reboot your Pi.
sudo shutdown -r now
Source : cornext.com
Buy Rasbery PI Model B : element14.com/community/community/raspberry-pi
No comments:
Post a Comment