Wireless IP Camera – Part 4: build your own IP camera software

Here are the motion-detect.h contents:

The program breaks down in a few important functions:

Detect-motion() is the main loop where the camera is waiting for the PIR sensor to pickup movement.

Messagehandler() is the function that is fired when a signal comes in from the operating system such in our case a timer signal.

The functions setupGPIO() and checkGPIO() are helper function that encapsulate all the GPIO related stuff. We use the GPIO pin on the BB to signal movement. the pin needs to be prepared (setupGPIO) and read (or polled) to detect movement (checkGPIO).

The function Payload() encapsulates the logic of what needs to happen when motion is detected. This function determines the behavior of the camera upon motion detection.

Mail() is used to send of an email.

Capture_Images() snaps pictures with the webcams.

At the top of the file you find a number of #defines. I’ve used the defines to hold the settings of the program. Better would be to move these settings to an actual settings file in /etc as proper daemon should have.

The next part is  adding the meat of the logic to the program

On the next page I’ll explain some of the more involved details of the program…

  • StumbleUpon
  • Facebook
  • Twitter
  • Google Bookmarks
  • email
  • RSS
This entry was posted in Maker Recipes, Security. Bookmark the permalink.

One Response to Wireless IP Camera – Part 4: build your own IP camera software

  1. Thanks for sharing nice information.

Leave a Reply

Your email address will not be published. Required fields are marked *