This project demonstrates how to program the Bot'n Roll ONE A+ robot using MATLAB and Simulink.
The workflow leverages Model-Based Design principles — from algorithm design and simulation to automatic code generation and deployment on embedded hardware.
Simulink provides a graphical environment for modeling, simulation, and code generation.
In this project, Simulink is used to:
- Access and control the robot's sensors, LEDs, buzzer, and motors.
- Design, test, and deploy control algorithms automatically to the robot.
- Use Stateflow to manage state-based behaviors.
- Battery, motors and powertrain modeling and simulation
- MATLAB®
- Simulink®
- Stateflow
- MATLAB® Coder™
- Simulink® Coder™
- Signal Processing Toolbox™
- DSP System Toolbox™
- Simulink® Control Design™
- Robust Control Toolbox™
- Fixed-Point Designer™
- Simscape™
- Simscape™ Driveline™
You will need to install the following Support Packages:
-
Simulink Support Package for Arduino Hardware
→ Enables automatic code generation from Simulink to Arduino boards. -
MATLAB Support for MinGW-w64 C/C++ Compiler
→ Required to compile Arduino C++ code for sensors and motors.
- Open MATLAB → Add-Ons → Get Hardware Support Packages
- Select Simulink Support Package for Arduino Hardware and click Install.
- Accept the license agreements and complete installation.
- Repeat the process for MATLAB Support for MinGW-w64 C/C++ Compiler.
- Unzip the provided archive.
- Copy the extracted folder to a directory without spaces or accents.
- Open the project by double-clicking on BotAplus_SL.prj.
- Navigate to the PROJECT SHORTCUTS tab to explore the structure.
Download the following from the Bot'n Roll One A + website
- Bot'n Roll One A+ Arduino Library
- VCP Drivers (for virtual COM port communication)
| Folder | Description |
|---|---|
arduino_lib |
Contains the Simulink S-Function blocks and the src folder from the Bot'n Roll One A+ Arduino folder |
documentation |
Includes this user guide |
models |
Contains ready-to-use Simulink models for programming the robot |
plant |
Contains ready-to-use Simscape models |
resources |
Internal project files |
utilities |
Initialization scripts and project startup files |
work |
Compilation and simulation output directory |
- Open the model
All_Testing_SPI.slx - Configure the hardware COM port in Configuration Parameters → Hardware Implementation
- Verify connection using Windows Device Manager
- Click Monitor & Tune to interact with robot sensors and actuators in real time
- Open
Crazy_Challenge.slx - Verify COM port settings
- Use Monitor & Tune to observe Stateflow states turning blue when active
- To make the robot autonomous, click Build, Deploy & Start
- Add the block Init SPI&I2C (connect it to a terminator).
- Set the Stop Time to
inf. - Open Configuration Parameters → Select Arduino Uno board and COM port.
- Click Apply and OK.
- Use Monitor & Tune to test and iterate your design.
- Save your model in the
modelsdirectory.
- Open
Botnroll.slxfrom the plant folder - Run the simulation and analyze the battery discharge with the Data Inspector
To properly close the Simulink project, click the X in the upper-right corner of the Simulink Project window.
- Simulink Onramp
- Stateflow Onramp
- Simulink Support Package for Arduino Hardware Documentation
- Bot'n Roll ONE A+ Robot
The license is available in the License.txt file in this GitHub repository.
Copyright 2025 The MathWorks, Inc.