Learn how to program BeagleBone Black with MATLAB and Simulink


The dedicated team at MathWorks has been working on expanding support for BeagleBone Black. Brian McKay, technical marketing manager at MathWorks brings us this easy to use tutorial.

You can now connect your BeagleBone Black to MATLAB®. MATLAB is the high-level language and interactive environment used by millions of engineers and scientists worldwide. It lets you explore new ideas and put them into action with a BeagleBone Black, based on TI’s Sitara™ AM335x ARM® Cortex®-A8 processor.

Getting started with MATLAB
To begin, install the free MATLAB support package for BeagleBone Black Hardware found at this link. With the support package, you can acquire data from sensors and imaging devices connected to the BeagleBone Black. Specifically, libraries of MATLAB functions are provided for BeagleBone Black interfaces, including USB webcam, ADC, I2C and SPI, Serial, GPIO and PWM.

Researchers, students and hobbyists can use MATLAB to acquire data from connected devices and can then analyze and visualize their data in MATLAB. Check out these documentation and examples that are available to help you get MATLAB working with your BeagleBone Black.

Start by following the provided tutorials, which help you learn the basics. Once you get up and running, you can look at the application examples where you can learn how to control a 4-digit display or connect to a webcam and do basic image processing.

Here is a portion of a tutorial which explains how to program the digital pins and a button to light an LED on a breadboard.

Programming with Simulink® and Embedded Coder®

You can now also program the BeagleBone Black with Simulink and Embedded Coder.

Simulink is a block diagram environment for multi-domain simulation and model-based design. Simulink is integrated with MATLAB, enabling you to incorporate MATLAB algorithms into models and export simulation results to MATLAB for further analysis.

To get started, install the free Embedded Coder support package for BeagleBone Black Hardware found here. The support package includes a library of Simulink blocks for configuring and accessing BeagleBone Black peripherals and communication interfaces.

  

You can use Simulink to create and simulate algorithms using block diagrams. Once you have your algorithm ready, add and configure blocks (from a library installed by the support package) which represent BeagleBone Black IO port.  Then you implement the algorithm with Embedded Coder as a standalone application on the BeagleBone Black using automatic code generation. By default, the generated code is ANSI/ISO C/C++. Documentation and examples are available to help you get started.

You can also see a brief introduction with this video: