Skip to content

mathworks/Simulink_Botnroll

Repository files navigation

Learn to Program the Bot'n Roll ONE A with MATLAB and Simulink

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. Open in MATLAB Online


🚀 Overview

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

🧰 Requirements

Recommended MATLAB Products (R2025b or later)

  • 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™

📦 Add-ons Installation

You will need to install the following Support Packages:

  1. Simulink Support Package for Arduino Hardware
    → Enables automatic code generation from Simulink to Arduino boards.

  2. MATLAB Support for MinGW-w64 C/C++ Compiler
    → Required to compile Arduino C++ code for sensors and motors.

Steps

  1. Open MATLAB → Add-OnsGet Hardware Support Packages
  2. Select Simulink Support Package for Arduino Hardware and click Install.
  3. Accept the license agreements and complete installation.
  4. Repeat the process for MATLAB Support for MinGW-w64 C/C++ Compiler.

🧩 Simulink Project Setup

  1. Unzip the provided archive.
  2. Copy the extracted folder to a directory without spaces or accents.
  3. Open the project by double-clicking on BotAplus_SL.prj.
  4. Navigate to the PROJECT SHORTCUTS tab to explore the structure.

Required Robot Drivers from botnroll.com®

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)

Project Structure

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

🧠 Working with the Models

1. Test the Hardware: All_Testing_SPI

  • 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

2. Run the Challenge: Crazy_Challenge

  • 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

3. Creating Your Own Model

  1. Add the block Init SPI&I2C (connect it to a terminator).
  2. Set the Stop Time to inf.
  3. Open Configuration Parameters → Select Arduino Uno board and COM port.
  4. Click Apply and OK.
  5. Use Monitor & Tune to test and iterate your design.
  6. Save your model in the models directory.

4. Physical model of the robot: Botnroll

  • Open Botnroll.slx from the plant folder
  • Run the simulation and analyze the battery discharge with the Data Inspector

🧾 Closing the Project

To properly close the Simulink project, click the X in the upper-right corner of the Simulink Project window.


📚 Additional Resources


License

The license is available in the License.txt file in this GitHub repository.

Community Support

MATLAB Central

Copyright 2025 The MathWorks, Inc.


About

Learn to Program the Bot'n Roll ONE A with MATLAB and Simulink

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors