■ BY PHIL DAVIS
DESIGN A MINI SUMO — PART 2
FOR THOSE JUST JOINING or the
uninitiated, a Mini Sumo Robot and Mini
Sumo competitions take their name from
the Japanese form of wrestling called Sumo.
In this case, two robots (smaller than 4 x 4
inches) combat in a black ring just over 30
inches in diameter, bounded by a one-inch
border. For three minutes, each robot attempts
to locate the other and push it off the edge.
■ FIGURE 1. CPU Board.
Last month, we went over mechanical design of a Mini Sumo robot.
This month, I would like to discuss the
software that makes it all work, but
first, a few words about the CPU
board that I used on the bot.
As I mentioned, for the Mini Sumo
event our robotics club sponsored,
we standardized on a small CPU board
we call the “Brandon Board” after
Brandon, a club member who designed
it and basically built 15 of them for us.
THE CPU BOARD
This board is built around an
Atmel Mega32 — an eight-bit RISC
processor of which the PWM lines
drive a TI SN754410 1A dual H-bridge.
And that is pretty much it, along with
a bunch of the I/O lines surfaced in
the form of pin headers, allowing for
the easy connection of sensors and
switches (see Figure 1). Brandon also
provided a JTAG interface for this
board, which simplified the downloading and debugging process.
So ... we have the mechanical
82 August 2006
platform, motors, wheels, and a CPU
board. What’s next? Well, we need
some mechanism to write programs
and another mechanism (if not the
same one) to download the programs
into the CPU board. Here we get to
use my favorite word again ... FREE!
Yep, free for both the compiler and
the downloader; can’t beat that for
the hobbyist budget!
I choose to write the code for the
Mini Sumo in ‘C’ — a rather straightforward language which allows you to
get down and dirty and close to the
hardware when necessary. The free C
compiler System is WinAVR which
includes the GNU GCC compiler and
may be downloaded from http://
winavr.sourceforge.net/ This system
comes with a Programmer’s Notepad
(an editor for writing your C code),
a Wizard for generating your own
custom makefile (used to compile),
and some other useful bits and pieces
including a pre-built library (AVR
Lib with source code) to make
programming the Atmel parts easier.
The FREE application which
allows you to download and debug
your application is AVRstudio from
Atmel and can be downloaded from
These are two excellent systems
which work together very well to
provide a complete software development environment for the Atmel
processors. Without going into a lot of
detail, there are two ways you can use
this development system.
One way is to develop all your
code using the Winavr Programmer’s
Notepad, compile using a Makefile,
then use AVRstudio to download the
object (hex file) and debug. The
other way is to use AVRstudio as the
editor/development environment, as
well as the downloader and debugger.
You can do this with the aid of a
plug-in called avrgccplug-in. Both ways
work, so it’s really just a matter of
PROGRAMMING THE APP
At last! We are in a position to
write some code and get our bot moving, but first, a slight diversion. The
conventional programming wisdom of
a microprocessor this size suggests we
do it with Basic, or in our case C, and
that we write the code directly on top
of the architecture of the chip.
At first glance, this appears to be
a simple and easy way to program
your app and, to be honest, it is (at