Professional Documents
Culture Documents
EE 598.67
Senior Design
Spring 2008
- Micromouse -
http://micromouse.fatoni44.com
Project Report
Prepared by:
Faton Avdiu ID: 2390
Andy Zhou ID: 8651
Redwan Ahmed ID: 3060
Emmanuel Hereira ID: 9930
Allen Gutierrez ID: 6270
Mohammad M. Hossain ID: 2903
Table of Contents
Table of Contents ................................................................................................................................ ii
Project Overview..................................................................................................................................1
1. Introduction....................................................................................................................................1
1.1 Purpose ........................................................................................................................................ 1
1.2 Scope ........................................................................................................................................... 2
1.3 References ................................................................................................................................... 2
2. Overall Description........................................................................................................................3
2.1 Goals and Objectives ................................................................................................................... 3
2.2 Brief History ................................................................................................................................ 4
2.3 IEEE Region 1 GOLD Conference ............................................................................................. 4
2.4 Rules and Specifications for the Competition ............................................................................. 5
3. Construction Method.....................................................................................................................8
3.1 Mechanical Layout ...................................................................................................................... 8
3.2 Hardware Detail List ................................................................................................................. 10
3.2.1 The Microprocessor - PIC18F4550....................................................................................... 11
3.2.2 Motors - Parallax Standard Servos........................................................................................ 14
3.2.3 Sensors - Sharp GP2D120 IR Proximity Sensor Modules .................................................... 16
3.2.4 Wheels and Tail Ball ............................................................................................................. 19
3.2.5 Chassis................................................................................................................................... 19
3.2.6 Batteries - Ultralife® 9V Lithium ......................................................................................... 20
3.3 Software..................................................................................................................................... 21
3.3.1 Interrupt Services – Moving the wheels................................................................................ 21
3.3.2 Smart robot – Maze solving algorithm.................................................................................. 23
3.4 Micromouse - Final Version...................................................................................................... 28
4. Work Structure / Expenses / Schedule.......................................................................................29
4.1 Work Structure .......................................................................................................................... 29
4.2 Expenses .................................................................................................................................... 30
4.3 Schedule .................................................................................................................................... 31
5. Supporting Information ..............................................................................................................32
5.1 Team Members .......................................................................................................................... 32
5.2 Team meeting and project/meeting minutes.............................................................................. 33
5.2.1 Team Meeting – Senior Design Project I .............................................................................. 33
5.2.2 Project Minutes ..................................................................................................................... 33
5.3 Competition Award ................................................................................................................... 34
– ii –
Senior Design Project – II – Page 1
Project Overview
1. Introduction
This document describes the project overview, purpose, feature set, outline and use of the final
working robot – the Micromouse.
In this section of the document we describe the purpose of the project, definitions, project scope,
and an overview of the rest of the document, including all the specifications of the project.
A detailed ANALYSIS/DESIGN report will follow into this document.
1.1 Purpose
In Senior Design Project, students have the opportunity to get exposed to various methods of
analysis, design and implementation of a project. Usually, students work on small projects or
college level projects. In senior design, we have the chance to advance to a higher level, and deal
with real-world situations during the life-cycle of the project. The main purpose of Senior Design
Project is to get students involved in developing a new product or system. Our Senior Design group
consisted of Faton Avdiu, Andy Zhou, Redwan Ahmed, Emmanuel Hereira, Allen Gutierrez, and
Mohammad Hossain.
Autonomous robots have an extensive range of applications; from detecting explosives and sensing
bio-hazards to finding humans in wreckage. When designing autonomous robots, most engineers
face difficult problems dealing with power, dependable sensing mechanism, and unfamiliar terrain.
Various robotics competitions held globally have inspired these engineers to search for innovative
solutions to their problems. One such competition with a rich history is the micromouse
competition. In the United States, micromouse competitions have been around for over 3 decades
and have changed very little.
–1–
Senior Design Project – II – Page 2
A few of the team members were invited to the IEEE Region 1 GOLD Conference at Fairleigh
Dickinson University last April of 2007. During the conference they witnessed the micromouse
competition first hand and took an immediate interest in it. Working on a micromouse project
required extensive knowledge of sensor integration, motor control, power distribution, micro-
controllers, understanding of programming, and additional controlling of electronic devices.
For our senior design project we dedicated our time and research to build this micromouse and
registered it for the competition at the GOLD Conference which was held on April 26th, 2008.
1.2 Scope
The micromouse should be capable of exploring a maze specified by the competition terms and
rules. The mouse should not be controlled by any remote control, but rather be programmed to
function on its own. The mouse needs to be implemented with sensors, motors, a microcontroller,
chassis, wheels, and additional accessories. The micromouse should be programmed to use a
specific algorithm in order to solve the maze. A more in depth look of these topics are covered in
the body of this report.
1.3 References
Prof. Xiao, Jizhong “Robotics - All class lectures” City College of New York - Fall 2007
http://www-ee.ccny.cuny.edu/www/web/jxiao/EE59866-F07.htm
–2–
Senior Design Project – II – Page 3
2. Overall Description
The micromouse project involved six student members; five electrical engineers and one computer
engineer. All members worked collectively for the duration of two semesters, Fall 2007 and Spring
2008. We planned, analyzed, designed, implemented, troubleshot and tested the maze navigation of
the robot.
This project was undertaken to test and utilize the knowledge of a design team. The micromouse
construction involved knowledge from multiple fields combined into a unified project.
All members of the team are in good academic standing, very enthusiastic, dedicated and have a
great track record for activities around City College. Many of the team members are part of the
IEEE Executive Board at CCNY. The team employed knowledge in different areas from planning,
analyzing and designing the project life-cycle to electrical, mechanical, assembling, and
programming issues of the micromouse.
The micromouse was built as a self contained autonomous robot able to navigate a specified maze
in the quickest time possible. The micromouse was entered into a competition to prove both the
ability and ingenuity of the design team.
The micromouse team did its best to ensure that the goals and objectives set by the team were
achieved in timely manner. During the first phase of the project we focused on the comprehensive
aspect of the project; the scope and purpose, as well as requirement specifications. During this time
interval our main goal was to do research, analysis and start designing the robot. The workload was
defined in the early phase of the project, where we specified and divided the load based on the
expertise of each member.
–3–
Senior Design Project – II – Page 4
The Micromouse is a small autonomous robot built to navigate a maze. The first record of “mouse
versus maze” problem can be traced back to 1950. It was first presented by Cloude Shannon, who
built the original maze-solving machine. However, the first micromouse competition began in the
1970s, where the robots were tested against one another.
The mice are built to run autonomously through a maze and find its center from a predetermined
corner of the maze. Through its algorithm and configuration, the mice must be able to retain
memory of the maze, its position within the maze, record data on maze, and optimize a route to run
in the shortest time possible.
Region 1 GOLD (Graduates of the Last Decade) has successfully developed and organized an
extensive list of programs, activities, seminars, and conferences in the past few years. With the
vision to increase the value of IEEE services and programs to young professionals and recent
graduates, the GOLD leaders have been energetically organizing numerous activities for their
GOLD members. Their mission is to develop programs and foster relationships, to provide tangible
value to members, to promote the GOLD program to students, and to recruit, develop, and nurture
volunteers.
For the last few years, Region 1 GOLD was held in collaboration with the Region 1 Student
Conference, usually during spring. This joint event provides a great opportunity to introduce GOLD
to undergraduate students, and to encourage them to continue their membership as GOLD members
after they graduate. They were also encouraged to take up leading roles within the IEEE
organization. One such way to promote interest in GOLD is through the various competitions,
career fairs, motivational speakers, and resume clinics. Some of the contests include paper design,
future engineers, and the micromouse competition.
–4–
Senior Design Project – II – Page 5
The micromouse competition is the most prevalent and exciting event during the weekend long
conference. The competition has monetary rewards for the top three successful teams.
• 1st Place: $1500.00
• 2nd Place: $1000.00
• 3rd Place: $700.00
¾ Specifications
The micromouse must be self contained and not use an energy source employing a
combustion process. The length and width is restricted to a square region of 25 cm x 25 cm
even if the dimensions change its geometry during a run shall not exceed 25 cm x 25 cm.
The height is unrestricted. The Micromouse should not jump over, climb, scratch, damage,
or destroy the walls.
¾ Maze
The maze comprised of 16 x 16 multiples of an 18cm x 18cm unit square. The walls were 5
cm high and 1.2 cm thick. Passageways between the walls were 16.8 cm wide. An exterior
wall enclosed the entire maze. The sides of the maze were painted white and the top of the
walls red. The floor of the maze was made of wood and finished with non-gloss black paint.
The coating on the top and sides of the walls were selected to reflect infrared light and the
coating on the floor to absorb it.
–5–
Senior Design Project – II – Page 6
–6–
Senior Design Project – II – Page 7
¾ Time
Each participant in the competition was given a time limit of 15 minutes to have their robot
run through the maze. Within this time limit, a micromouse can make as many runs as
possible.
¾ Accuracy
The micromouse was able to detect and avoid collisions with walls. The robot needed to
make 90 degree turns and be able to correct itself with proper alignment. The micromouse is
evaluated based on the time taken to go from the starting square until it reaches the finish
square (the center of the maze). Once the center is reached initially, the mouse needs to
continue to explore the maze until it finds the shortest path. The total time is measured from
the time the robot is first activated. The team whose mouse compiles the lowest
–7–
Senior Design Project – II – Page 8
3. Construction Method
The dimensions of each unit square in the maze are 18cm by 18cm. During the initial design phase
for the robot, we decided to keep the size of the robot to a minimum to obtain better mobility and to
avoid collision with the walls. From previous experience we saw that larger robots tend be impeded
by making contact with the walls.
–8–
Senior Design Project – II – Page 9
[1] A light plastic ball placed in the back is attached by a pin through its core for stability. The
purpose of the ball is to aid in rotation of the robot and to maintain equilibrium. The location of the
ball did not hinder the sensors from retrieving data.
[2, 3, 4] The wheels and motors were positioned on the micromouse so that it creates a center of
mass between the ball and the wheels. The center of mass will effectively prevent the micromouse
from flipping when brakes are applied.
[5] The front sensor is situated closer toward the center to provide leeway to detect the walls. The
extra space is a buffer that makes the sensor accurate, the mouse can stop early if placed too close
to the front.
[6, 7] The sensor [6] faces the left side and is positioned to take readings of walls or openings.
Sensor [7] behaves similarly except it faces the right side. The sensors are not effective under 4 cm,
shifting the sensors to the middle and connecting the sensors back to back with a crossbar allows
the sensors to capture data precisely. Both sensors are actually positioned above sensor [5] and do
not impede the readings.
All the parts were configured together to obtain a mouse that was well balanced, light, and stable.
We have to mention that our mouse was the smallest and the fastest compared to other contestants
in the competition.
–9–
Senior Design Project – II – Page 10
¾ Microcontroller: PIC18F4550
– 10 –
Senior Design Project – II – Page 11
The PIC18 microprocessor was selected as the intelligence for the Micromouse to create a smart
robot that can find the way through the maze. The PIC was able to control all functions of the
mouse, including starting and braking of the mouse, rotating the wheels in a way so the mouse will
turn right or left, reading the sensors and navigate through the map of the maze.
The PIC processor provided the logic to drive the micromouse and solve the maze. The controlling
software worked using this approach:
3. The mapped array was used to solve the micromouse maze through our algorithm.
4. The appropriate move was then decided depending on the steps needed to reach the center.
5. Steering and drive are controlled to make the move to the next sector.
6. While traveling the sensor also kept the robot centered along the path.
– 11 –
Senior Design Project – II – Page 12
The micromouse maze has a maximum of 256 squares, setting the parameters were convenient in
programming. Assembler ('machine') code gives good control of short timing loops and generates
fast-running code. Out team used C++ to write the code, and we used the MPLAB compiler to
compile the code into assembly and generated the HEX file. Even though the compilers are quite
smart, we needed to intervene into the assembly code for better and faster results while reading
from sensor and motor control.
The following table shows the resources included inside the Pic18 microprocessor:
– 12 –
Senior Design Project – II – Page 13
The next diagram shows the block diagram for the PIC microprocessor.
– 13 –
Senior Design Project – II – Page 14
As one can notice the above diagrams and tables, the PIC microprocessor is very powerful, and
therefore fulfilled the requirements for our project. Competing during the competition showed the
prowess and ability of the processor.
Technical Specifications
Power: 6vdc max
Speed: 0 deg to 180 deg in 1.5 seconds on average
Weight: 45.0 grams / 1.59oz
Torque: 3.40 kg-cm / 47oz-in
Size mm: (L x W x H) 40.5 x 20.0 x 38.0
The servo contains a small DC motor, a gear box and control circuitry. As shown in diagram 3, they
have a three-wire ports, one ground wire (0 Volt, black), one (5 Volt, red), and one signal (white)
wire. The motors feed on 5 volts at about 100mA maximum, and about 10-20mA when idle.
The servos were controlled by pulses of about 1 to 2 milliseconds at a repetition rate of about 50 per
second. The servo contains a feedback potentiometer used by internal circuits to measure the
position of the output shaft. The servo provides a continuous rotation, meaning it is able to spin 360
– 14 –
Senior Design Project – II – Page 16
degrees. If no signal is input to the motor then the servo will stop. Using two servos running in
opposite directions enables the micromouse to perform stop and pivot turns. The speed is not
greatly affected by the pulse repetition rate, as long as it is above about 30 repetitions per second.
Technical Specifications
Power: 5.5 vdc max
Distance Measuring Range: 4cm (1.6") to 30cm (12")
Average Dissipation Current: 33 mA (50mA max)
Size mm: (L x W x H) 44.0 x 13.0 x 13.5
– 16 –
Senior Design Project – II – Page 17
– 17 –
Senior Design Project – II – Page 18
The sensors we implemented were able to take a continuous distance reading and return a
corresponding analog voltage.
The front sensor’s main objective was to detect forward walls to prevent collision and also make
wall positions in the maze. If a front wall is detected then the robot will stop and compute what
direction turn is more efficient to reach the center. The side sensor are use two-fold, first to detect
the presence or absence of side walls and second to assist in relaying the distance of the robot from
each side wall. The later part is used to compute adjustments needed to keep the micromouse
equidistant from each side wall. We focused on achieving a reliable steering, and direction control.
The sensors operated quickly enough to measure position to reasonable tolerance.
Although the sensors are minimally affected by reflectivity and surrounding lights, they were
calibrated to function in a predictable manner for varying maze and ambient conditions. During
competition cameras had flash turned off and did not affect the sensors.
– 18 –
Senior Design Project – II – Page 19
The micromouse comprised of two wheels with rubber band treads with enough traction to avoid
slipping. The plastic wheels with a ball were placed in a triangular setup for balance, two wheels in
the middle of the mouse and the ball toward the back end. The setup adjusted the center of mass to
prevent flipping. The size of the wheels were balanced enough to stabilize the micromouse without
being too large or small.
3.2.5 Chassis
The micromouse chassis is the main piece that holds together all the other parts. The chassis was
hand cut from a light plastic toy truck due to the ease in shaping the plastic. There was enough
space for the microprocessor, batteries, motors and sensors. Servos were placed in the mid-section
of the mouse, sensors were located in themed-front region, batteries were placed in a basket in the
back section, and the microprocessor was placed in a protective cover above the whole setup. While
inside the maze the mouse was small enough to fit and not come in contact with the walls. All space
on the micro mouse was used efficiently as possible. In one occurrence the middle sensor was
placed too low that detected deviations in the floor to be walls, to solve the problem the sensor was
mover higher and more forward.
– 19 –
Senior Design Project – II – Page 20
Technical Specifications
Volt Range: 5.4 to 9.9 V
Average Voltage: 9.0 V
Nominal Capacity: 1.2 Ah @ 9 mA to 5.4 V @ 23° C
Max. Discharge: 120 mA continuous
Pulse Capacity: Up to 400 mA
Weight: 36.4 Grams
The power pack of the micromouse consisted originally of a single 9V battery. We made a mistake
of not accounting for the current drain and caused irregularity during the testing. While the micro
mouse made runs through our sample maze it would slowdown and being to malfunction. The
solution to the problem was to connect three 9volt batteries in parallel therefore increasing the
current passing through the system.
– 20 –
Senior Design Project – II – Page 21
3.3 Software
One of the most important and challenging part of the project was programming the robot, so it can
think and solve the maze efficiently. As we previously mentioned the micromouse has to discover
the maze and find the center. Also, the micromouse is programmed to read the sensors often enough
so it has time to process instructions and make a decision which way to go.
During all these processes the microcontroller is programmed to send signals to servo motors so the
wheels move. This part of the project was really challenging as it requires to fully understand the
PIC18 microcontroller and the use of INTERRUPT services. An INTERRUPT causes the processor
to save its state of execution and begin execution of an interrupt handler.
We use IRS to send pulses to the motors every 20 milliseconds, and based on a width of a pulse, the
wheel will spin in certain direction or it will stay still. We control the timing of signals by using
timers on PIC microcontroller. We use TMR0 (Timer 0) to send a pulse every 20 milliseconds and
TMR3 (Timer 3) to control the width of the pulse, based on the information during the processing
of the code.
– 21 –
Senior Design Project – II – Page 22
The following is part of the code where we use the interrupts and timers to control the wheels:
if (INTCONbits.TMR0IF) {
INTCONbits.TMR0IF = 0;
travelcount++;
count++;
for_count++;
if (for_count > 2) { s1_count++; for_count =0; }
TMR0H = 0x8D;
TMR0L = 0x28;
TMR3H = 0xDA;
TMR3L = 0xCF;
servo_state=SERVOHOLD;
servo_timer=1;
LATAbits.LATA1 = 1;
LATAbits.LATA2 = 1;
encoder = PORTDbits.RD1;
if (lastencoder != encoder) {
encodercount++;
lastencoder = encoder;
LATDbits.LATD6 = !LATDbits.LATD6;
}
}
else if (PIR2bits.TMR3IF) {
PIR2bits.TMR3IF = 0;
if (servo_state==SERVOHOLD) {
TMR3H = 0xFF;
TMR3L = 0xFA;
servo_timer++;
if (servo_timer > servo[0] && LATAbits.LATA1 == 1) {
LATAbits.LATA1 = 0;
}
if (servo_timer > servo[1] && LATAbits.LATA2 == 1) {
LATAbits.LATA2 = 0;
}
if (LATAbits.LATA1 == 0 && LATAbits.LATA2 == 0) {
servo_state=SERVOSTOP;
}
} else if (servo_state==SERVOSTOP) {
TMR3H = 0x00;
TMR3L = 0x00;
}
}
}
– 22 –
Senior Design Project – II – Page 23
This was the most difficult part of the project, where we had to program the micromouse so it can
think and be able to find its way to solve the maze. The mouse has to know its location and
direction at any time so it runs the algorithm and make a decision on the next move.
We did this by programming in C and using a floodfill algorithm, which floods the maze after every
move and helps the robot make a decision. In order to solve the maze efficiently, we need to store
information of the walls and also use distance values for each cell of the maze, to find the shortest
path. We use two 1-dimensional arrays to map the maze and the distance values. Initially, the
mouse will only know the boundaries of the maze and the center cells. As the mouse explores the
maze it finds new walls and updates the distance values. We will explain in details each step of the
micromouse as it reaches the center of the maze.
The complete code of the project is attached in a different file.
The following describe the steps the robot takes to make a decision:
The robot repeats these steps whenever reaches the center of the next cell on the maze.
– 23 –
Senior Design Project – II – Page 24
As it is not very clear to understand these steps, we created a step-by-step graphical explanation and
described every move of the mouse until it reaches the center. We are using a 5x5 maze, to explain
these steps, since it is easier to explain and understand the process.
1 – The mouse starting point is at the corner of the maze. First, it reads the sensors, detects the
wall on the right side (marked as RED), runs the flood algorithm, updates the distance values
starting from the goal (at zero) and add 1 to each neighbor. At this point no distance changes
since the discovered wall doesn’t change the maze much. The mouse makes the decision to
move to the next possible cell, and in this case there is only one possible cell, and that is to
move one cell forward.
2 – At this point the micromouse discovers another wall to the right, and repeats the same
procedure as in the first step. It moves to the other possible cell.
3 – At this point the mouse discovers another wall to the right, and it runs the algorithm.
(Continue to step 4)
4 – The algorithm uses the information on the wall-array and assigns the distance values to each
cell. In this case the current cell will change it distance value from 2 to 4, because now the
mouse knows that it needs 4 steps to reach the current cell instead of 2 because there is a wall.
Also, each neighbor cell changes the distance value. (See the yellow cells) The mouse will
move to the next cell available.
– 24 –
Senior Design Project – II – Page 25
5 – Another wall is discovered. The mouse repeats the same procedure, but now the direction of
the mouse will change.
7, 8, 9 – At this point another wall is detected to the left of the mouse. The wall map is updated
and the algorithm will update the distance values described on step 8. Finally the mouse will
move one cell forward(step 9).
( 10 ) ( 11 ) ( 12 )
10, 11, 12 – At this point the robot has two choices. It can go forward (down one cell) or to the
left of the mouse (right from this view). In order to make this decision, the mouse will compare
the distance values and move to the one with the lowest value (Step 11). Then, another wall is
detected and the algorithm will change the distance values as shown in step 12.
– 25 –
Senior Design Project – II – Page 26
( 13 ) ( 14 ) ( 15 )
13, 14, 15 – At this point the robot has two choices, again. The mouse will compare the distance
values and move to the one with the lowest value (Step 14), and it will repeat the same step
again. At this point, the mouse reached the cell with the distance value zero, and that indicates
that it reached the GOAL (in this case the center of the maze).
( 16 ) ( 17 ) ( 18 )
16 – The mouse is programmed to explore the maze until it finds all the walls and the distance
values will be updated as shown above.
17 – At this point the mouse will change the GOAL. The starting point will become the new
GOAL, hence the distance value zero (the yellow cell). Next, the algorithm will run, and change
all the distance values as they are shown above.
18 – At this point the mouse will have three options, but as we described before, it will choose
the one with the lowest value.
– 26 –
Senior Design Project – II – Page 27
( 19 ) ( 20 ) ( 21 )
( 22 )
19, 20, 21, 22 – Same procedure is used to reach the new goal.
– 27 –
Senior Design Project – II – Page 28
Figure 8: Top-View
– 28 –
Senior Design Project – II – Page 29
MICROMOUSE
PROJECT
Structure Wheels
ICD2
– 29 –
Senior Design Project – II – Page 30
4.2 Expenses
– 30 –
Senior Design Project – II – Page 31
4.3 Schedule
Parts
Purchase
Assembly
Testing
Software
– 31 –
Senior Design Project – II – Page 32
5. Supporting Information
Name Major
Andy Zhou - EE
Redwan Ahmed - EE
Emmanuel Hereira - EE
Mohammad M. Hossain - EE
Allen Gutierrez - EE
– 32 –
Senior Design Project – II – Page 33
The following shows only one of the team meeting and project minutes during the first phase of our
project:
11/02/2007
5.2.1 Team Meeting – Senior Design Project I 12:30PM
Engineering Building - IEEE Office
Please read: Project Requirements, Specification and Design, Also lectures from Prof. Xiao
Please bring: All work so far, including research, new ideas etc.
Split the team work among team members, having a complete understanding of what we want to
Conclusions:
do and what the goals & objectives are.
– 33 –
Senior Design Project – II – Page 34
– 34 –