Self-Balancing Motor Cycle Using Arduino Engineering Kit Rev 2
This example shows how to use Arduino® Engineering Kit Rev 2 to build and program a motorcycle bot that self-balances and maneuvers by itself using a flywheel. The project models the motorcycle with the help of inverted pendulum dynamics and performs inertial sensing to balance the motorcycle by controlling the flywheel, located at the center of the motorcycle.
The motorcycle is controlled by an Arduino Nano 33 IoT board, that is interfaced with the Arduino Nano Motor Carrier, a DC motor to move the back wheel, DC motor with Encoder to control the inertia wheel and a standard servo motor to steer the motorcycle handle.
Simulink® Support Package for Arduino Hardware
Before you start exploring the Self-Balancing Motor Cycle project, complete these steps:
1. Understand the basics of Arduino Engineering Kit Rev 2 and install the tools as described in Unboxing and Installation. Because you have already installed the Simulink add-on for Arduino hardware (Simulink Support Package for Arduino Hardware), you can proceed with the installation of the other tools.
2. Learn how to get started with Arduino environment and the tools, as described in Arduino, MATLAB and Simulink.
3. Learn the basics of DC motors, servo motors, IMU (Inertial Measurement Unit), and motor control system, as described in Basics of Mechatronics.
Assemble the Motor Cycle
To assemble the motor cycle from the components included in Arduino Engineering Kit Rev 2, watch the video in the Project Overview section of Project Self-balancing Motorcycle.
Project files for Self-Balancing Motor Cycle
The required files for Self-Balancing Motor Cycle project are downloaded and installed as part of the MATLAB Support Package for Arduino Hardware installation. You can find these files in the folder aekrev2projectfiles.instrset. Use this MATLAB command to view and access the files:
fullfile(matlabshared.supportpkg.getSupportPackageRoot, '3P.instrset', 'aekrev2projectfiles.instrset')
The Motorcycle subfolder in this main folder (aekrev2projectfiles.instrset) contains the files described in the detailed workflow at Project Self-Balancing Motor Cycle.