You are on page 1of 5

Project Features:

• ATMega16 Microcontroller
The ATMega16 monitors all robot sensors and
controls motor drive functions.
In system programming is available. Project Number A3743
Microcode was developed using the MCS Bascom
AVR compiler.
Autonomous Robot
With obstacle avoidance, drive wheel
• Obstacle avoidance synchronization and line tracking
The robot maneuvers around obstacles while capability
seeking for a black line to track.
Obstacles cause direction reversal when the robot is Abstract
in line tracking mode.
The obstacle sensor is a Sharp GP2D15 sensor
connected to INT0 of the ATMega16.

• Line tracking
The robot is designed to search for a black line on
the terrain.
Once the line is found, the robot tracks the line
from end to end and reverses direction when it
encounters an obstacle in the path of the line.
Three infrared sensors mounted under the robot
and connected to port D of the Mega16 do line
sensing.

• Differential Drive
Two DC motors provide mechanical propulsion
through friction drive of the drive wheels. Figure 1 - AUTONOMOUS ROBOT
The motors are electrically driven by two Allegro
3953 full bridge motor drivers connected to port A
of the ATMega16.

• Drive Wheel Synchronization


Infrared wheel encoders and a microcode routine
provide wheel synchronization. This allows for
straight-line travel without guidance.

• Rechargeable Battery Pack


Power is provided by a rechargeable 9.6 Volt NiCad
battery pack.
There is a 5 Volt on-board regulator for logic power.
2004 AVR DESIGN CONTEST
PROJECT NUMBER A3743 / AUTONOMOUS RO BOT
BRIEF DESCRIPTION

This project is an autonomous robot that is capable of obstacle avoidance, drive wheel
synchronization and line tracking. The robot initializes in seek mode, where it avoids obstacles and
searches for a black line to track. Wheel synchronization, during seek mode, allows the robot to
travel in a straight line without guidance. Once a black line is found, the robot tracks the line and
reverses direction when an obstacle is encountered on the line.
The electronic control assembly consists of an Atmel ATMega16 MCU operating at 8Mhz with
an internal clock. Two Allegro 3953 full-bridge motor drivers are used for motor control. Microcode
for the project was written using the MCS Basic-AVR compiler. Microcode can be updated using the
on-board ISP connector.
The Mechanical assembly uses a differential drive system made from two small DC motors, a
friction drive system and two 78mm wheels. There are six on-board sensors that allow the robot to
avoid obstacles, synchronize wheel rotation and track lines. Power is provided by a rechargeable
9.6V NiCad battery pack.

Figure 2 – Side View of Robot


2004 AVR DESIGN CONTEST
PROJECT NUMBER A3743 / AUTONOMOUS ROBOT
BLOCK DIAGRAM

PORT D

INT0

PORT A
2004 AVR DESIGN CONTEST
PROJECT NUMBER A3743 / AUTONOMOUS ROBOT
CODE SAMPLE

Microcode for this project was written with the MCS Basic-AVR compiler. This code sample shows the
“Seek_line” routine and drive wheel synchronization method. The robot initializes into the Seek_line
routine, where it roams about looking for a black line to track. The robot must synchronize the two
differential drive wheel rotations, in order to travel in a straight line, when in seek mode. Calling the
“Poll_wheels” routine, where the encoder counters are updated at each wheel encoder pulse and
then comparing the left and right wheel counters does this. The wheel drive is altered if there is a
difference of 2 or more between “Leftc” and “Rightc”.
'* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Seek_line: 'Roam around, avoid obstacles, seek the black line
Leftc = 0 'Initialize wheel counters
Rightc = 0
Motor = Forth 'Go forward
Seek_line1:
Op_mode = "seek"
Gosub Poll_wheels
If Csense = 1 Then 'Center line sensor found black line
Motor = Brake 'Stop
Waitms 300 'pause
Goto Track 'Goto track mode
End If
Motor = Forth 'Give both motors a forward pulse
Gp2 = Rightc + 2 'General Purpose reg = right counter + 2
If Leftc > Gp2 Then 'Is the left wheel 2 pulses ahead of the right wheel?
Motor = Turnl 'Adjust
End If
Gp2 = Leftc + 2 'General Purpose reg = left counter + 2
If Rightc > Gp2 Then 'Is the right wheel 2 pulses ahead of the left wheel?
Motor = Turnr 'Adjust
End If
If Leftc > 130 Then 'Clear the wheel counters after 10 wheel revolutions
Rightc = 0
Leftc = 0
End If
Goto Seek_line1
'* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
'Returns (Leftc) the left wheel encoder count and (Rightc) the Right wheel encoder count.
Poll_wheels: 'Polls the wheel encoder sensors and counts pulses.
If Lwheel = 0 Then 'If left wheel encoder is uncovered
If Left_flag = 1 Then 'Do this once each encoder sensor transition
Incr Leftc 'Increment the wheel counter
Reset Left_flag
End If
End If
If Lwheel = 1 Then Set Left_flag 'Set the flag when the sensor is covered
If Rwheel = 0 Then 'If right wheel encoder is uncovered
If Right_flag = 1 Then 'Do this once each encoder sensor transition
Incr Rightc 'Increment the wheel counter
Reset Right_flag
End If
End If
If Rwheel = 1 Then Set Right_flag 'Set the flag when the sensor is covered
Return

You might also like