Matlab: Build a Motion Sensor Camera

This example shows you how to build a motion sensor camera using MATLAB® Support Package for Raspberry Pi® Hardware. In this example you combine a passive infrared (PIR) sensor with a Raspberry Pi Camera Board to build a motion sensor camera. A PIR sensor measures infrared light radiating from objects. The sensor detects the change in the infrared radiation and triggers an alarm if the gradient of the change is higher than a predefined value. You connect the PIR sensor to one of the digital input pins of the Raspberry Pi hardware and monitor the output of the PIR sensor. When PIR sensor detects motion it outputs a logic high value. When you detect a logic high value on the digital input pin, you take a picture and save it on the host computer.

Fonte e mais detalhes aqui