Encoder Front Page
SRS Home | Front Page | Monthly Issue | Index
Search WWW Search seattlerobotics.org

Robot: Cherry Blossom

Larry Barello (larry@barello.net)

Mini-sumo is a robotic competition class being promoted out of Seattle by Bill Harrison of the Seattle Robotics Society www.seattlerobotics.org. The robots are constrained by a 10cm square size and a 500gm weight limit. They can't destroy the playing ring or other robots, but pretty much anything else goes.  The goal of the game is to find and push your opponent off the playing field, which is a circular platform about 3 feet in diameter.

My mini-sumo, affectionately called Cherry Blossom, uses the Atmel 90S2313 AVR processor, my operating system  AvrX and a couple of extra drivers for servos, gear-head motors and a proximity sensor (sharp GP2D02). It sports a flashy black Plexiglas body that minimizes I/R reflection along with a stealth sloped front to further minimize I/R reflection and detection.


The base is cut from sheet aluminum. The gear head motors are standard R/C servos with the electronics removed and cut on my table saw (!) to allow them to mate together. This allowed me room for some fat racing tires, rather than the skinny O-ring tires typically found on mini-sumo bots. In competition, the fat tires did not give Cherry Blossom any advantage.  In fact, silicon O ring tires were just as good.  However, the fat tires look cool.

Below is a better picture to illustrate how the servos mate together.  The fat portion of the cut up servo contains the motor.  The gear train is in the "top" of the servo.  It just happend that with the plastic removed, I could get the two output shafts aligned.  A small plate of aluminum (visible above, below the wires) was used to compress and hold the servos in place.

For reasons lost in antiquity, I chose to put one Sharp GP2D02 proximity detector on another servo and scan the playing field for other bots to attack. I had to use a sub-micro servo in order to get the sensor low enough to detect other bots. It turns out that most are no taller than their drive wheels, about the height of Cherry Blossom..

The micro servo is attached to the proximity sensor with a bit of aluminum and super-glue. The servo is attached to Cherry Blossom's aluminum frame with some double sided sticky tape.  

The next challenge was to make the controller small enough to fit between the wheels. The motor driver is an L293D dual H-bridge driver (below the heat-sink). The other parts are: a reset button, crystal, some bypass capacitors, 5v regulator and some load resistors and visual feedback LED's for the playing ring edge detectors. The blue trim pot is used to set the sensitivity of the edge detectors.  This entire board is only 1.5" square.  The biggest problem I had was finding room for all the connectors!  They couldn't be vertical since that would interfere with the scanning sensor.  In fact, I ran out of room:  Hence the power supply is hard wired into the board (the black and red wires, below).

Finally, I had to fit in 6 batteries and the edge detectors. Four batteries fit on the bottom just fine, held in place with hot melt glue. The other two are stuffed in front of the CPU board.

To prepare for the Northwest Sumo contest, held May 15, 1999 at the SRS, I added a rear proximity detection system. It consisted of a 40khz I/R receiver (I dunno what brand or make since I gutted it from a parking proximity detector for a car) and two I/R LED's. I drove the LED's with two spare output pins from the 2313 and checked the state of the detector with a spare input pin. Actually, the code is set up to check a front detector as well, but I did not have time to finish that circuit board.

The sensor is the black blob to the (stage) left of the trim pot.  Several issues came up with this design:  First, the detector is very sensitive.  I had to throttle the drive to the LED's with a trim pot to get rid of false hits.  Also, I had to shield the LED's from the floor.  It turns out that when the LED's are bright enough to allow detection of another robot, the floor reflects too much light and is constantly detected by the sensor. To solve that problem I put the LED's into brass tubes cut at an angle.  The part that blocks the light is pointing down and in a bit. Below is a photo of the rear detector removed from the robot.

For the Fall 1999 SRS Robothon, I added a front sensor.  It looks very similar to the rear one, except that I used a gutted Everlight detector.  I had similar problems with shielding the LED's from the floor to prevent false detections.


The AT90S2313 processor has 2kb of FLASH program memory (1024 instructions), 128 bytes of RAM and 32 registers; a UART, two timers, and 15 I/O lines in a 20 pin package.  1024 instructions doesn't seem like a lot, but the AVR instruction set turns out to be very compact and lots of functionality can be stuffed into that memory.  AvrX uses about one third the code space, the monitor uses about a third and all the mini-sumo functionality uses the remaining third.

All timing and drive functions are done in software. Timer0 is used to drive the high speed PWM logic (150khz interrupt rate) and Timer1 drives the system clock (2400/sec).  The high speed interrupt calls routines to form the R/C Servo Pulse, the PWM output for driving the L293D and a clever 9 cycle routine that flashes the I/R LED's at 1/4 the basic interrupt rate.

Cherry Blossom code has three main independent tasks that implement behavior using the subsumptive software model: At the top is the long distance detector looking for targets.  It sets wheel speeds appropriate to turn Cherry Blossom towards the nearest target.  The next level is the front & rear proximity detectors (the 40khz I/R): If they detect something "close" they override the drive information and force Cherry Blossom to take immediate action.  Immediate action can be either turn towards or away from the detected object, depending upon where it was detected. Last is the playing field edge detectors: When they trip all other commands are discarded and Cherry Blossom executes an evasive maneuver turning away from the edge. 

The following table points to the software modules that are loaded into Cherry Blossom.  The operating system, AvrX, is not included but can be seen here.  

Here is a ZIP file of all the software: sumobot.zip.

SumoMon.asm Mini-Monitor for controlling/debugging the robot. It is a skinnied down version of the monitor found in the AvrX code. I needed to make it as light as possible in order to shoehorn it into the 2313
Hardware.inc Include file describing the robot's hardware configuration
Drivers.asm Contains the heart of the mini-sumo: targeting and boundary avoidance. The targeting has embedded in it the driver for the Sharp GP2D02 sensor and a positioning algorithm for the micro-servo. There is a high speed interrupt handler that manages two channels of PWM, the servo pulse formation and the 40khz signals for the front and rear LED's
SumoBot.asm Top level hardware and software initialization
eeprom.asm Targeting angles and motor drive values
registers.inc Register definitions

To build the software you need the Avrx files, the IAR assembler, v1.40 and the following scripts:

build.bat Batch file to assemble and link the files
debug.xcl Link command file for debug and hex output
eep.xcl Link command file for generating the EEPROM output

For more information about Avrx, IAR assemblers and other projects I have worked on, please visit my web site www.barello.net or send email to larry@barello.net