Transcript
  • 7/15/2019 Como Hacer Un Micromouse

    1/21

    1

    AbstractThe IEEE micromouse competition has been apopular event among engineering students and engineers. A

    micromouse is an autonomous vehicle whose objective is tofind the center of a 16 by 16 cell maze within 10 minutes.After exploring the maze for some time, the micromouse willattempt to make its fastest run from the starting point to thedestination cells. This report summarizes the design and

    implementation of the MightyMouse project for the spring andfall semesters of 2005. The design method of theMightyMouse project consisted of two stages. The first stage

    was to design and construct individual components. Thesecond stage of the design process was to interface thecomponents to form the final prototype. The individualcomponents of micromouse system consist of the motorcontrol system, navigation sensor array, digital compass fordetecting orientation, and a mapping system for navigating the

    maze intelligently. A test plan was developed in order tovalidate the overall performance of the micromouse. A lifeproduct life cycle and reliability reports have also been writtenin hopes to encourage and aid future micromouse teams.

    Index Termsmicromouse, autonomous, maze, IEEE

    competition

    I. INTRODUCTION

    HE micromouse is an autonomous vehicle whose goal is

    to find the center of a maze. The official IEEE

    Micromouse Competitions began in 1987 at the World

    Micromouse Competition, where David Otten of MIT

    captured first and second place with his MITEE Mouse. This

    competition used a new scoring system design to reward

    intelligence, efficiency, and self reliance. Micromouse

    competitions have become a popular event among engineering

    students and engineers.

    II. PROJECT DESCRIPTION

    A. Problem StatementDesign and construction of a micromouse requires a broad

    range of engineering skills. This combined with an open

    design process makes the micromouse project a very practical

    Manuscript received December 12, 2005. This senior design project was

    sponsored by Dr. Herb Hess of the Electrical Engineering Department,

    University of Idaho.

    and challenging senior design project.

    1) Objectives: The primary objective of this project is to

    build an autonomous vehicle, a micromouse, according to

    IEEE specifications which is able to navigate to the center of a

    maze. A secondary objective is to design a full size maze also

    in accordance to IEEE specifications.

    2) Constraints: Constraints for the micromouse come fromregulatory competition rules. The mouse size, time allowedto solve the maze, methods for solving the maze, and amonetary limit placed on the final prototype are all constraints

    imposed by IEEE competition rules.a) Size: The mouse is can be no larger than 25cm

    square.b) Time Limit to solve maze: During a IEEE

    competition the micromouse has 10 minutes to solve

    the maze and complete the run.c) Battery life: The batteries must supply power to the

    micromouse for at least 10 minutes.d) Micromouse expenses: The total cost for Micromouse

    must not exceed $500.e) Maze: The maze consists of 16 x 16 cells; each cell is

    18 cm square. The southwest corner is the startingcell. The four center cells are the destination.

    B. Solution Method1) Brief Description: There are two fundamental phases to

    our design process. The first phase was to design individual

    components of the micromouse and get them to operate

    according to individual specifications independent of one

    another. The second phase was to interface the individual

    components and have the micromouse operate as one

    autonomous unit. The first semester of the Senior Design

    course was dedicated to working on the individual

    components. The goal of the second semester was to integrate

    the individual components. The individual working

    components include the navigation sensor array, mappingalgorithm, distance and bearing devices, motor control, and

    chassis design

    An effective micromouse design must perform the

    following functions in order to find the center of a maze

    a) Recognize walls and openingsb) Stay centered within each cellc) Know position and bearing within the mazed) Control the distance needed to travele) Make precise 45 and 90 turns

    MightyMouse: An Autonomous Maze SolvingRobot

    Kelly Ridge, Sanjeev Giri, Peter Shaw, Jason Flynn

    T

  • 7/15/2019 Como Hacer Un Micromouse

    2/21

    2

    f) Perform mechanicallyg) Navigate the maze intelligently

    2) Overview of Micromouse functions: The mouse mustrecognize walls and openings in order to navigate the mazeand prevent crashes. The navigation sensor array provides the

    mouse with this information. The navigation sensor arrayconsists of a combination of four short-range and two long-

    range infrared sensors.The mouse must stay centered within the maze to prevent

    compounding errors in distance and position calculations. Adigital compass determines if the deviates from its desiredbearing. This information is sent to the motor control systemto make proper corrections, either speeding up or slowingdown one wheel.

    The motor control portion of the project is responsible forsafely moving the micromouse through the maze. There aretwo maximum speeds, one for the mapping portion of thecompetition and one for the racing portion of the competition.

    The motor control code is given a distance to travel as input.It is then the responsibility of the motor control to accelerate

    and decelerate the mouse during travel. The rate ofacceleration is fixed based upon the traction of the wheels onthe maze surface.

    In order to ensure that the mouse is not slipping, the motorsare controlled with PI feedback. The shaft encoders (built intothe motors) read in the speed of the wheels and send this datato the motor control code that adjusts the speed of each wheel

    accordingly.The mouse must keep track of position and bearing during

    each run to provide navigation information to the mappingsystem. The shaft encoders that are built in to the motorsmonitor the distance the micromouse travels. The electronic

    compass determines which direction the micromouse is facing.

    The combination of these two systems provides the dataneeded by the mapping and navigation systems.To move efficiently through the maze the micromouse must

    be able to make precise 90 turns. The digital compass ispolled during turns to provide control feedback to the motorsand navigation systems.

    The mechanical soundness of the micromouse design is animportant factor. The chassis needs to keep the systems stable

    during operation so accurate data is recorded. The chassisalso keeps the drive train in line in order to reduce the numberof path corrections made.

    To successfully and efficiently solve the maze the mouse

    must make intelligent navigation decisions based on its

    current position. The mapping system utilizes a modifiedflood-fill algorithm to determine the best solution as the mazeis discovered.

    C. Component Descriptions1) Sharp GP2D Sensor Array: The short-range sensor array

    consisting of two Sharp GP2D120 infrared sensors is

    interfaced to the microcontroller and can determine whenthere is an opening to the left or the right of the mouse.

    These sensors are positioned so that the angle of incidencewith a sidewall is 90 degrees. The side sensors crossfire

    across the body of the mouse thus keeping the sensors outside

    the minimum firing range of 4cm. The side sensors aremounted directly to main circuit board of the mouse.

    The long-range sensor array, consisting of two SharpGP2D12 infrared sensors, determines walls in front of or

    behind the mouse and outputs their approximate distances.The long-range sensors cross-fired across the length of themicromouse preventing the sensors from exceeding the

    minimum sensing range of 10cm.

    Fig.1 Navigation Sensor Array

    2) Devantech Digital Compass: The Devantech electroniccompass is interfaced to the microcontroller via an I2Cinterface. It returns values between 0 and 255 indicating itsrotational orientation. A one-time calibration is performed

    that improves accuracy when the compass is moved to newlatitude.

    The compass experiences strong electromagneticinterference when it is in close proximity to the DC motors.

    The minimum distance required to yield accurate readings isapproximately three inches. The compass is also most

    accurate when it is positioned horizontal to the ground. Theseconstraints forced the compass to be mounted on a pole wellabove the rest of the micromouse.

    3) Mapping System: The mapping system solves a full

    16x16 maze using input from the sensor array, shaft encoders,

    and digital compass. The modified flood filled algorithm used

    to solve the maze is explained in detail in the method of

    solution section for the Mapping System.

    4) Motor Drive System: The motor drive system consists oftwo DC motors with built in shaft encoders that are poweredby two monolithic H-bridge ICs. The ICs contains all of the

    free-wheel diodes and power transistors necessary for drivingthe motors. Also, the input to the ICs is CMOS and TTL

    compatible. These properties allow us to minimize the size ofthe circuitry necessary to power the mouse.

    The Zilog project for controlling the H-bridge also

    incorporates the shaft encoders, I2C compass, and the serialHyperTerminal output. This integration was done to helpensure that the code for controlling the motors will notinterfere with these other functions.

    The built in shaft encoders are 16 count and output a square

    wave. These magnetic encoders rely on hall-effect sensorsand are used for indication and control of both, shaft velocity

  • 7/15/2019 Como Hacer Un Micromouse

    3/21

    3

    and direction of rotation as well as for positioning. The

    encoders provide the feedback for the motor drive system.

    6) Chassis: The final prototype chassis was made out ofcarbon fiber. This allowed the chassis to be strong and rigidbut also lightweight. The chassis has a skid-plate design withmotor mounts incorporated into the carbon fiber.

    7) Maze: The final maze design involved creating a mazethat was transportable as well as one that would last, thus

    providing a solid testing and competition platform for futuremicromouse projects. The maze base consists of 4-5x5 ft

    interlocking pieces of inch ACX plywood. The walls werecut into 18cm long by 3cm high strips from 12mm thickplywood. The walls come in four different configurations:perimeter, double-post, single-post, and no-post. The wallsides were painted white and the tops red. The base was

    painted flat black. Paint colors are specified by IEEEmicromouse competition rules.

    D. Method of Solution

    Fig.2 MightyMouse

    1) Sharp GP2D Sensor Array: The Sharp GP2D InfraredSensors consist of an LED emitter and receiver and can be

    used to determine the distance to an object based on the angleof reflected light. The sensors are insensitive to ambient lightand are reliable in detecting the reflected LED beam on anumber of different surfaces varying in both color and sheen.The sensors have an analog voltage output that corresponds to

    the measured distance. These analog outputs are sampled bythe onboard Analog to Digital Converters of the Zilogmicrocontroller, providing a digital value that can be used forrange calculations. Drawbacks of the GP2D sensors are that

    the relationship between the actual ranges and the A/Dconverted values is nonlinear and there are also slightdifferences in the outputs between sensors.

    The Sharp GP2D120 short-range sensors had to benormalized in order to ensure accurate and repeatable readings

    from all four sensors. To normalize the short-range sensors,20 readings were taken at each centimeter within themanufacturer specified range (4-30 cm) and then the readingsfrom each sensor at each range were averaged. A plot of these

    A/D readings vs. the range produces a nonlinear curve (dataand graph available in Appendix C). This means that a largechange in the A/D value did not necessarily correspond to a

    large change in range. For the micromouse to make decisions

    based on sensor input there must be a direct correlationbetween the A/D value and the actual range. To find thiscorrelation a linear regression was performed on the averagedshort-range sensor data producing an equation relating the

    A/D value to actual range.The function of the short-range sensors is to determine side

    openings. The short-range sensors are continuously sampled

    by the A/D converter to determine side openings. Taking intoaccount that the side sensors crossfire across the body of the

    mouse: to still be able to determine an opening, the mousewould have to read a range value greater than approximately18 cm (corresponding to an A/D value of 323).

    The function of the long-range sensors is to determine the

    mouses proximity to front and rear walls. This information isuseful in mapping the maze as well as providing the motorcontrol algorithm with information on deceleration to avoidfront and rear crashes.

    Regression data from the manufacturers website was used

    for the purposes of testing the Sharp GP2D12 long-rangesensors. Data was taken to find linearization equations for

    each long-range sensor in order to increase the absoluteaccuracy of their readings.

    The navigation sensors act as the eyes of the mouse. Theyprovide the mouse with topographical information of themaze. The mapping algorithm relies on the sensors todetermine openings and walls in order to map the maze andmake decisions on the best path to the center. The long-range

    sensors also provide the motor control algorithm withinformation on front and rear walls in order to avoid crashes.

    2) Devantech Digital Compass: The electronic compasshelps the micromouse keep its bearings while navigating the

    maze. Our micromouse design will use the compass moduleto make accurate 45 and 90 degree turns as well as to ensure

    that the micromouse travels in a straight lineThe compass uses two Philips KMZ51 magnetic fieldsensors to detect the earths magnetic field. The sensors are

    sampled by a PIC microcontroller and supporting circuitrywhich compute the compass direction and provides aninterface to the host Zilog system. The compass modulerequires a 5V supply at a nominal 15mA and provides data via

    two output methods, I2C and a PWM signal.

    Fig.3 Devantech Digital Compass Pin Out

  • 7/15/2019 Como Hacer Un Micromouse

    4/21

    4

    Pin 9 must be connected to the ground bus of the host

    microcontroller

    Pin 1 must be connected to a 5V supply

    Pin 7is an input to select either a 50Hz (low) or a 60Hz(high) operating environment. This is used to reduce outputjitter caused by the mains power supply frequency. The

    compass module has an onboard pull-up resistor and pin 7 canbe left floating for a 60Hz (U.S.) operating environment.

    Pin 4 is the PWM output, which is not used in ourimplementation. It has in onboard pull-up resistor and can be

    left floating.

    Pin 6enables a calibration mode, which is also available viathe I2C bus. It has in onboard pull-up resistor and can be leftfloating.

    Pin 2 & 3 provide an I2C bus capable of communication at

    up to 1 MHz. Pull-up resistors of approximately 2 K arerequired on both the SDA and SCL lines.

    Fig.4 I2C Timing Diagram

    The I2C interface used by the compass is the same as that ofmany popular EEPROMS. To read the current bearing value,

    first send a start bit, followed by the compass address with ther/w bit low (0xC0). Next send the register number you want to

    read from. The compass has 14 registers whose functions aredocumented in the table below. Send another start bit,

    followed by the compass address again this time with the r/wbit set high (0xC1). Finally read one or more data register andsend the stop bit.

    Register Function

    0 Software Revision Number

    1 Compass Bearing as a byte. 0-255

    2,3 Compass Bearing as a word. 0-3599

    4,5 Internal Test Sensor 1

    6,7 Internal Test Sensor 2

    8,9 Internal Test Calibration Value 1

    10,11 Internal Test Calibration Value 212 Unused

    13 Unused

    14 Unused

    15Calibrate Command Write 255 to perform

    calibration

    Table 1 Compass Register Functions

    In our current implementation we are reading register 1which contains the current compass bearing as a value of 0 to255. When the micromouse is initialized it takes one initial

    bearing reading and defines that direction as North. All

    compass navigation for the current run is then referenced fromthis initial value. To make a precise 45 turn themicrocontroller would count 32 ticks one direction or theother; a 90 turn would be 64 ticks. Moving the micromousein a straight line simply means maintaining a constant value

    on the compass.To operate as precisely as possible the compass needs to be

    calibrated to the latitude that it is operating at. This can eitherbe done via Pin 6 or through the I2C interface. We decided to

    use the I2C interface as the software and hardware werealready implemented. It is important to keep the compasslevel and away from any magnetic fields during the calibrationsequence.

    To start the calibration via software, first write 255 to

    register 15. Next continuously read register 14 while slowlyrotating the compass through a full 360. Register 14 willchange from 0 to 255 when the compass is calibrated. Finally,write a 0 to register 15 to store the calibration data to the

    compass EEPROM.The motor control algorithm relies on the digital compass to

    determine when the mouse is off centered and by how muchin order to make appropriate corrections. The mappingalgorithm relies on the digital compass for accurate feedback

    on current bearing within the maze.

    3) Mapping System: The below task control flow shows thesequence of control and assignment statements within amodule. The module uses a stack for updating the weighted

    values of each cell. The stack is last in first out (LIFO)structured within the memory of the processor. The followingis the task control flow for the mapping algorithm moduleimplemented for this project.

    a) Initialize the maze, micromouse, and the stack.

    b) Update wall map based on data obtained fromsensors attached to the micromouse.c) Update the distance values of each cell.d) Make decisions about progress to next cell based on

    the wall map, weighted values and current mousedirection.

    e) Virtually move micromouse to next cell (the motorcontrol system moves the micromouse physically to

    the next cell).f) Repeatsteps 2 through 5 until a path is completed

    from the starting cell to the destination cell.

    The basic flow chart of the micromouse mapping module as

    well as a detailed description of the mapping process can befound in Appendix C.

    4) Motor Drive System: The motor drive system iscomprised of three main components: H-bridge, motors, andencoders. The H-bridge accepts 4 control signals from the

    microcontrollers GPIO pins. These 4 signals provide adirection and speed controls for each of the two motors. TheH-bridge provides the actual power to the motors in the formof a 6 volt PWM differential signal. The motors drive themicromouse and also provide a 5 volt quadrature encoded

    pulse 16 times for each revolution of the wheels. This pulse is

  • 7/15/2019 Como Hacer Un Micromouse

    5/21

    5

    used in the closed loop feedback system that allows us to

    control the speed, direction, and distance the mouse travels.

    5) Chassis: The final chassis was constructed by creating awooden mold to press multiple layers of carbon fiber fabricand an epoxy hardener into the final shape. Mounting postsand holes were then built into the chassis to mount the motors

    and circuit boards.

    Fig.5 Chassis bottom

    The carbon fiber is very smooth providing a good sliding

    surface for the skid plate design. The carbon fiber also makesthe chassis very resilient against full speed crashes andaccidental drops by team members. The final benefit of usingcarbon fiber is that it makes an excellent heat sink. Our power

    and H-bridge circuit boards are mounted directly to thechassis to take advantage of this characteristic.

    The wheels were constructed from 3cm diameter faucetwashers with rubber o-rings acting as tires. The holes around

    the wheel shown in figure 6 were used by optical encoders onan early prototype and have no effect on the finalmicromouse.

    Fig.6 Wheels

    6) Maze: The most difficult design aspect of the maze was

    the need for the walls to be reconfigurable. The solution wasto design three types of interlocking walls that also locked intothe base of the maze with posts at each cell corner. The threetypes of wall differ in the number of posts that they have,

    zero, one, or two. The walls interlock using a vertical tongueand groove system which was made by multiple passes on arouter table. Finally wood hardener was applied to the

    grooves to prevent breakage and the walls were painted

    according to the IEEE rules.

    Fig.7 Full size micromouse maze

    7) Circuit Board Design: Three separate circuit boardswere design for the micromouse: a main circuit board, an H-bridge board, and a power board. Eagle 4.09r2 was used for

    the circuit board layout. The boards each have two layers, aground layer and a power layer. The layers were definedusing the polygon tool in Eagle. Schematics and Layouts forall circuit boards are in Appendix B.

    a) Main Circuit BoardThe main circuit board houses the Z8 Encore! processor as

    well as the peripherals needed to support it, and the IRsensors. The peripherals for the processors include a serialIC, Zilog up-link interface, LEDs, GPIO pins, and the 18

    MHz crystal. The circuitry for these components was takenfrom the Z8 Encore development board schematics. The IRsensors are attached directly to the main circuit board.

    The serial IC was included to allow for serial interfacingbetween the mouse and a PC for debugging purposes. This

    circuit required a MAX3222 chip. The send, receive, andground pins of this chip were used for a serial connection.

    A six-pin header on the main board allows for code to beuploaded to the Z8 processor. The housing for the

    programming cable was removed to eliminate bulk so it couldbe connected directly to the main circuit board.

    Fig.8 Programming cable connected to mouse

  • 7/15/2019 Como Hacer Un Micromouse

    6/21

    6

    Dual-pack LEDs were placed on the circuit board as a tool

    for debugging. The dual-packs are in combinations ofred/green, red/yellow, or yellow/green.

    8 GPIO pin headers on the circuit board provide for extradebugging ports.

    The 18MHz half-can crystal was placed on the underside of

    the main circuit board so it would not interfere with the crossfiring of the IR sensors.

    The IR sensors get their 5V input voltage from the maincircuit board. The 10uF filtering capacitors are also on the

    main circuit board.The main circuit board has two power regions on the power

    plane. One region is 3.3V for the microprocessor and itsperipherals, the other region is 5V which is needed by the IRsensors and the digital compass. Power for these two regions

    is supplied separately from the power board.

    b) H-bridge BoardWe design three different H-bridge boards, but ended up

    using the one with the TI H-bridge. The H-bridge board

    gets both the 6V it needs to power the motors and the 5V it

    needs for logic directly from the power board.

    c) Power BoardThe power board supplies three different voltage levels,

    3.3V, 5V, and 6V. 6V and 5V go to the H-bridge board,and 5V and 3.3V go to the main circuit board. The powerboard uses a 3.3V Voltage Regulator and a 5V VoltageRegulator.

    III. TEST PLAN

    Below is a test plan based on the functions the micromouse

    must perform in order to meet its objectives.

    A. Recognize Walls and Openings1) Specifications:

    The long-range sensors must be able to determine theapproximate distance to the front and rear walls.

    The short-range sensors must determine openingswithin the maze independent of whether the mouse is

    centered within the current cell or not.

    2) Metrics:

    The front and rear distance measurements must bewithin 3cm of accuracy.

    The two side sensors must be able to determine that aside opening is present if a range value greater than

    18cm (an A/D value less then 323) is read.

    3) Test Plan:

    To test that the long range sensors see front and rear wallsto within the prescribed 3cm of accuracy, we will observe the

    decision the mouse makes as it approaches the front or rearwall. To meet the 3cm requirement the mouse must stopwithin 3cm of the center of a cell (front to back) when it stops.

    To test the detection of wall openings, a LED will representa wall opening for each side of the mouse. When the mouse

    enters a cell with an opening the mouse will light an LED

    indicating an opening on the correct side of the mouse.

    B. Stay Centered within the maze:1) Specifications:

    The digital compass must give accurate data for themotor control algorithm to determine when the

    mouse is off-centered within the current cell.2) Metrics:

    The mouse must not veer by more than 6 degreesfrom its intended heading.

    3) Test Plan:

    An LED will light up on the corresponding side if the

    mouse veers by more than 6 degrees in heading to oneside or another. This test assumes that the correct bearingwhether it is relative N, S, E, or W is correctly given tothe compass from the mapping algorithm.

    C. Know position and bearing with in the maze.1) Specifications:

    Motor encoders must be able to provide data on thecurrent cell location while exploring the maze.

    The digital compass must provide accurate data todetermine absolute bearing with respect to north(north is the direction the mouse faces at the start).

    2) Metrics:

    Identify the current cell by its exact row and columnnumber.

    Accurately identify the current bearing in relative N,S, E, and W.

    3) Test Plan:

    To test the mouses position in the maze, we will use 8

    LEDs to indicate the absolute position in the maze byassigning a number to each cell. By knowing the cell numberswe will track the progress of the mouse by eye and comparethe known cell position to the LED readout.

    To test the bearing, we will use 2 LEDs to represent relativeN, S, E, and W. While watching the mouse travel through themaze, we will compare the known direction the mouse ispointing to the direction on the LEDs.

    D. Control the distance and direction needed to travel.1) Specifications:

    The motor control system must be able to move the

    mouse for a set distance. The motor control system must be able to used data

    from compass to make precise 45 and 90.

    The motor control system must be able to use datafrom IR sensors and the encoders to maintain a givenspeed over a range of distances.

    2) Metrics:

    The motor control algorithm must control thedistance the mouse travels to within one standarddeviation of the measured distance error from themotor encoders. The standard deviation can be

  • 7/15/2019 Como Hacer Un Micromouse

    7/21

    7

    measured by running the micromouse for a several

    given distances and calculating the deviation fromthe given distances.

    The design speed may range from 0.1m/sec to 0.25m/sec. The micromouse must be able to travel withthe design speed within 5% error.

    The micromouse must be able to make precise 45and 90 turns within 5% error.

    3) Test Plan:To test the distance traveled we will first need to establish

    the standard deviation for distance. In any open area we will

    layout several horizontal lines parallel to each other. We willthen measure the distance from the first line to each of theother lines. Next we will program the mouse to travel each ofthese distances several times measuring the actual distancetraveled after each run. The measured data will be compared

    to the desired distances to establish a standard deviation fordistance.

    After having found the standard deviation, we will changethe distance of the horizontal lines. Again we will measure

    the distance from the first line to each of the other lines. We

    will then instruct the mouse to run these distances. The actualdistance the mouse travels should then be within one standarddeviation of the desired distance.

    To test the mouses ability to maintain a given speed we

    will measure off a set distance. We will place the mouse anadequate distance from the starting line to achieve a presetconstant velocity. We will then use a stopwatch to time howlong it takes the mouse to travel the given distance. We will

    use the time to calculate the actual velocity and calculate apercent error against the set value. The test will be repeatedover a range of desired running speeds.

    To test the mouses ability to make 45 and 90 we willattach a bamboo skewer pointer. We will then measure two

    points along the skewer as an initial reference. Next we willprogram the mouse to make a 45 turn. We will repeat themarking process where the mouse stops. We will connect thedots from each position and determine the angle between the

    lines. This test will then be repeated for the 90 turn.

    E. Navigate the maze intelligently.1) Specifications:

    The mapping system must be able to make intelligentnavigation decisions based on modified flood fillalgorithm, the available wall data, and mousescurrent position.

    2) Metrics:

    Identify the current cell by its exact row and columnnumber.

    Accurately identify the current bearing.3) Test Plan:

    The navigation system can be tested by observing the

    motion of the mouse in a known maze configuration. Themouse is expected make motion decisions based on modifiedflood algorithm.

    NOTE:

    %error= (design variable experimental variable)/design

    variable * 100

    IV. PRODUCT LIFE CYCLE REPORT

    A. IntroductionThe micromouse is an autonomous robot, designed to find

    the center of a 16 by 16 cell maze within 10 minutes. Themicromouse senior design project was proposed and

    sponsored by Dr. Herb Hess. The design and construction ofa micromouse encompasses many aspects of both Electricaland Computer Engineering and was therefore a viable yetchallenging option for a senior design project.

    A goal of the design and construction of the micromouse isto generate interest among University of Idaho engineeringstudents as well as students from other engineeringdepartments. The micromouse can also be viewed as anopportunity to generate interest in engineering field among

    high school students.

    Yearly micromouse competitions sponsored by IEEEprovide the opportunity for students to showcase theirmicromouse as well as learn about new design methods.

    B. Design1) Micromouse design: The micromouse is designed

    according the IEEE micromouse competition specifications.These specifications constrain the size of the mouse, requirethat it be fully autonomous while solving the maze, and itcannot use methods such as jumping over walls to solve themaze. Other than the IEEE constraints the design of the

    micromouse is open. Our micromouse design has four main

    components: the mapping system, motor control system, thesensor system, and the compass system.

    We choose the wheel configuration for our design. This

    configuration is fairly easy to implement because it requiresthe control of only two wheels, as opposed to four wheels.Monitoring motor speed is simplified along withimplementing turns. The wheelchair configuration is anoptimal architecture for first time micromouse designers.

    The two popular choices for micromouse motors are dc andstepper. We decided to use 1224 series Micromo DC motorsto drive the mouse wheels. DC motors are much lighter thanstepper motors, which considerably decreases the required

    torque for running. Compared to stepper motors, DC motors

    are slightly more complicated to implement because they relyon a feedback loop to control speed. Once the feedback loopis defined, however, dc motors provide for more precise motorcontrol. Starting the design with DC motors allows for future

    improvements that could make the mouse more competitive.For our design we used Sharp GP2D12 (long distance) and

    GP2D120 (short distance) infrared side-looking sensors.Another popular option for first time designers is the antenna

    configuration, using digital sensors. The Sharp GP2D sensorswere chosen because they are fairly cheap, reliable, andreadily available in the market. The side-looking sensors give

  • 7/15/2019 Como Hacer Un Micromouse

    8/21

    8

    analog voltage values corresponding to distance. This

    information is used to detect walls and openings as well asaligning the mouse within the maze cells. The GP2D12 andGP2D120 sensors are relatively insensitive to ambient light,making the sensor array more robust and reliable.

    Another important design consideration is the type of

    algorithm used to solve the maze. For our design we used themodified flood-fill algorithm. This algorithm is very popular

    among micromouse designers. The advantage of using thisalgorithm is that it does not require the mouse to explore the

    entire maze in order to solve for the optimum path from thestarting point to the center. This allows for more time to beallocated towards speed runs to improve performanceduring competition. During speed runs the mouse is designedto travel at a relatively faster speed than during the initial

    mapping run.The micromouse utilizes the Devantech Electronic Compass

    this purpose. The compass interacts with the micromouseprocessor through the I2C pins. The Devantech Electronic

    Compass was chosen for its accuracy.

    C. Implementation and Testing Tools1) ZDS II Software development package: The firmware for

    micromouse was developed by using ZDS II softwaredevelopment tools provided by Zilog Inc. ZDS II was ourchoice of development package because the micromouse usesZilogs Z8F6423 microprocessor for I/O, data processing and

    necessary computations. The development package is free ofcost and can be downloaded from Zilogs official website.Zilog provides good support for the development tools andalso provides additional libraries for implementing several

    microprocessor resources. The ZDS II program files arewritten in C programming language. The package includestools for managing projects, loading, debugging, andsimulating a firmware.

    2) Micromouse firmware: The firmware consists of

    necessary program codes for implementing the functionalitiesrequired by the four main components of micromouse system:the mapping system, motor control system, the sensor, and thecompass system. The firmware is downloaded and stored in

    the non volatile processor flash memory. These program fileswill be provided to micromouse users in a library package.The users may use modules within the library to control themicromouse activity.

    D. Release Plans1) Potential Customers: The micromouse may be sold to

    departments within high schools and colleges for generating

    interest in the field of engineering among students.

    2) Hardware and software cost for micromouse users: Thehardware costs for the user may range from $400-$500. Themajor contributor to this cost is the good quality DC motors

    which by itself cost about $70 per unit. The firmware for themicromouse may be provided free of cost in a library package.

    At least a quarter of a competition scale maze is necessaryfor testing and debugging. New designers can build there ownor buy pre-manufactured maze kits. Schools and departments

    are encouraged to share the cost and labor of acquiring a

    micromouse maze.

    E. Support and MaintenanceNew micromouse designers will inevitably encounter

    hardware and software breakdowns. As representatives of theUI micromouse project, we must be able to provide technicalsupport for the firmware and hardware problems new

    micromouse designers may face. The firmware may containfaulty code segments that have not yet discovered due toinsufficient unit and integration testing.

    The design of our micromouse, as with any, provides formany potential hardware failures. One potential hardware

    failure could be from ineffective shielding of the micromousemotors to protect the digital compass from magnetic fieldinterference. The Devantech Electronic Compass utilizes theearths magnetic field to compute the orientation of the

    micromouse. The magnetic radiation from the poorly shieldedmotors may cause the digital compass to send faulty data tothe micromouse processor. Through testing and analysis wehave determined a method for reducing this potential failureand would be able to give support to future users with similar

    design issues.

    F. End of Life1) Hardware: The hardware life of a micromouse is

    dependent on the quality of its components and construction.As with any electronic part, reliability and efficiencydeteriorates over time. The shelf life of a micromouse is afunction of use and maintenance. With proper support and

    maintenance a well-constructed micromouse is estimated tooperate efficiently for 8-10 years.

    2) Software: Software life is reliant on the Zilogs supportof the development platform as well as a new designersproper implementation of the provided firmware. The

    micromouse designer must continually check Zilog supportfor updates on development tools. Because the developmenttools are provided free of charge on Zilogs website, adesigner is not restricted by licensing time limits.

    V. RELIABILITY REPORT

    A. Potential Failure ModesWhile considering the effects of each potential failure mode

    we came up with two possible outcomes: failures resulting ina crash, or failures resulting in the mouse becoming lost in the

    maze. In either scenario the main objective of solving themaze is not met, and the outcome can be considered an overallsystem failure.

    The micromouse must operate autonomously. This meansfailure modes due to human factors are essentially obsolete

    once the mouse enters the maze. Because the mouse must relyon nothing other than its own artificial intelligence to solvethe maze, failure modes are inherently interdependent.

    1) Failure Mode Interdependence: The decision the mouse

    makes, which corresponds to software performance, is a direct

  • 7/15/2019 Como Hacer Un Micromouse

    9/21

    9

    result of measurements taken by hardware components as well

    as the mechanical performance of the mouse design.Conversely, the mechanical performance of the mouse isdependent on the accuracy of commands from the softwarealgorithms.

    Because of the interdependency of software performance on

    hardware performance the micromouse crashing or becominglost within the maze will be a combination of hardware and

    software failures. For example, if an infrared sensor fails todetect a side opening, the mapping algorithm will then have an

    inaccurate data representation of the maze and may not beable to solve the maze. Another example would be improperwheel alignment (a mechanical failure) causing acompounding error in distance calculations. If the motorcontrol algorithm fails (a software failure) to correct this error,

    the mapping algorithm will once again receive an inaccuratedata representation of the maze (compared to the ideal mazelayout that the mapping algorithm expects) and the mouse willbecome lost and eventually crash.

    2) Fault Tree Representation: Because of thisinterdependency a fault tree logic evaluation of system failure

    would have redundancy as you travel towards the base of thetree.After brainstorming potential failure modes we categorized

    them into five different regions. Within each of these fivemain fault regions there are minor faults. The five regions inwhich potential failures can occur are software, component,mechanical, electrical, and power supply. Failures within

    these regions would be towards the top of the fault tree,because a failure in any one of these regions would mostlikely result in an overall system failure. Our potential failuremodes and there minor failures are listed in Table 1 below.The ratings of severity, occurrence, and detestability are based

    on the FMEA scale provided in ECE 481, Senior Design

    class.

    Potential Failure RPN

    1Software Fails to Make CorrectDecision

    168

    1.1 Incorrect data from compass 64

    1.2 Incorrect data from sensors 224

    1.3 Incorrect data from shaft encoders 64

    1.4Faulty implementation of flood-fillalgorithm

    280

    2 Component Failure 30

    2.1 Processor failure 302.2 IR Sensor failure 40

    2.3 Motors failure 40

    2.4 Digital Compass failure 50

    2.5 Shaft encoders failure 60

    2.6 H-bridge failure 30

    3 Mechanical Malfunction 70

    3.1 Wheel slip 70

    4 Electrical Malfunction 160

    4.1 Wire connection failure 200

    4.2 Circuit board failure 200

    4.3 Electromagnetic Interference 120

    4.4 Cross-talk interference 120

    5 Power Region Failure 50

    5.1 Battery Life Inadequate

    50Table 2. Potential Failure Modes

    3) Software Region Failures: Failures in the software

    region are interdependent on failures of hardwarecomponents. This is because the software algorithms rely ondata from the compass, sensors, and encoders to makedecisions. Software failure may also be a function of poor

    code implementation.4) Component Region Failures: Component failure is a

    separate region due to the fact that our components werebought pre-assembled from a vendor. The failure of ourmicromouse components is therefore a function of the quality

    of their manufacture as well as our implementation.

    5) Mechanical Region Failures: Mechanical failureencompasses our mouses performance based on the physicalconditions of the given maze. The main mechanical failure

    that can occur is wheel slippage. Wheel slippage can occurdue to the texture of the maze surface, wheel quality, ordesign acceleration.

    6) Electrical Region Failures: Electrical failures can causesevere damage to the system. Poor solder contacts, circuit

    board malfunctions, as well as EMI and cross talk are themajor areas for potential electrical failures.

    7) Power Region Failures: Failures in the power regionwould be due to insufficient battery life to complete the 10

    minutes allotted for solving the maze. This is an obvious

    failure to detect. Improving this failure would simplyrequiring testing the battery power before each run.

    B. Assigning Failure Mode CriteriaThe next step for defining reliability of our product was to

    assign severity, occurrence, and detection ratings to eachfailure mode.

    1) Severity Rate: The severity rating of each potential failuremode reflects the extent to which the failure prevents themouse from successfully solving the maze. We defined aseverity scale from 1-10. A rating of 10 means the severity of

    the effect of the failure is very high, and causes the mouse to

    crash or become permanently lost within the maze.Consequently the severity rate of most, if not all, of our failuremodes will be very high.

    2) Occurrence Rate: The occurrence ratings for the failure

    modes were determined by finding the potential causes ofeach failure. For example,

    3) Detection Rate: The detection ratings for our failuremodes were fairly straightforward to assign. The debugging

    tools, such as the onboard LEDs, will allow us to identifymost component malfunctions.

  • 7/15/2019 Como Hacer Un Micromouse

    10/21

    10

    C. Calculating Risk Priority NumberThe Risk Priority Number (RPN) is the product of the

    Severity, Occurrence, and Detection rates. The risk prioritynumbers are a base for comparing new RPNs as we makeimprovements to our design to reduce the effect of potential

    failure modes. Risk Priority Numbers are shown along withtheir corresponding Potential Failure Mode in Table 1. Chart1 shows the relative magnitudes of the Risk Priority Number

    for each failure mode.

    Pareto Diagram of Ratings

    168

    30

    70

    160

    50

    0

    20

    40

    60

    80

    100

    120

    140

    160

    180

    Software

    Failsto

    Make

    Correct

    Component

    Failure

    Mechanical

    Malfunction

    Electrical

    Malfunction

    Power

    Region

    Failure

    Potential Failure

    RPN

    Chart 1 Pareto Diagram of Ratings

    D. Actions to Reduce High Risk Failure ModesFailures in the software region will be reduced over time

    during the continual debugging process. The occurrence of

    incorrect decision making will be reduced as the softwareevolves.

    Component failures due to poor design implementation willbe reduced during the testing cycle as well as by feedbackfrom competition performance.

    Electrical and mechanical failures may be reduced by qualityconstruction of the mouse.

    VI. BUDGET AND SCHEDULE ANALYSIS

    A. Budget AnalysisWe ended up $78.46 over budget at the end of the semester.

    The larger costs of our project came from the expeditedshipping of our circuit boards and circuit board components in

    the attempt to have the mouse running for the October 22IEEE micromouse demo in Spokane. The final budget forTeam MightyMouse is in Appendix A.

    B. Schedule AnalysisWe were overly ambitious in our desire to costume design

    and build the majority of our micromouse components. Thiscaused a lot of time to be spent on hardware design and did

    not leave adequate time for testing, debugging, and writingefficient code. A comparison between the intended schedulefor the fall semester and the actual fall semester can be viewin Appendix A.

    VII. CONCLUSIONS

    During the integration of micromouse components weencountered new obstacles. We managed to come up with

    effective solution for some and some problems still need to beaddressed.

    The first problem we encountered was that we were unableto download code on to the processor. After hours of intensive

    hardware debugging we realized that the resistor used for the

    processor crystal was off by a factor of a 1000. Afterreplacing the resistor with the appropriate size resistor wewere then able to download code on to the processor.

    While testing the micromouse we also realized that the

    encoder circuitry was inoperable. This was probably causedby using a H-bridge with too high output voltage. As a result,we had to buy new motors. Later on, we used the Texasinstruments SN714410 H-bridge with maximum output

    voltage of 6 volts to supply power to the motors. We did notencounter any problems with motors since then.

    We also found out that some of the connections on the H-bridge circuit board were not well connected. We had to use awire externally to supply power to the H-bridge. After some

    more debugging, we also found that one of the input pins tothe H-bridge chip was always high. We had to cut the pin onthe H-bridge chip from the board pad and externally solder awire to the input pin. The trace connecting the power supply

    to the fuse also seemed to be faulty. We soldered the traceexternally.

    The motors have internal encoders that operate on 4-18 voltssupply. The encoder generates 16 pulses per revolution. Theseencoder output from the two motors are supplied as an input

    to the microcontroller on Port D pin 4 and Port D pin 5. Themicrocontroller generates an interrupt service routine on therising edge of these pulses to keep track of distance traveled.However, after hours of software debugging we realized that

    the microprocessor was not able to generate any interrupts onport D pin 4. This was a big problem since we were not ableto keep track of the distance traveled for one of the wheels.We supplied the same signal to the same pin (Port D pin 4) onthe development board and we found out that it was able to

    generate interrupts. This confirmed our suspicion that the pin4 on Port D was inoperable. We externally connected theencoder output to pin 7 on port D of the microcontroller. Thissolved the problem.

    Later on during our testing phase, we also recognized thatthe go button must be able to connect the input pin on themicroprocessor to a logic high voltage. Originally we had thego button between the input pin (Port D pin 6) and ground

    signal. Again, we disconnected the pad from the button pinand soldered a wire from pin to the supply voltage trace on theboard.

    Finally, we encountered a problem with the Devantechdigital compass. According to our design we expected that the

    compass would generate constant value while the mousetraveled in a straight line. However, we found out that thecompass generated different values. This is a problem,because now the micromouse does not have way to tell if it istraveling in a straight line. This is an issue that still needs to

    be addressed by future designers who may work on this robot.

  • 7/15/2019 Como Hacer Un Micromouse

    11/21

    11

    VIII. RECOMMENDATIONS FORFUTURE MICROMOUSE TEAMS

    Our overall method of solution was to build subsystems(navigation module and mapping algorithm are examples ofsubsystems) then integrate. The first semester was to bededicated towards design and construction of subsystems.

    The second semester was to be dedicated to integration. Thefirst semester we had only the prototypes of each subsystem

    built and working independently. Consequently, majority ofthe second semester was focused on constructing the final

    mouse. This was very time consuming as it involved creatingall the circuit boards we would use.

    In hindsight, to make this project more successful, the

    final mouse (all parts integrated and functioning) would

    ideally be completed the first semester. Then more time could

    be spent working on the method of solving the maze.

    The following points are advice to new micromouse teams.

    Limit the amount of hardware that you will have tobuild or spend time customizing.

    Attempt to buy components, i.e. a microcontroller,with most of the peripheral you will need.

    Make basic design decisions early on andimmediately build prototypes of those subsystemsand interface whatever current subsystems you haveworking. For example, decide between top-down orside-looking sensors and then interface that systemwith your mapping algorithm. Another example is,

    decide between DC or stepper motors and alsointerface that with any current algorithms.

    Dont worry about speed! Make your main focus tobuild a mouse that is rugged and indifferent to itssurroundings. Many factors, such as dirt sticking to

    the wheels or groves in the base, are overlooked inthe early design stages. Do not rely on an ideal mazeenvironment for your initial design.

    Save all your code! Either move it to a different fileor comment it out. You will most likely right several

    versions of a code, attempting several ways to solvethe same problem. You will want to record yourevolution of design.

  • 7/15/2019 Como Hacer Un Micromouse

    12/21

    12

    APPENDIX A

    BUDGET AND SCHEDULES

    INTENDED & FINAL FALL SCHEDULES

  • 7/15/2019 Como Hacer Un Micromouse

    13/21

    13

    FINAL BUDGET

  • 7/15/2019 Como Hacer Un Micromouse

    14/21

    14

    APPENDIX B

    USERS MANUAL

    A. Code for MightyMouse1) Development Software: ZDSII Z8Encore! 4.9.3

    Our Z8 Encore! Microcontroller that we used initially before we created our own circuit board came with the ZDSII

    Development Environment. This environment is a debugging tool as well as a compiler for code written for the Z8 Encore!Microprocessor. C++ is the programming language used in the ZDSII Development Environment. The debugging tools includesetting breakpoint and watch variables as well as error and warning messages after building the file.

    2) Loading CodeThe Z8 Encore! Microcontroller we used came with a programming cable that interfaced the microcontroller to the pc. We

    modified it by removing the external casing so that we could use it for our custom made mouse. The cable connects to themouse the same way as it did to the microcontroller, via a six-pin header on the main circuit. This cable allows code to bechanged and different codes to be loaded onto MightyMouse. A picture of the modified programming cable connected to the

    mouse can be found in Figure 8.

    3) Existing CodeWe currently have many several programs written for MightyMouse. There are programs that interface the individual

    components to the processor. These programs and a brief description of their function are below. A brief description of each

    program file is in Readme.txt on the electronic copy of the code.

    navigation_sensor.zdsproj

    This program reads values of up to six infrared analog sensors. There are functions that will convert the digital values read tocorresponding range values. The current code will light up an onboard LED designated to a certain sensor when it detects awall. This code is very useful for deciphering if your mouse is seeing the walls and openings within the maze. The range atwhich the LEDs are toggle can be modified accordingly. The code also allows for the digital or range values to be printed to a

    hyperterminal. This was useful for linearizing the sensors.

    dgcomp_host.zdsproj

    This code initializes and calibrates the digital compass. A description of the calibration process can be found in Appendix B inthe Devantech Digital Compass Data Sheet. This code also prints compass readings to a hyperterminal.

    B.

    Troubleshooting Hardware Problems1) Disassembling MightyMouse

    When troubleshooting the mouse it may be necessary to partially disassemble it to access the power board, H-bridge board,motors, or underneath of the main board. Below are pictures diagramming the disassembly of the mouse.

    Fig. 9 Mouse taken apart: To take off the Main PCB unscrew the three mounting

    posts and disconnect the wires from the bottom of the Main PCB.

  • 7/15/2019 Como Hacer Un Micromouse

    15/21

    15

    Fig. 10 Mouse Guts: Some important connections are labeled in this picture. All connections can be easily view in the Eagle files on the included Software CD.

    2) Using Eagle Layouts, Continuity TestingIf a trace or connection is suspected to be bad or faulty the best method is to do a continuity test using a digital multimeter. If

    the connection is good the multimeter will either show a resistance or sound a beep depending on its mode of operation. Thecircuit board layouts in Eagle are very useful when checking continuity or board traces. To verify that a connection is or is notsuppose to be somewhere on the board simple use the eyeball tool to highlight the connection by double-clicking on either padof the connection.

    Overall the circuit board schematics and layouts are the best reference when troubleshooting hardware connection.

  • 7/15/2019 Como Hacer Un Micromouse

    16/21

    16

    APPENDIX C

    COMPONENT DATA SHEETS

    MAJORCOMPONENT SPECIFICATIONS

    Supply Voltage CurrentRange/

    Resolution

    External

    CircuitryOutput

    Sharp GP2D IRSensors

    5V 20mAGP2D120: 4-30cmGP2D12: 10-80cm

    10F Capacitorbetween Vo and

    Ground

    Analog Voltage0.4-2.4 V

    DevantechElectronicCompass

    5V 15mA 0.1 degrees2k pull-up

    resistors on SDAand SCL

    I2C

    Micromo DC

    Motors

    12V 50mA 6750rpm - -

    Encoders 5V 12mA 16 count N/A5V quadrature

    pulse

    IC H-bridge 5V-35VUp to 1A per

    motor8-bit current

    controlFeedback speedcontrol hardware

    Z8 Encore C2.7-3.6V (5V

    tolerance)160mA

    -64K FlashMemory

    -4K Register RAM-2 Full-duplex

    UART-4 16 bit timers w/

    capture, compare,and PWMcapability

    -12 Channel, 10bit ADC

    -60 I/O pins-I2C-SPI

    -ProgrammablePriorityInterrupts

  • 7/15/2019 Como Hacer Un Micromouse

    17/21

    17

    APPENDIX C

    MAPPING ALGORITHM: DETAILED METHOD OF SOLUTION

    The following figure shows the basic flowchart the micromouse mapping module. This function is repeatedly executed from

    the main program during the mapping mode.

    get_sensor_data(current_cell)

    get_sensor_data()

    Start

    update_wallMap(sensor_data)

    getMotionVariables

    update_cellWeight();

    get_minOpenNBwt(x, y, &next_x, &next_y)

    (maze[[x][y]&CMARK_mask == 0)

    This statement checks if thecurrent cell that the robot

    stands has been visited. Ifthe cell has been visited then

    updating the wall map isnecessary

    This module uses the sensordata from the three sensor

    channels to store thesurrounding wall informationassociated with the current

    cell. The sensors channelsare interrupt driven and are

    sampled every 35 ms.

    This module collects sensordata from the appropriate

    sensor channels. It can alsobe overloaded to get artificial

    sensor data.

    (maze[x][y]&0xFF != 0)

    This statement checks if thedestination cell has been

    found. If the destination cellis found then updating

    weight, and getting motionvariables is not necessary.

    This module updates the cellweight based on the data

    collected from the sensorchannels.

    This function finds the open

    neighbor with least distancevalue with respect to current

    cell with row #x and column# y. The function assigns therow and column # of the cell

    with least distance value tothe variables next_x and

    next_y respectively

    This module computes theturns and distance requiredto move the micromouse

    towards the destination cell.

    End

    FalseTrue

    FalseTrue

    Fig. 6 Micromouse mapping system flow chart.

    1) Initialization-Theoretical basis: The initialization process is necessary for the mapping systems. During initialization systemis forced to into a known state, thus making the debugging process simpler.

  • 7/15/2019 Como Hacer Un Micromouse

    18/21

    18

    2) Initializing the Maze: This process involves initializing the maze cells with weighted value that is associated with theproximity of a particular cell from the destination cell. Since the north, south, east and west boundary of the maze is surroundedby walls, this process also includes initializing of the boundary wall bits. The boundary wall bits encode the information ofsurrounding wall for each cell. Figure XV shows the structure of data that is used to store information about the maze cells.Since the maze consists of 16 by 16 cells, there are 256 data words (512 bytes of data) allocated to store information of themaze.

    b15

    visit

    b14

    dir

    B13

    dir

    b12

    dir

    b11

    N

    b10

    S

    b09

    E

    b08

    W

    b07

    WT

    b06

    WT

    b05

    WT

    b04

    WT

    b03

    WT

    b02

    WT

    b01

    WT

    b00

    WT

    Fig.6 Unsigned int maze[16][16]. WT = weighted value, dir = direction.

    For the data structure given in Figure XV, bits 07 through 00 encode weighted values of each cell. Bits 11 through 8 encode awall map. Bits14 through 12 encode current mouse direction. Bit 15 indicates if the cell was visited during exploration of themaze. This data word allows me to encode information about the current direction of micromouse, wall map for the relevantcells, and distance values for each cell of the maze inside one word of data. Figure XVI shows the interpretation of maze data

    of an example 6 by 6 cell maze after the initialization process.

    Starting point ->

    Fig.7 The 6x6 memory mapped maze after initialization process.

    In figure XVI, the value within each cell is the weighted value. The weighted value represents the number of steps that isrequired to reach the destination cell from that particular cell. The cell with the distance value of 00 is the destination cell. In

    figure XVI, the four cells in the center of the maze form the destination point. The weighted value of the starting cell isinitialized to 4 because it takes 4 steps for the micromouse to reach the destination cell from the starting point.

    3) Initializing the Micromouse: A variable named CURR_DIR_WALL_POS keeps track of the current position and directionof the micromouse. This variable must be initialized to reflect the starting position of the mouse. Figure XVII shows the value of

    the variable CURR_DIR_WALL_POS after initialization.

    b15*

    b140

    b131

    b121

    b11N=0

    b10S=1

    b09E=1

    b08W=1

    b070

    b060

    b050

    b040

    b030

    b020

    b010

    b000

    Fig.8 Unsigned int CURR_DIR_WALL_POS.

    Bits 07 through 00 encode position of the mouse within the maze. Since the mouse starts from the first row and first column,

    the position bits are initialized to 0. Bits 11 through 8 encode wall map. Since the north wall is the only open wall from thestarting position, bit 11 that encodes the north wall is set to 0. Bits14 through12 encode direction of the micromouse. If the bits

    13 through 12 are set to 1, then it is defined to be facing north. During initialization these bits are always set to 1 to indicate thatthe mouse is facing north (reference north, not magnetic north). If the bits 13 and 12 are set to 1 and 0 respectively, then it is

    defined to be facing south. If the bits 13 and 12 are set to 0 and 1 respectively, then it is defined to be facing east. If the bits 13and 12 are set to 0 and 0 respectively, then it is defined to be facing west. Bit 15 remains unused.

    4) Initializing the Stack: Initializing the stack simply involves emptying the stack. This is achieved by setting the stack pointerto zero.

  • 7/15/2019 Como Hacer Un Micromouse

    19/21

    19

    Stack pointer->

    Fig. 9 Memory structure for a stack

    Each byte of data inside the stack encodes the location of particular cell within the maze. There are 256 bytes allocated for the

    stack since the maze contains a maximum of 256 cells. Figure VIII shows the structure of a stack.

    5) Updating the Wall Map: The sensors attached to the micromouse are used to get information about the walls surrounding acell. The sensor data is used to update the wall map for each cell of the maze. For ease of understanding the mapping process, Iconstructed a 6 by 6 cell test maze using artificially seeded sensor data. Figure IX shows the test maze generated by using

    artificial sensor data values.

    Cell 10 (row#1, column#0) ->Test maze starting point ->

    Fig. 10 Virtual test maze via artificial sensor data values.

    b15*

    b140

    b131

    b121

    b11N=1

    b10S=0

    b09E=0

    b08W=1

    b070

    b060

    b050

    b041

    b030

    b020

    b010

    b000

    Fig. 11 Unsigned int CURR_DIR_WALL_POS

    b151

    b140

    B131

    b121

    b11N=1

    b10S=0

    b09E=0

    b08W=1

    b070

    b060

    b050

    b040

    b030

    b020

    b011

    b001

    Fig. 12 Unsigned int maze[1][0].

    In the above 6 by 6 cell test maze, the micromouse moves towards north cell from the starting cell. Since the next cell islocated in the second row and first column the cell number is 10. While the micromouse is in cell 10, it collects data from the

    north, south, east and west sensors. After collection of data from these sensors the micromouse updates the variableCURR_DIR_WALL_POS and the maze[1][0] (see figure XVII and XV) to replicate the walls surrounding the cell 10 within thecomputer memory. Figure XX shows changes that occur within the variable CURR_DIR_WALL_POS. Figure XXI shows the

    changes that occur within the variable maze[1][0].In figure X and figure XI, bit 11 (b11) is set to 1 because the north wall is present in cell located at memory location 10. Bit

    10 (b10) is set to 0 because the south wall is not present. Similarly bit 9 and 8 are set to 0 and 1 respectively to indicate that thecell has no wall towards east and has a wall towards west. This gives the wall map for the cell addressed row # 1 and column # 0whose wall information is being stored at memory location maze[1][0].

  • 7/15/2019 Como Hacer Un Micromouse

    20/21

    20

    6) Updating the Weighted Value of a Cell: The weighted value of a cell represents the number of steps that would berequired to reach the destination cell from that particular cell. As the micromouse receives information about the wall foreach cell, it has to update the weighted value because the number of steps to reach the destination cell from that particularcell would change. The following is a pseudo code that this process executes to update the weighted value of each cell. Thefollowing pseudo code is taken from the www.micromouseinfo.com. It was presented on the website hosted by SteveBenkovic.

    a) Make sure the stack is empty.b) Push the current cell onto stack.c) Repeat following set of instruction until stack is empty.d) Pop a cell from the stacke) Does the distance value of this cell = 1 + the minimum value of its open neighbors?

    f) No -> Change the cell to 1 + the minimum value of its open neighbors, andg) Push all of the cell's open neighbors onto the stack to be checked.h) Yes -> do nothing.

    7) Making Decisions about Progress to Next Cell: This process is straightforward. It involves finding the open neighborcell with minimum weighted value and deciding the next cell to be covered. The open neighbors are found by checking thewall bits associated with the relevant cell. Once the open neighbors are detected their distance values are compared to get theopen neighbor with minimum weighted value. In this step, the module makes decisions about progress to next cell based on

    the wall map, weighted values and current mouse direction.

    8) Virtually Moving Micromouse to Next Cell: In this step the variable CURR_DIR_WALL_POS gets updated with theappropriate cell value, and direction of the mouse within that cell. The wall bits are cleared to zero here because at this point

    the mouse is now ready to move on to the next cell and it does not have information about the wall setup for the next cell. Atthe end of this process the visit bit of the maze data associated with the relevant cell is also set to 1. This indicates that the

    cell has been visited by the micromouse during the exploration of the maze. This process occurs after the mouse physicallymoves to a new cell.

    9) Micromouse Operating Modes: The micromouse will operate in two modes: the mapping mode, the back track mode,and the speed run mode. During the mapping mode it travels at a slower speed and sample sensor data within fixed timeintervals. In this mode the micromouse will explore the maze in search for the destination cell located in the center of themaze. During the back track mode, the mapping system will compute the shortest path between the starting point and the

    destination point within the explored area of the maze. During the speed run mode the micromouse would use this shortestpath to travel from the starting point to the center of the maze. While operating in this mode the micromouse would notsample the sensor data related to mapping, and it would also travel at a faster speed. The sensors would still be used to getfeedback about the alignment.

  • 7/15/2019 Como Hacer Un Micromouse

    21/21

    21


Top Related