Self Balancing Robot Segway

Team members: Felipe Gramacho, Luke Rucker, Mukund Pandiri, Steven Pyon.

Overview


The idea for this project is to create and assemble a robot that can maintain its balance while moving. There are many challenges that come with this proposition, such as having a physical robot that can stand, while having the necessary components attached to it, as well as finding the right components for development.


To build the robot, we used a chassis kit that came with two DC motors and two wheels. With the wheels and motors attached to the chassis, we attached a breadboard to carry the remaining components.


The main component on the breadboard is an Mbed controller which acts as a control system for the entire device. Connected to the Mbed are an H-bridge, which can drive each of the motors forward and backward, an IMU, which includes a Gyroscope and an Accelerometer which were used to measure its motion and balance, and to provide feedback to the controls, and a bluetooth module for user input of speed (based on desired angle) and constants of the control system.


The following sections outline exactly how this robot was assembled, linking to each of the components used, provide the code written for the control system, and present the final product in pictures, as well as a demonstration video.

Hardware Used


Software Used


Robot Assembly


Component Schematic

https://os.mbed.com/media/uploads/fmmgramacho/4180_proj.png

The IMU is used to provide the Mbed with data of the angle using the Gyroscope. This data is then used to drive the H-Bridge which in turn controls two DC Motors directly connected to two wheels. The Bluetooth module is used to input user data to control the robot.

Construction

The two wheels were mounted on the far end of the chassis to create a vertical structure that will require balancing controls. The breadboard connecting the Mbed and the other components was then attached to it as to not create a weight imbalance.

Robot

Back
Side

The following is a video showcasing the individual parts of the robot:


The IMU, the H-Bridge, and the bluetooth module were connected to the Mbed and the motors with the following pin configurations:

IMU

IMU

IMU PinMbed Pin
SCLp10
SDAp9
VDDVout
GNDGnd

H-Bridge and Motors

H-Bridge
DC Motor

H-Bridge PinMbed PinMotor Wires
VMVsupply-
VCCVO-
GNDGnd-
A01-Right Motor Red
A02-Right Motor Black
B02-Left Motor Red
B01-Left Motor Black
GNDGnd-
PWMAp21-
AI2p23-
AI1p24-
STBYVout-
BI1p26-
BI2p25-
PWMBp22-
GNDGnd-

Adafruit Bluetooth

ble

Adafruit BLE PinMbed Pin
GndGnd
VinVU
RTS-
CTSGnd
TXOp27
RXIp28

Power Wiring

https://os.mbed.com/media/uploads/fmmgramacho/barreljack_pic.jpg

Barrel Jack PinsPower Lines
GroundGnd
PowerVsupply
Plug Detect-
Power LinesMbed Pin
GndGnd
VsupplyVin

Code


The algorithm will make use of a negative feedback loop with an error measured. This error will be represented by the angle by which the device is tilting, as measured by the IMU, and it will be used to adjust the speed of the robot.

The speed will be adjusted according to the principles of controls systems:

  • Kp - constant of proportionality
  • Ki - constant of integration
  • Kd - constant of derivation
  • Desired Angle - Angle the robot should be at which can be changed over bluetooth to allow for remote control

Remote Control: The remote control actions can be found in the bluetooth section of the code. Currently the press of the right or left causes the bot to turn but this can be changed by changing the lines that are commented out. We used the Bluefruit connect app (control pad on it) to control the robot.


The code can be found in the following repository:

Import programsegway-balancing

self-balancing-robot

Demonstration


Presentation


Please log in to post comments.