Professional Documents
Culture Documents
Atmel’s AT90S8515 microcontroller has an external Software isn’t required to perform edge detection,
memory interface bus that allows you to easily connect enhancement, or extraction from the image. To get an
an SRAM IC. The on-chip hardware UART makes it edge-extracted image, simply put the sensor in the
possible to output processed data without consuming appropriate mode and then read out the resulting ana-
precious processing resources, and the timers enable log pixel voltages for the entire image. After this image
it to control hobby servo motors without much work. In is read out, it can be further manipulated by the micro-
addition, the AVR series of microcontrollers has a high- controller. Photo 3 shows the M64282FP chip inside
speed RISC architecture (e.g., most instructions take the camera.
one or two clock cycles) that makes timing calcula-
I didn’t use the camera’s cartridge base in these
tions simple. In short, the flexibility of the AVR 8-bit
experiments. After the cartridge is opened, the ball can
microcontrollers makes attaching special-purpose
be disconnected from the cartridge. I disconnected the
peripherals like the Game Boy Camera a breeze.
purple cable from the cartridge and soldered a stan-
Figure 1 is a block diagram of a camera interface and dard 0.1” double-wide header on the end. This
object-tracking system. As you can see, the camera is allowed a 0.050” ribbon cable to be used for a long-
controlled via some of the microcontroller’s general- distance connection, although I don’t recommend
purpose I/O pins. The analog output of the camera is exceeding 1 foot or so.
attached to the external A/D converter. The servos are
By the way, I cut a hole in the back of the ball so that
connected to two more pins of the microcontroller, and
the cable could exit in a place where it doesn’t inter-
the RS-232 converter conditions the UART’s signals
fere with mounting the camera on a pan-tilt base. You
for connection to the outside world.
may download the pinout of the original connector
Figure 2 details the interface circuit. A few notes might that’s coming out of the ball from the Circuit Cellar ftp
be helpful here. The A/D converter needs to be fast site. The numbers refer to the corresponding pin num-
enough to read out a pixel value every 2 µs if the max- bers on the M64282FP chip.
imum frame rate is desired. This means the sample
To simplify the interfacing of the assembly code and
frequency of the ADC must be at least 500 kHz. A
speed things up, I turned the camera sensor board in
www.atmel.com page 39
Register Address Normal mode Edge mode
0 000 0x80 0x3F
1 001 0xD6 0xD6
2 010 0x06 0x18
3 011 0x00 0x00
4 100 0x01 0x01
5 101 0x00 0x00
6 110 0x01 0x01
7 111 0x07 0xF3
www.atmel.com page 40
To perform object tracking, the
microcontroller searches the
image in RAM from the bottom up.
When it finds the first edge
brighter than a given threshold
value, it marks the x and y loca-
tions and measures the horizontal
and vertical distance of this edge
from the center of the image.
Then, the microcontroller issues a
corrective movement command to
the servos, which respond by
redirecting the camera until the
object is centered in the view.
Listing 2 shows how it’s done.
Photo 1: The prototype circuit board is small enough Photo 2: I’ve provided you with four views of the mobile robot. The servo that controls the tilt angle of the cam-
to fit inside a mobile hobby robot. era is for future expansion.
www.atmel.com page 41
els. In addition, the RAM isn’t used, because the only
information the robotrequires is the nearest object loca-
tion. To determine the location of the nearest object, the
pixels om the camera are read and processed on the fly.
Photo 6a: Four AA NiCd or NiMH batteries power the circuit board used for the pan-tilt head. b—These servos have a quick transit time. It takes only 0.09 s to rotate the
control surface through 60°! This fast response time keeps the servos from being the limiting factor in the system’s reaction time.
www.atmel.com page 42
to Photo 5 for screen shots of the user interface.
Although I completed all of the development for this
project in Linux, it should be fairly easy to port to a
Windows environment.
Enlargements
One way to enhance the output of the tracking system
would be to mount a low-power laser pointer on the
pan-tilt head. Then, as long as the field of view is kept
away from humans and highly reflective surfaces (in
addition to other appropriate safety precautions), the
robot could alternate between strobing the laser point-
er and tracking an object. This would let you see a pul-
sating red dot, signaling where the robot is actually
focusing its attention.
www.atmel.com page 43