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.

This example shows you how to use MATLAB to process images captured from a Raspberry Pi Camera Board module to track a green ball. The Raspberry Pi Camera Board is a custom designed add-on module for Raspberry Pi hardware. The MATLAB Support Package for Raspberry Pi Hardware allows you to capture images from the Raspberry Pi Camera Board and bring those right into MATLAB for processing. Using this capability we will develop an ball tracking algorithm.

This example shows how to create a connection to the web camera and capture still images. Connect the Raspberry Pi™ board to your host computer. Note: If you have not previously configured your Raspberry Pi board, see Complete Additional Setup Tasks.

You can use MATLAB to communicate with a Raspberry Pi board and its peripheral devices using MATLAB Support Package for Raspberry Pi. You can program Raspberry Pi boards to run your algorithms using Simulink Support Package for Raspberry Pi Hardware. The support package generates code from your Simulink model in a click of a button that then runs on the Raspberry Pi board.

The MATLAB Support Package for Raspberry Pi Hardware enables you to communicate with Raspberry Pi hardware remotely from a computer running MATLAB. The support package includes a MATLAB command line interface for accessing Raspberry Pi hardware’s I/O peripherals and communication interfaces. Using this command line interface, you can collect data from sensors connected to Raspberry Pi hardware and actuate devices attached to Raspberry Pi hardware.

In this example you learn how to create a raspi object to connect to Raspberry Pi hardware from within MATLAB. You examine the properties and methods of this object to learn about the status of basic peripherals such as digital I/O pins (also known as GPIO), SPI, I2C, and Serial. Using this object, you execute shell commands on your Raspberry Pi hardware and manipulate files on the Raspberry Pi hardware.

MATLAB® Support Package for Raspberry Pi™ Hardware enables you to communicate with a Raspberry Pi remotely from a computer running MATLAB. You can acquire data from sensors and imaging devices connected to the Raspberry Pi and process them in MATLAB. You can also communicate to other hardware through the GPIO, serial, I2C, and SPI pins.

One powerful feature of the Raspberry Pi is the row of GPIO (general purpose input/output) pins along the edge of the board, next to the yellow video out socket. These pins are a physical interface between the Pi and the outside world. At the simplest level, you can think of them as switches that you can turn on or off (input) or that the Pi can turn on or off (output). Seventeen of the 26 pins are GPIO pins; the others are power or ground pins.