Awkward Segway: A Self-Balancing Bot

/media/uploads/jdanner3/standing.jpg

Overview

Team Members: Anthony Agnone, Jay Danner, Nico van Duijn, Samer Mabrouk.

This project consists of a robot balancing vertically on two wheels.

/media/uploads/jdanner3/overview-diag.png

We use the 9-axis IMU LSM9DS0 to give us Accelerometer and Gyroscope data about the current angle and angular velocity of the robot. This data is then filtered using complementary filters and PID control to drive the two motors. The motors are controlled through digital outputs in their direction and their speed by PWM using an H-bridge.

/media/uploads/jdanner3/overview-diag2.png

A user can view relevant control data and send inputs to the Mbed balance controller through a C# GUI. The host PC sends these inputs using a pair of XBee wireless modules, controller via serial connection.

Windows C# Control Panel

/media/uploads/jdanner3/maingui.png

Provided with the project is a portable executable that communicates with the Bot via a USB XBee module. The executable opens an available COM port on the host computer and begins communications with the embedded XBee module on the Bot.

/media/uploads/jdanner3/comportgui.png

/media/uploads/jdanner3/xbee.resized.jpg

The C# GUI allows a user to monitor the following values, under the heading "Mbed Data Values:"

  • Accelerometer Bias
  • Gyroscope Bias
  • Offset Angle
  • Current Angular Velocity
  • Turnspeed
  • PID Terms

The user can also tweak control system values dynamically, under the header "Mbed Programmable Values:"

  • KP: "Proportional" term in PID control.
  • KI: "Integral" term in PID control.
  • KD: "Derviative" term in PID control.
  • Global Scalar: Scalar for all output gains.
  • Turnspeed: Varies the motor speeds to turn the Bot.
  • Desired Angle: Changes the Bot to move forward or backward.

Hardware Used

Software Used

Assembly

/media/uploads/jdanner3/embed.resized.jpg

IMU

IMU Pinmbed Pin
SCLp10
SDAp9
VddVout
GNDGnd

H Bridge/Mbed

H Bridge Pinmbed Pin
GNDGnd
VCCVO
VMOTVsupply
GNDGnd
PWMAp21
AIN2p23
AIN1p24
STBYVout
BIN1p26
BIN2p25
PWMBp22
GNDGnd

H Bridge/Motors

Left Motor is to the left of the IMU chip, and theRight Motor is to the IMU's right.

H Bridge PinMotor Wires
BO1Left Motor Black
BO2Left Motor Red
AO2Right Motor Black
AO1Left Motor Red

XBee

TXp13
RXp14
VddVout
GNDGnd

Robot Construction

In order to have a robot with the correct structure, the wheel mounts in the middle of the RedBot kit were moved to the far end of the robot.

After the wheels and DC motors were remounted on one end of the robot, the IMU was placed inline with the wheel axes. The placement of the IMU is important to receiving only rotational data, rather than translational.

/media/uploads/jdanner3/standing-stripped-down.resized.png /media/uploads/jdanner3/accel5.resized.jpg

The breadboard connecting the Mbed and the sensors was fastened atop the RedBot. Two 6V battery cradles (8 batteries total) were used to power the Mbed and motors. The cradles, also mounted on the top of the robot, created a top-heavy Bot.

/media/uploads/jdanner3/topboard.resized.jpg

Code

The Bot Mbed-side code is found at the repository below.

Import programAwkwardSegway

Robot that balances on two wheels

Host-side C# Control Panel source code and portable executable is found below.

/media/uploads/jdanner3/controlsystemcommviaxbeesamer.zip

/media/uploads/jdanner3/controlsystemcommviaxbee.exe

Demonstration

The Awkward Segway standing, configured with a Desired Angle of 0.0.

The Awkward Segway turning, configured by varying the Turn Speed dynamically, through the C# Control Panel.


1 comment on Awkward Segway: A Self-Balancing Bot:

02 May 2015

Not bad for a $15 robot base and motor kit, and a $20 IMU chip.

Please log in to post comments.