In this project you learn to build a motion sensor camera by combining a passive infrared (PIR) sensor with a Raspberry Pi® Camera Board. Following a few simple steps, you can use MATLAB® Support Package for Raspberry Pi Hardware to build a motion sensor camera.
To detect objects, the project uses a PIR sensor, which measures the infrared light radiating from objects. When something passes the sensor’s view, it detects a change in the infrared radiation and triggers an alarm if the gradient of the change is above a certain threshold. Once you connect the PIR sensor to one of the digital input pins of the Raspberry Pi hardware, you can use MATLAB commands to monitor the output of the PIR sensor. When the PIR sensor detects motion it outputs a logic high value, you can set it up to trigger the system to take a picture and save it on your computer.
Follow the example steps here: