Solarbotics SUMOVORE User manual

Ltd
®
Document Release: November 20, 2006
Produced by
The Solarbotics SUMOVORE
Atmel ATMega8L Brainboard Add-on
Version 2.0
Ready to step up from the discrete brain on
your stock Sumovore?
Here’s theAtmel ATMega8L-based Brainboard to take over!
The ATMega8L is a very popular microcontroller, supported by many
programming languages (some free!). Program it with a home-made parallel-
portcable,orusethepopularAtmelSTK-500developmentsystem.
The new version 2 brainboard adds full I2C interface support, better
programmability andtheabilitytoaddbread-boardspace!
It’s a fast, inexpensive, and very powerful upgrade for your
Solarbotics Sumovore Robot Kit!
(Sumovore Sumo robot kit and programmer/DB25 printer cable req’d)

We strongly suggest you inventory the parts in your kit to make
sure you have all the parts listed. Use a pen, pencil, pricked finger,
chocolate bar - anything to mark off the items. If anything is
missing, contact us for replacement parts information.
Disclaimer of Liability
Solarbotics Ltd. is not responsible for any special, incidental, or
consequential damages resulting from any breach of warranty, or
under any legal theory, including lost profits, downtime, good-will,
damage to or replacement of equipment or property, and any costs
or recovering of any material or goods associated with the assembly
or use of this product. Solarbotics Ltd. reserves the right to make
substitutions and changes to this product without prior notice.
(Sorry, gotta make the lawyer happy!)

(ii)
ATMega8 Brainboard Components
1 - Printed Circuit Board (PCB)
1 - 0.1µF capacitor (labled ‘104’)
5 - Tiny red LEDs (sensor indicators)
1 - Tiny green LED (programming indicator)
1 - 2N3904 NPN Transistor
3 - 240 Ohm Resistors (Red/Yellow/Brown) for Positions R1, R2, R3
6 - 10k Resistor (Brown/Black/Orange) for Position R4, R13, R14, R15, R16, R17
5 - 1k Resistors (Brown/Black/Red) for Positions R5, R6, R7, R8, R9
1 - 100k Resistor (Brown/Black/Yellow) for Position R10
2 - 47k Resistors (Yellow/Violet/Orange) for Position R11, R12
1 - ATMega8L 28 pin Carrier
1 - Atmel ATMega8L Microcontroller
1 - Reset Button
1 - QRD1114 edge sensor (for Sumovore’s middle sensor)
1 - 5-Socket programming header
1 - Polarized 5-Pin I2C interface header
1 - 10-Pin (2 rows of 5 pins) STK-500 programming header
1 - 5-Pin Header (for building optional programming cable)
2 - 4-Pin Sumovore interface headers
2 - 8-Pin Sumovore interface headers
1 - 5-Pin Low-profile Socket for Breadboard expansion board
1 - 11-Pin Low-profile Socket for Breadboard expansion board
Tools Required
Soldering equipment
Side-cutters or fine snips
Computer (for programming / downloading code!)
The ATMega8L Brainboard
Parts List
2x5 programming header
5 socket header
2N3904
0.1µF
capacitor
Tiny LEDs
ATmega8L & carrier
Long 4-pin headers
Long 8-pin headers
Resistors
(17 total)
Reset
button
5-pin
programming
header
QRD1114
I2C Header

Looking for a more flexibility out of your Sumovore? Well, welcome to the
next in our series of brainboards - the ATMega8L. The ATMega8L offers
an impressive list of features, including (but not limited to):
!8kB flash memory
!Three Pulse-width modulation (PWM) channels
!Six Analog-to-digital converters (ADCs)
!In-circuit programmable
!Internal RC oscillator (optional resonator needed to surpass 8MHz)
!23 programmable Input/Output (I/O) lines
2
!I C protocol for sensor networking
!Single clock execution up to 1MIPs/MHz (this means “it’s QUICK”, like
250 times faster than a standard Basic Stamp 2!)
We’ve made good use of the capabilities of the ATMega8L, but there’s lots
more you can do with it, including program it with the free open-source
GCC C-compiler (our weapon of choice) or other compilers for BASIC,
JAL, Java, Assembler, Pascal, Forth,... it goes on and on!
This is not a kit for a microcontroller beginner. Anybody using this
brainboard should have the appropriate skills, or be ready to learn the
techniques that make a microcontroller... microcontrol!
This kit lets you swap out the default discrete brainboard for a
programmable version. If you run into any problems, it’s a simple process
to swap a different brain back in. We’ve had days when it’d be nice to swap
in a new brain, haven’t you?
This brainboard features:
!Atmel ATMega8L microcontroller
!5 indicator LEDs & 1 programming LED indicator
!STK500 and SP-12 programming headers
!Microprocessor Reset Switch
!Standard 0.1” expansion interface holes for breadboard add-ons
!Expansion interface featuring:
!5 digital / interrupt I/O (Port D 2-6, shared with LED indicators)
!5 analog inputs / digital I/O (Ports C 0-4, shared with line sensors)
2
!I C Bus
!Regulated 5V and Raw 6V
!Access to the microcontroller serial interface (level shifting req’d)
Introduction
The ATMega8L Brainboard

Step 1 - 3 x 240 Ohm Resistors (Red / Yellow / Brown): These resistors are
part of the SP12 programming interface that buffer the signals. Install in positions
R1, R2, & R3.
Building It - Steps 1, 2, 3
The ATMega8L Brainboard
Step 1:
240 ohm resistors
Install at
R1, R2, R3
Step 2 - 1 x 10k Resistor (Brown / Black / Orange): This 10k resistor is the
signal pull-up for the reset switch. Install it in position R4.
Step 2:
10k resistor
Install at R4
Remember - when you’re building this kit, you must bend the resistors down
right near the resistor body. This PCB is designed on the tight side, so being
compact counts!
Steps 1-2
Complete
Step 3:
1k resistors (x5)
Install at
R5, R6, R7, R8, R9
Step 3 complete
Step 3 - 5 x 1k Resistors (Brown / Black / Red): These 5 resistors are installed
in positions R5, R6, R7, R8, & R9. These resistors limit the current going to the
red tiny indicator LEDs (yet to be installed).
Note: If you need extra I/O for other purposes, you can re-use these ports by
leaving these resistors out. Of course, then you have no blinky lights!

Steps 4, 5, 6
The ATMega8L Brainboard
Step 4 - 100k (Brown / Black / Yellow) Resistor:
position R10. This resistor works with the transistor to turn on the
programming LED.
Install the 100k resistor in
Step 5 - 2 x 47k (Yellow / Violet / Orange) Resistors:
installed in positions R11 and R12. These are the ‘pull-down’ resistors for the
motor enable lines, which keeps the motors off by default.
The 47k resistors are
Step 4:
100k resistor
Install at R10 Step5:
47k resistors (x2)
Install at R11,R12
Step 6 - 5 x 10k (Brown / Black / Orange) Resistors:
installed in positions R13, R14, R15, R16, and R17. These are the ‘pull-up’
resistors for the five edge-detection sensors.
The 10k resistors are
Step6:
10k resistors (x5)
Install at R13, R14,
R15, R16, R17
All resistors
installed!

Steps 6, 7
The ATMega8L Brainboard
Step 7 - Tiny Red Indicator LEDs:
Really. Besides, they truly are useful for figuring out what your robot is thinking
at any moment.
Unlike resistors, these have to be installed the right-way-around. Look
underneath the LED to see which side has the painted bar. That’s the side that
goes nearest to the bar symbol on the PCB.
Put the red ones in positions LED 1 through LED 5.
Step 8 - Tiny Green Programming LED: This LED is on when connected to the
programmer, and flickers during the download process. Note that you can also
use this LED as an indicator via software.
You can’t have a robot without blinky lights.
Step 7:
Red Indicator LEDs (x5)
Install at ‘LED 1’ thru
‘LED 5’
Note side with
painted line
Match line
with bar
Step 8:
Green programming LED
Install at “PROG LED’

Steps 9, 10, 11, 12
The ATMega8L Brainboard
Step 9 - Reset Button:
robot behave! We do this by installing the reset pushbutton at position Reset.
The holes may be a little snug, so if you want it to sit flat to the PCB, use some
force to get it in there.
Step 10 - 2N3904 Transistor: Install it in the position shown, with the curve
of the transistor matching the curve shown on the PCB.
Step 11 - 0.1µF Capacitor: This capacitor is installed
at position C1. It doesn’t matter which-way around it
goes.
Sometimes you have to reach out and ... make that
Step 9:
Reset Button
Step 10:
Transistor
Step 11:
Capacitor
Step 12 - Chip Carrier:
Think about the trouble you’d have removing it if it failed, or was installed
backwards! Try to install it with the notch matching the one on the PCB, ok?
“Why not just solder the chip right in?” you may ask.
Note Notch
Position Step 12:
Chip Carrier
Carrier installed.
Note notch position!

Steps 13, 14, 15
The ATMega8L Brainboard
2
Step 13 - I C Header: Going to interface to other I C peripherals? You’ll need
to install this header. Make sure the big flat tab is nearest the top of the PCB,
2
where the long line is shown on the symbol. Install it in the position marked I C
Port.
Step 14 - SP-12 Header: If you’re
planning on using a build-it-yourself
parallel-port programmer, you’ll
need to install the 5-socket header
at location SP-12.
Step 15 - 10 Pin ISP Header: The
10-pin ISP (”In Circuit
Programming”) header interfaces
with most popular Atmel
programming tools. Install it in
position 10 Pin ISP.
Step 13:
2
I C Port
Step 14:
SP-12 Step 15:
10 Pin ISP
(2 rows
of 5 pins)
2
I C Header:
Note tab position!
You’re almost done. With the exception of the expansion sockets (later), you’re
done on the top-side. Let’s flip the PCB over, and work entirely on the other
side to install the mounting pins.
Completed all the
necessary topside component
soldering!
2

Steps 16, 17
The ATMega8L Brainboard
Step 16 - 8 Pin Headers (x 2):
you’ll need to solder the two 8-pin headers in positions P1 and P2, but on the
underside. I don’t think you heard me, so...
NOTE / IMPORTANT / READ ME, DARN IT: Install all these pins on the
bottom of the PCB. See the dashed outline around P1, P2, P3, and P4 on the
top of the PCB? That means “This is where they go, but on the bottom.” There.
Hope we’ve made that clear! (Once more: “Solder them on the bottom!”)
To attach your new Brainboard to the robot,
Step 16
8-Pin Headers
(on underside!)
Step 17
4-Pin Headers
(on underside!)
Another Important Note! Yes, ANOTHER one!: As these pins will mate with
the sockets on the main robot body, you should try to get them installed as
straight as possible. If you don’t get them straight, you’ll be fighting to match up
all the pins to all the sockets! Here’s what we suggest you do:
Hold in the pins with your fingers, and solder just one
on the other end of the strip.
Solder here...
...while holding here! Bend the strip until
it sits perfectly
upright (like shown
here), then solder
the rest of the pins!
Step 17 - 4 Pin
Headers (x 2):
Just like with the
8-pin headers,
install these on
the underside, in
locations P3 and
P4.
Finished Pin
Installation!

Step 18, 19
The ATMega8L Brainboard
Step 18 - Short Expansion Port Headers:
expansion board immediately, it’s best to install the headers now so they don’t
get lost. Install them on the top-side in Expansion 1 and Expansion 2 spots.
These headers are special in that they’re short, specially selected to mate with
short-pins on the expansion breadboard.
Although you may not use an
Short
5-Pin
Header
Short
11-Pin
Header
Step 19 - Install Atmel ATMega8L - This is a static-sensitive part, so if you
frequently “zap” people, you’ll have to be careful. Do this near a sink, and touch
the metal faucet just before doing this, as it will remove any static charge.
Insert the Atmel microcontroller. Note that the notch on the end of the chip
must match the notch on the PCB, which is on the left side.
As the chip has legs that splay out a bit, you might want to bend the legs inward
so it fits into the chip carrier easier.
(repeat for each side)
...ends like
this!
Gently bend all the chip
pins inwards.
Starts like
this...
Note Chip Notch
Position
Note:
We’re working
on the top again!
Regular 5-Pin
Socket
Short 5-Pin
Socket
Short 11-Pin
Socket
10-Pin
Header

Step 20
The ATMega8L Brainboard
On the Sumovore, you have to add the center edge-sensor to make full use of
the Atmel Brainboard:
Step 18 - Installing the 5th line sensor:
your Sumovore, and install the included line sensor in position ‘Edge3’, just like
you did when you originally built your Sumovore.
Yank the edge-sensor board out of
Step 18: Add the 5th
line sensor
Optional external
resonator, or add’l
I/O PB6, PB7
Unreg’d
6V
TTL
Serial
Port
Spare
PD7 &
PB0 pins
The Brainboard has some pretty cool additional features which you may never
need to use, but they’re here if needed:
!Unregulated 6V power from the main 4-cell battery pack
!Microcontroller TTL serial port access (needs external RS232 level shifting)
!Location for installing external resonator (used for precision timing), which
also can be used as additional I/O (PB6 / PB7)
!Tap points for utilizing unused PD7 & PB0 pins
PB6 PB7

The SP-12 Programming Cable & Programming Introduction
The ATMega8L Brainboard
SP-12 Programming Interface: If you’re doing this on-the-cheap, you’ll most
likely program the Brainboard via your computer’s parallel port (most often
connected to a printer cable). The SP-12 serial programmer is released under the
GNU license by Ken Huntington, Kevin Towers, and Pitronics (learn more at
http://www.xs4all.nl/~sbolt/e-spider_prog.html). We’ve combined some of the
parts (the resistors, transistor, LED) into the brainboard to make building the
cable a simple project. Find a discarded printer cable, and get hacking!
Completed cable, with heatshrink sleeve and
scrap plastic 5-pin header support
13 1
14
25
Back of DB25 connector (looking at SOLDER/Wire side!)
Programming
header
MISO
MOSI
SCK
RESET
GND
SP-12 Physical Wiring Diagram
23911
Your ATMega8L comes pre-programmed, ready to go, but if you want to
make changes, you’ll need a “development suite” to help you program, compile
and download to your robot. Most people start by using “C”, so we suggest
using the “GNU C Compiler” (aka: “GCC”) with “WinAVR” from
tm
http://winavr.sourceforge.net/ (on the Windows XP platform). Install the
package, and make sure you run the “giveio.bat” program, which enables direct
port access. Full installation notes are available with the download, or from the
“resources” section for the Brainboard at http://www.solarbotics.com.
Connect the cable the robot and the PC. Disable the motors on your robot
before powering the robot on (use the robot’s motor enable switch). A good
connection makes the green programming LED glow. No light = no connection,
so make sure the cable is connected the right-way around to the robot.
Grab the latest code from our website, and open the “Sumovore_2.proj” project
file with WinAVR, which will automatically load up all the support files. “Click on
“Tools”, then “[WinAVR] Program”. This creates the machine code, and
downloads it to the robot!
There are three sections to the code, startup, Sumo, and the Line-follower. If you
start your Sumovore on a black sumo-ring surface, the low signal from the edge
sensors kick into sumo mode. White surface reflection (white table with black
electrical tape line)kicks the Sumovore into running the line-follower routine.
Pin1
Pin25

Programming the BrainBoard
The ATMega8L Brainboard
Atmel STK-500 Programming Interface:
The STK-500 is a handy, inexpensive interface
board from Atmel that lets you program practically
all Atmel microcontrollers. This brainboard
interfaces with it via the “ISP10PIN” header. Match
up the “Pin1” lines with the red stripe on the cable,
and make sure the motor enable switch is off. If
you don’t, the STD-500 will try to power up the
motors.
Using “GCC” sourcefiles from Solarbotics.com,
open “Sumovore_2.aps” into the AVRStudio
programming suite. “Sumovore_2.c” and
“Sumovore_2.hex” will automatically open.
Turn on the STK-500, and click the “CON”
(connect) button, which looks like a small IC chip.
In the pop-up window, you’ll want to make sure the
following settings are in place:
Under the Program tab:
Device = ATmega8
Programming Mode = ISP w/checks in both boxes to the right
Flash = (click the "..." button and load the Sumovore_2.hex file)
EEPROM = (not being used at this time)
Under the Fuses tab:
Checks should be in the following boxes:
Serial programming enable will be grayed out with a ? in the box.
Boot Flash size = 1024
Brown out detection = 2.7v
Int. RC Osc. 8Mhz 6CK + 64ms
To program the Brainboard, click on the “Program” tab. The “Flash” section has a
“Program” button - click it, and watch the green LED on the brainboard flicker as
the code loads into the microcontroller. Shut off the STK500, remove the cable,
re-enable the motors, and power up the robot!
If the robot is activated on a black surface, it will chase a huge Japanese guy
around the ring*, if it's on a white surface when powered up it follows a black
line.
*Huge Japanese Guy not included with kit. They cost too much to ship.

Brainboard Schematics
The ATMega8L Brainboard
1
2
3
4
5
6
7
8
9
10
11
12
13
14 15
16
17
18
19
20
21
22
23
24
25
26
27
28
Reset
IR Left (RxD /PD0)
IR Right (TxD / PD1)
LED1 / Pin7Exp1 (PD2)
LED2 / Pin8Exp1 (PD3)
LED3 / Pin9Exp1 (PD4)
VCC
GND
Xtal 1 (PB6)
Xtal 2 (PB7)
LED4 / Pin10Exp1 (PD5)
LED5 / Pin11Exp1 (PD6)
Spare (PD7)
Spare (PB0) Left motor Enable (PB1)
Right motor Enable(PB2)
ISP Header (MOSI / PB3)
Left motor Direction / ISP-Pin9 (MISO / PB4)
Right motor Direction / ISP-Pin7 (SCK / PB5)
AVCC
AREF
GND
Edge Left / Pin1Exp2 (PC0)
Edge Center Left / Pin2Exp2 (PC1)
Edge Center / Pin3Exp2 (PC2)
Edge Center Right / Pin4Exp2 (PC3)
Edge Right / Pin5Exp2 (I2C SDA/PC4)
I2C (SCL / PC5)
Brainboard Schematic
(drawn with approximate component placement)
ATMega8L Microcontroller
Pin Usage
+
+
Plug 2
Plug 4
Plug 1
9 10 11 12 151413 16
1
2
3
4
5
6
7
8
21
22
23
24
MOSI
MISO
SCK
RST
GND
+
+
R2-240
R3-240
+
L1 L2 L3 L4 L5
R6-1k
R7-1k
R8-1k
R9-1k
R10-100k
+
R12-47k
R13-10k
R14-10k
R15-10k
R17-10k
R1-240
Q1
+
SP12 Programmer
+
R4-10k
R5-1k
R11-47k
R16-10k
1
2
3
4
5
6
7
8
9
10
11
12
13
14 15
16
17
18
19
20
21
22
23
24
25
26
27
28
STK500
+
Plug 3
17
18
20
+
+
Raw
6v
Raw
6v
Reset
RX TX
Serial TTL
Optional
Resonator
Programming
LED
Directly
To ATMega8L Pins
4 5 6 11 12
I2C Port
+
19
20
GND
nc
SCL (Pin 28 - PC5)
SDA (Pin 27 - PC4)
Vcc
MOSI (Pin 17 - PB3)
nc
RESET (Pin 1 - PC6)
SCK (P19 - PB5)
MISO (Pin 18 -PB4)
Vcc
GND
GND
GND
GND
1
2 10
+6V (unreg.)
Gnd
nc
SCL
SDA
Vcc (+5V reg.)
LED1 (Pin 4 - PD2)
LED2 (Pin 5 - PD3)
LED3 (Pin 6 - PD4)
LED4 (Pin 11 - PD5)
LED4 (Pin 12 - PD6)
Plug4-21 / Pin 23 (Pull-up) - PC0
Plug4-20 / Pin 24 (Pull-up) - PC1
Plug4-19 / Pin 25 (Pull-up) - PC2
Plug4-18 / Pin 26 (Pull-up) - PC3
Plug4-17 / Pin 27 (Pull-up) - PC4
GND
RESET (Pin 1)
SCK
MOSI (Pin17 - PB3)
MISO (Pin18 - PB4)
P1
P2
P4
Expansion 1 Expansion 2
P3
SP-12 10 Pin
ISP
I C Port
2
Brainboard I/O
Vcc (1)
MOSI (17)
GND (6)
MISO (18)
SCK (19)
RST (1)
RST (1)
GND (6)
GND (6)
GND (6)
Vcc (1)
MOSI (17)
GND (6)
SCK (19)
MISO (18)
n/c
Old V1 Programming
Header Layout
New V2 Programming
header Layout

If you have any questions regarding this kit, please contact us!
Solarbotics Ltd.
201 - 35th Avenue N.E.
Calgary, Alberta, Canada T2E 2K5
Toll Free: 866-276-2687 / 403-232-6268 Fax: (403) 226-3741
Website: http://www.solarbotics.com
Email: [email protected]
© Copyright Solarbotics Ltd., 2006
This manual suits for next models
1
Table of contents