University of Illinois at Urbana-Champaign

GE 423 Introduction to Mechatronics

Final Project Spring 2005 by Nicolas Gatzke


Gameboy + SegBot = SegBoy





The Objective of this project was to build a new 2-Wheels balancing robot controlled by a Gameboy Advanced with the help of the XPort and XRC from



Building the SegBoy, a two wheeled balancing robot, was my semester project at the University of Illinois , necessary for getting my masters degree in Business and Electrical Engineering at my home university, the Darmstadt Technical University, Germany.

The control is done by a regular Gameboy Advance ( ), using the XPort and XRC board from . The SegBoy uses a tilt and a tiltrate sensor to measure its tilt, 2 optical encoders to read the position of the wheels, an additional encoder for giving an input, and 2 infrared sensors for distance measuring. Based on those sensor information, the control algorithm creates different PWM outputs for the different modes of the SegBoy.


Technical information

The SegBoy is using 2 PWM controlled motors for moving the 2 wheels independently, connected to 2 optical encoders (data) by a gear with a 2:1 ratio.

The center board includes amplifiers, the tilt sensor and the tiltrate sensor. It is powered by 2 Thunderbird batteries, outputting enough voltage and current for the 2 motors as well as all sensors connected. This alternative power supply for the sensors was necessary, as the XRC board can only output 3.3V, while the sensors used operate at 5V.

On the XRC board, at the moment only the 12-bit ADC converted is used; as it is powered by the batteries of the GBA over the XPort, the power supply of the XRC was not necessary. All sensors are connected to the XRC, where the digital I/Os are just looped through it directly into the XPort.



The SegBoy can operate in 4 different modes:

“Balancing”, “Right Wall Following”, “Left Wall Following” and “Driving”. Additional, there is a setup mode to show all raw sensor values, regulate different parameters of the control algorithm, displaying the pin connection, etc.

The modes use 3 or 4 states as inputs for the control:

1.) Position, calculated by the velocity read by the optical encoders

2.) Velocity, derived from measuring the change of the optical encoders

3.) Tilt, derived as a filtered tilt sensor signal combined with a tiltrate signal

4.) Tiltrate, measured by a tiltrate sensor


Balancing Mode:


In this mode, the Segboy tries to keep its actual position. It uses all 4 states. A turn command derived from the difference of the position between the 2 wheels makes sure it is keeping a straight position, while the information of the other 3 states are used for keeping it up. A front and back IR can be used for avoiding collusions.

With the GBA's buttons, the offset of the tilt sensor can be changed; this might be necessary if the batteries are changed, or a use of an GBA SP instead of a regular GBA (e.g. if the robots center of gravity changes for some reason).


Right Wall Following Mode:

The SegBoy starts in a balancing status. Using the buttons of the GBA, a velocity is added. The information of the IR sensor pointing to the right wall is used to output a turn command s.t. the SegBoy is keeping a certain distance to the right wall. The signal from the IR sensor pointing to the front is used for starting a left turn once an object comes too close. Only 3 states are used now, as the position information is not necessary in this mode unless used for a positioning system or similar. With the keypad, additional to the velocity the distance to the right wall and the distance to the front wall (i.e. when to start turn) can both be changed.


Left Wall Following Mode:

Similar to the Right Wall Following, except the second IR sensor is pointing left.


Drive Mode:

The SegBoy again starts in a balancing status. A velocity forward or backward can be added with the buttons of the GBA. A third optical encoder can be connected for steering purpose. The IR sensor in front and back can be used to stop if the SegBoy moves to close to an object to avoid a collusion. Again, only 3 states are used.


Future Works

The first following work on the robot should be to set up some kind of wireless connection (the XRC e.g. already has a socket for adding a Bluetooth modul on it) to set up a communication between the GBA and a PC. Not only data and values can then be received, but also a system for steering the SegBoy could be implemented.

The advantage of the GBA controlled robot compared to a one controlled with a DSP or similar is obviously the multimedia features it supports. With the different modes the robot can be driven in, the display of values, the implementation of sounds and the possibility to change parameters over the GBA's keypad, the potential is by far not at its limit. One could think of drawing a map of the environment of the SegBoy with the data collected by the sensors or received from an external source like a PC.

The newer version of the XRC board, which is not released at this point of time, also supports interfacing a CMOS camera. With the help of the fast FPGA, it should be possible to implement different kinds of vision processing.



Right Wall Following

Drive Mode

Balancing Mode