Raspberry Pi Blockset provides blocks and functions in MATLAB and Simulink for prototyping and implementing applications on Raspberry Pi® hardware. You can interface with hardware peripherals such as GPIO, I2C, SPI, and camera modules for rapid prototyping.
With Raspberry Pi Blockset, you can acquire sensor data, control actuators, and build applications for image and audio processing, signal processing, and Internet of Things (IoT) systems. You can also deploy machine learning or deep learning applications for edge computing on Raspberry Pi.
You can develop algorithms in MATLAB and Simulink and deploy them to Raspberry Pi using automatic code generation (with Embedded Coder). The blockset supports live parameter tuning, signal monitoring, and connected I/O workflows, enabling real-time interaction with hardware.
Getting Started
Set up and deploy MATLAB algorithms and Simulink models to Raspberry Pi hardware on Windows®, Mac®, and Linux® platforms.
Device Driver Blocks
Use device driver blocks to access hardware specific features of your board, such as communication protocols or hardware libraries.
Predictive Maintenance
Monitor the health of a rotating device or other equipment using a machine learning algorithm for predictive maintenance. Use ThingSpeak to view the operational state in the cloud.
Read Lidar Scan Data Over ROS
Read and receive a 2-D lidar scan data of an indoor environment from a ROS network using the Raspberry Pi hardware board.
Edge Detection
Acquire live image from a webcam and deploy an Edge detection function on the Raspberry Pi hardware as a standalone executable.
Deep Learning Image Classification
Generate and deploy code for ResNet-50 neural network to identify the image that is passed as an input using the command line of Raspberry Pi.
Supported Hardware
Raspberry Pi Model
- Raspberry Pi 5
- Raspberry Pi Compute Module 4
- Raspberry Pi Zero 2 W
- Raspberry Pi 4 Model B
- Raspberry Pi 3 Model B+
- Raspberry Pi Zero W
- Raspberry Pi 3 Model B
- Raspberry Pi 2 Model B
- Raspberry Pi 1 Model B+
Note: Raspberry Pi 1 Model A, Raspberry Pi Model B, Raspberry Pi 1 Model A+, and Raspberry Pi Zero are currently not supported. Raspberry Pi Pico is supported from the Arduino support package from R2024b.
Product Resources:
Raspberry Pi Blockset FAQs
Raspberry Pi Blockset is a MathWorks product that provides blocks and functions in MATLAB and Simulink for prototyping, developing, and deploying applications on Raspberry Pi hardware.
MATLAB + Raspberry Pi Blockset - Interactively control hardware, read sensors, and capture images. Add Simulink for model-based design with visual blocks, simulation, and connected hardware testing. Add Embedded Coder to generate standalone C/C++ executables, enable monitor and tune, and deploy on the Pi.
Embedded Coder generates readable, compact, and fast C/C++ code from your MATLAB algorithms and Simulink models, optimized for ARM processors, and deploys it as a standalone executable on Raspberry Pi. Generate standalone executables that run on the Pi at boot. Produce optimized C/C++ with ARM-specific enhancements for real-time performance. Verify generated code against simulation using SIL and PIL testing. Profile execution timing on hardware to identify bottlenecks. Control generated code structure, data types, and interfaces to integrate with existing codebases.
For Edge AI: Object detection, image classification, speech recognition, keyword spotting (ResNet-50, YOLOX). For industrial communication: CAN/CAN FD, Modbus TCP/IP, Protocol Encoder/Decoder. For audio and video: Audio capture/playback, I2S DAC output, RTSP video streaming, camera processing. For sensor acquisition and control: IMU sensing, GPIO, PWM, servo, encoder feedback. For robotics and motor control: Sensor fusion, autonomous navigation, LEGO MINDSTORMS. For IoT and cloud: ThingSpeak, WebSocket dashboards, MQTT, HTTP. For predictive maintenance: Vibration analysis, ML-based health monitoring, cloud dashboarding.
Train models in MATLAB, generate optimized C/C++ using MATLAB Coder, and deploy as standalone inference applications on Raspberry Pi. Supported networks include, but are not limited to, ResNet-50, MobileNetV2, YOLOX, LSTM, and TensorFlow Lite models. INT8 quantization is available for faster inference on ARM hardware.
Raspberry Pi Blockset integrates with domain-specific toolboxes to extend your applications: Deep Learning Toolbox, Audio Toolbox, Computer Vision Toolbox, Image Processing Toolbox, Control Systems Toolbox, Stateflow, Signal Processing Toolbox, DSP System Toolbox, Communications Toolbox, Predictive Maintenance Toolbox, and Statistics and Machine Learning Toolbox.
From MATLAB: Interactively read sensors, control actuators, and capture images from the command line. Deploy MATLAB functions as standalone executables. From Simulink: Prototype with connected I/O to test with real hardware without code generation. Monitor and tune (External Mode) to adjust parameters and monitor signals live while the model runs on the Pi. Generate standalone C/C++ code that runs independently at boot.
Raspberry Pi Blockset lets you go from algorithm idea to running hardware in minutes, using visual blocks and MATLAB functions instead of writing embedded C code. You prototype, validate, and deploy from the same environment, and the toolchain handles code generation and hardware interfacing for you.
Yes. MATLAB Online lets you connect to and program Raspberry Pi hardware entirely from a web browser, without installing MATLAB on your local machine. This is ideal for remote development, shared classroom or lab hardware, and teams collaborating across locations.
Raspberry Pi Blockset supports Raspberry Pi 5, 4 Model B, 3 Model B/B+, 2 Model B, Zero W, Zero 2 W, Compute Module 4, and Compute Module 5. The supported operating system is Raspberry Pi OS (Debian-based Linux) in both 32-bit and 64-bit variants. Check the release-specific compatibility table before using newer OS versions.