Introduction

Want to combine the easy programming of MATLAB Simulink and the widely adopted hardware platform of Raspberry Pi? You can!

Many engineers love programming in MATLAB Simulink due to its support and ease of use. The Raspberry Pi, which had its first commercial release back in 2012 has become a very popular platform for prototyping. So how do we combine these two great tools?

MATLAB Already Supports the Raspberry Pi Platform!

What are some benefits of using MATLAB on the Raspberry Pi?

MATLAB/Simulink Usage

Installation on Raspberry Pi

MATLAB supports a wide range of Raspberry Pi boards. Because the FlexSeries products use a Raspberry Pi CM3+ (A small form factor Raspberry Pi 3B+) it is automatically included as part of that support.

MATLAB Benefits

Significant benefit comes from being able to now interface the outside world with the Raspberry Pi. With MATLAB, you can now control:

  • Vision Systems – USB Webcams and other cameras for vision processing

  • Input Control – Reading sensors over I2C, SPI, etc.
  • Output Control – Controlling outputs like pulse width modulation and general purpose outputs
  • Linux Control – Interacting with Linux through the system shell

  • Online and Interactive – You can set up two-way communication and control your Raspberry Pi over the internet with MATLAB Online

High Reliability Considerations

From our previous post, high reliability can be thought of as:

Confidence that your system will run as desired the same way all the time. The device can self detect if something is wrong, quickly fix itself and resume. For automotive systems, this can mean update cycles every few milliseconds and the system automatically resetting within that cycle if anything goes wrong.

Because the MATLAB script runs on top of Linux, real-time behaviour cannot be guaranteed. However, if you are running MATLAB/Simulink on the FlexCase, there a few additional benefits.

  • Improved Reliability – Combining the Raspberry Pi with an ASIL co-processor can be used to add safety checks.

  • Hardened Input/Outputs – The Raspberry Pi can take advantage of the FlexCase’s high voltage and current capacity.
  • Additional Protocols – Use the Raspberry Pi to control I/O, CAN, IoT, and EtherCAT.

Conclusions

The Raspberry Pi can be a great hardware platform to run standalone MATLAB/Simulink code on. This benefit is especially true when a few sensors or actuators are needed as part of the design.

Have any questions or comments? Contact us.