atux_null
Posts: 134
Joined: Thu Jun 21, 2012 1:58 pm

surveillance system

Thu Jun 25, 2015 1:08 pm

hello everyone. i got a spare Raspberry B (512MB) with a 16GB SD card. On it runs DietPi (viewtopic.php?f=63&t=100976). it runs really smooth. i would like to convert it to a surveillance system for my home office. i have a raspicam and an IP camera that i could attach. is there a way that i could create motion detection in the system, so it can send emails with photos in every move that it can sense? Please?

Moe
Posts: 230
Joined: Sun Jan 25, 2015 2:44 pm

Re: surveillance system

Thu Jun 25, 2015 8:54 pm

Yes, you want a HC-SR501 PIR sensor. You can get them dirt cheap on Ebay and it'll plug straight into the Pi's GPIO pins. I use lots of them with a separate PSU, but one should easily cover a room and I think you could power one quite happily direct from the Pi's 5V output.

Use it to trigger a callback function that takes the pictures etc etc. The rest is software, and I can't help you with that :(
Submarine communication systems engineer and amateur robot enthusiast.

User avatar
sav25
Authorised Reseller
Authorised Reseller
Posts: 383
Joined: Thu Aug 30, 2012 7:18 pm
Location: Southend-on-Sea, Essex, UK
Contact: Website Twitter

Re: surveillance system

Thu Jun 25, 2015 9:14 pm

