Posts: 28
Joined: Wed Jan 15, 2014 11:25 pm

Options for motion detection improvements?

Sun Mar 01, 2015 7:42 pm

I have a rpi with a picam, and now a PIR sensor (which beats Motion and Motion-mmal hands down by my measure)

I wanted to see what everyone thought as to how to improve my motion detection video recording. Here are key points I'm interested in. It seems like some of my points are related to multi-threading (or I think they are).

Please let me know general ways to improve on these points. Thanks in advance!

1. Only record video while there is motion detected, such that only a minimal of wasted recording time is present.
2. The fastest way to send email (securely to gmail in this case)
3. immediate processing/email delivery of completed media files (pics or videos)

I've just implemented picamera and rpi.GPIO in python to improve my motion detection. I was using motion-mmal previously and it was always having issues, either mis-triggering or displaying artifacts, not to mention the 2 frames/sec I had set and almost complete LACK of "codec" support in Android.

This new method uses a single python script (my first btw) to detect motion and record video/pics and there is no real control on how long the video is recorded for. You pre-choose a timeframe to record. Which is pretty lame, causing lots of wasted space for unnecessary video. Then, using a shell script cron job, I email the created video to myself for review.

So python seems pretty nice, but I want to make sure I am able to dynamically set the length of video to record, based on if the PIR sensor sees motion. (or any other built-in manner that works very well)

So in concept: (I'm terrible at this - go easy)

Code: Select all

Function Record:
    recording-active = true
    While (datetime <recording_datetime)
            recording_datetime = lastPIReventTime  + 5 secs
end function

Loop()  (constantly running like a separate thread)
    if NOT recording-active and PIREvent
    end if
    Is there a new PIRevent?
          lastPIReventTime = Now()

Posts: 3
Joined: Thu Apr 16, 2015 11:19 pm

Re: Options for motion detection improvements?

Thu Apr 16, 2015 11:26 pm

i need help. How do i get my rpi to send me an email via gmail when motion is detected with PIR sensors!? thanks!

Return to “Camera board”