Book Image

Raspberry Pi Essentials

By : Jack Creasey
Book Image

Raspberry Pi Essentials

By: Jack Creasey

Overview of this book

Table of Contents (15 chapters)
Raspberry Pi Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Project 2 – Combining the webcam movement detector and the PiCam camera


Now that we have a working PiCam script and know which configuration details are needed to enable motion movement detection, we can update the Bash script from Project 1a – Creating a Bash script to drive raspivid to include this motion detector feature. So, we need to enable actions in the motion configuration file to start and pause recording using a script.

Here is a preview of what is added to the new security.sh script:

  • For the load option, the command lines to start motion are added and the USB camera is set to a fixed focus

  • For the quit option, a command line is added to kill motion

  • For the motion configuration file, the following events are enabled:

    • A motion-detect event that turns on PiCam recording

    • An end-of-movement event that pauses PiCam recording

Since the script file is now over 100 lines long, it would be quite a chore to type in the changes. To get the new file with the changes added as described in the previous...