A cheaper option might be to use MotionPie. It uses the Raspberry Pi Camera Module as the camera, and detects changes in the image/colours (I'm not sure exactly how it works) instead of using a PIR:

https://github.com/ccrisan/motionPie

...but this is a standalone image/build, so you would lose DietPi.

atux_null
Posts: 134
Joined: Thu Jun 21, 2012 1:58 pm

Re: surveillance system

Fri Jun 26, 2015 7:31 am

thanks a lot for the replies. motionPIE is nice but i cannot run the rest of the software.
i will keep a version of dietpi of simply raspbian, both can run all my software.
what i really want is to record 24/7 and write to the SD.
if possible i would like to have a folder for each day.
also how can i see live the streams from my PCs browser and my android mobile?

User avatar
sav25
Authorised Reseller
Authorised Reseller
Posts: 383
Joined: Thu Aug 30, 2012 7:18 pm
Location: Southend-on-Sea, Essex, UK
Contact: Website Twitter

Re: surveillance system

Fri Jun 26, 2015 8:31 am

atux_null wrote:thanks a lot for the replies. motionPIE is nice but i cannot run the rest of the software.
i will keep a version of dietpi of simply raspbian, both can run all my software.
what i really want is to record 24/7 and write to the SD.
if possible i would like to have a folder for each day.
also how can i see live the streams from my PCs browser and my android mobile?
I wonder if 24/7 recording would cause any problems for the SD card?

atux_null
Posts: 134
Joined: Thu Jun 21, 2012 1:58 pm

Re: surveillance system

Fri Jun 26, 2015 8:35 am

no worries about that.i am aware about sd degradation.
it is only for a month and i got covered by the manufacturer.
how can i do it to make it work, please?

pageauc
Posts: 224
Joined: Fri Jan 04, 2013 10:52 pm

Re: surveillance system

Fri Jun 26, 2015 10:39 am

PI-TIMOLO
I have written a Python script called pi-timolo (pi, timelapse, motion, low light). This uses the picamera python library instead of using raspistill. Motion and timelapse can be run together or separately. Also supports sync of images to a web based google drive so you can monitor from anywhere using google drive interface app or from a browser. For details see my release notes here https://github.com/pageauc/pi-timolo
The project includes several useful utilities like makemovie.py mvleavelast.sh and makedailymovie.sh. This does not use a GUI interface and does require terminal setup. Here is a link to my videos on this if you are interested
https://www.youtube.com/playlist?list=P ... 7PtA5uYeOb

Web based camera interfaces I use and recommend
I also use web based interactive RPI camera interfaces. These are useful and I use both of the interfaces mentioned below and would highly recommend them depending on your needs. They are pretty easy to install but sometimes tricky to configure. Make sure to set the GMT time/zone in both. They both work well. The first is a little faster at streaming. I still prefer pi-timolo for long duration remote headless camera operation, since the web interfaces below (headless as well) can be finicky and occasionally give me problems. pi-timolo handles low light conditions using long exposure. It does not rely on a clock for night/day transitions and can limit total image files in a circular numbering sequence to make managing google drive easier. At the end of the day I run a crontab script to create a dailymovie and transfer this to my NAS so my media player running Kodi can be used to easily view all the daily movies created from the motion files. These are encoded at 5 FPS..

RPI-Cam-Web-Interface.
http://elinux.org/RPi-Cam-Web-Interface
I set this up with a 3 second buffer so video is recorded prior to motion triggering. This interface can also be configured to use file syncing with your google drive but is not part of the setup. Contact me if you need details.
install is pretty simple

Code: Select all

git clone https://github.com/silvanmelchior/RPi_Cam_Web_Interface.git
cd RPi_Cam_Web_Interface
chmod u+x RPi_Cam_Web_Interface_Installer.sh
./RPi_Cam_Web_Interface_Installer.sh install
This runs on Raspbian so you can run other programs as well. I install pi-timolo as well as this web interface. Since the camera cannot be easily shared they cannot run concurrently but it is easy to stop camera on the web interface when needed. If we go away for a long time I switch over to pi-timolo and turn off the RPi-Cam-Web-Interface until I get back. I should write a script to automate this. Anyway I have this interface as well as pi-timolo and switch as required.

motionPIE
This is a stand alone GUI web interface package that is installed as an SD card image file. Instructions can be found here
https://github.com/ccrisan/motionpie/wiki/Installation
Download image files here
https://github.com/ccrisan/motionPie/releases Note there are separate RPI B and B2 images so download the appropriate one. Just unzip the image and burn to a new SD card, pop into RPI, boot and access Web interface using the IP address on a Web Browser. This can be handy since you can just pop in the motionPIE SD card when required and boot using another raspbian SD if you need the RPI for something else. But this is not as convenient as the Web Interface above running on raspbian.
motionPIE is a little slower at streaming video but works OK (laggy). It is designed to only run video security so you are limited. It has an admin and user mode that can be useful for protecting configuration settings. It Has lots of configuration settings. I configured mine to save files to a share on my network NAS and that was very easy.
Both these web interface packages are pretty much plug and play but if you are interested in implementing your own project with python then my repo might be useful. It also gives you the ability to see and change the Python code if you want to customize it. There is a pi-motion-lite on my github repo that might be of interest to those that want to create their own Python picamera project
Regards
Claude ...

.
GitHub - https://github.com/pageauc
YouTube - https://www.youtube.com/user/pageaucp

random_internet_user
Posts: 1
Joined: Sat Jun 27, 2015 12:35 am

Re: surveillance system

Sat Jun 27, 2015 1:01 am

Hi, this is my first post so sorry if I over look any formalities or whatnot.

I am building something similar to the OP'er, where I used a basic r-pi camera, and the program Motion. I was able to get the Motion captures to save to another PI which is running as a password protected NAS on my local network.

The only remaining problem I'm having is I can not get the "Security Camera" to email me stills from Motion, which I think is because of the password protection on the NAS. I can send email from the "Camera" but not in conjunction with the Motion stills.

I'd be more than happy to help OP'er get as far as I did with my version of the R-PI Security Cam when I get home and can see the code again, if my method sounds like something of interest?

If any one else can help me with getting my Motion captures emailing, I'd appreciate it.

atux_null
Posts: 134
Joined: Thu Jun 21, 2012 1:58 pm

Re: surveillance system

Mon Jun 29, 2015 9:35 am

hi. i have setup motion and the system works really nice.
i have followed this tutorial
http://strobelstefan.org/?p=4843

i have changed instead of /home/pi/motion i have /usr/src/motion. that is the only difference that i made. if i run the motion -c /usr/src/motion/motion-mmalcam.con then i can see the system that it is working. i can see everything on my browser. if i reboot the system then there is nothing until i issue manually the command motion -c /usr/src/motion/motion-mmalcam.con
in cron i have
root@raspberrypi:[~]: crontab -l

Code: Select all

@reboot screen -S Motion -dmS  motion -c /usr/src/motion/motion-mmalcam.conf
root@raspberrypi:[~]:

could someone help me make the system run at start please?

User avatar
DougieLawson
Posts: 38863
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: surveillance system

Mon Jun 29, 2015 10:34 am

Change "screen" to "/usr/bin/screen" & change "motion" to "/usr/bin/motion" when cron runs a script it doesn't set any PATH variables so you have to put the full name of any program you want to run.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

wernert
Posts: 10
Joined: Fri Jul 25, 2014 11:45 am
Location: New Zealand
Contact: Website

Re: surveillance system

Mon Jun 29, 2015 11:32 am

Why not use wireless 433 Mhz PIR and magnetic door sensor? I recently experimented a bit interfacing to cheap ones that i bought on Aliexpress for about $6 and they work really well. The cool thing is that the range is quite good. I could pick them up almost right through my house.

If want go this route it might interest you to have a look at my EasyPeasy project on Indiegogo ( https://www.indiegogo.com/projects/easypeasy. In that project I included nice Raspberry Pi C++ examples of how to do almost exactly this.

atux_null
Posts: 134
Joined: Thu Jun 21, 2012 1:58 pm

Re: surveillance system

Mon Jun 29, 2015 1:37 pm

root@raspberrypi:[~]: crontab -l

Code: Select all

@reboot /usr/bin/screen -S Motion -dmS /usr/bin/motion -c /usr/src/motion/motion-mmalcam.conf
root@raspberrypi:[~]:


still no luck

User avatar
DougieLawson
Posts: 38863
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: surveillance system

Mon Jun 29, 2015 1:43 pm

Have you got a MTA (mail transfer agent) installed and configured? If you do then cron will send email when a script fails.
Also take a look at /var/log/messages and/or /var/log/syslog to see if there's any interesting errors from cron in there.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

atux_null
Posts: 134
Joined: Thu Jun 21, 2012 1:58 pm

Re: surveillance system

Mon Jun 29, 2015 2:10 pm

hi. i have postfix to send messages. i do not receive any emails for errors.
in the var log there is nothing about errors in cron. :x

atux_null
Posts: 134
Joined: Thu Jun 21, 2012 1:58 pm

Re: surveillance system

Tue Jun 30, 2015 1:54 pm

i have found the problem. it is /usr/local/bin/motion.

final things.
-it is two sensitive and sends a series of email attachments even when it catches a shadow from the moving curtain.
-how can i see the stream in my TV (dlna)?
-how can i see the stream from my mobile (android)? app only not on a browser.

Please?

Return to “Automation, sensing and robotics”