xyzio

Micromouse

leave a comment »

I took the Micromouse class at UC Davis while getting my degree there.  This is a basic page I put together about Micromouse when I T.A’ed for the class the next year.  Enjoy and feel free to contact me if you have any questions, find dead links, or have comments.

Cheers!

MicroMouse

MicroMouse is a competition in which teams build a robot (a mouse) that will solve a maze to get to a certain location (the cheese). The robot requires a few components, mainly a microcontroller, sensors, motors, batteries, and a pair of wheels. Put them together, slap on some programming, remember the rules, and you’re all set.

MicroController

There are a lot of different types of microcontrollers out there that are suitable for micromouse. Two that I’ve used are the ATmega128 and the Motorola HC812. Each has its pros and cons. The ATmega is cheap and has has an easy to set up freeware development chain for Mac, Windows, and Linux. The Motorola can be faster and has more memory (Not too crucial for most MicroMouse applications) but is expensive and its freeware development chain is not easy to setup. You might be tempted to buy the parts and roll your own board. Don’t do it unless you are a pro at soldering. Get a board with at least 4k of RAM and 64k of Flash. Most MicroMouse code can fit in that much space, but is wise to be safe in go for as much memory as possible. Here are some links to help you out:

www.BDmicro.com: These guys sell some decent ATmega128 boards, check out the MAVRIC-II. I have one and I’ve found out that they are expensive but you get what you pay for, their boards have lived through stuff that would have killed cheaper ones. If ordering from them, you should also order the AVRISP. It is used to program the microcontroller and will save you much trouble in building and soldering your own.

www.AVRfreaks.net: This is the site for any and all ATmega microcontroller related information. You can download AVR-GCC, the compiler for the ATmega microcontroller series as well as some sample code.

www.lancos.com: Here you can download PonyProg, the program required to transfer your compiled source to your ATmega board and instructions on how to build a hardware programmer. Available for PC and Linux.

www.http://savannah.nongnu.org.com: UISP(Micro InSystem Programmer) is a neat little program you can also use for programming your ATmega board. It is available for Debian Linux via apt-get.

www.mit.edu: Here you can download the dmg file to install AVR GCC and UISP on a Mac. You need MacOS X 10.3 or higher. There’s additional information on how to connect your Mac to a serial programmer. If the link is out of order you can download the dmg here.

www.TechnologicalArts.com: The source for Motorola boards. Read the board specifications carefully and get what only what you need. Its easy to go overboard. And get the apropriate BDM pod, you won’t regret it. The BDM pod will let you directly inspect the device memory, that comes in handy during debug.

www.RabbitSemiconductor.com: These guys get honorable mention. I’ve seen one mouse running with their board and it worked well. Its easy to setup and use but pricey.

Sensors

Mouse needs sensors to see. You have two choices. You can use a look down sensor such as the Fairchild QRB1113/1114 or triangulation types such as the Sharp GP2D12. The lookdown sensors have a quicker response than the triangulation types but need more hardware setup. However, once the hardware is in place the lookdown sensors are easier to setup in software than the triangulation types. Both kinds can be purchased online at places like www.acroname.com and www.digikey.com. Below is some specific information to help you out.

Look Down Sensors:

You can use the following circuit to control the current going through your diodes. The current flowing through the diodes and the resistor is going to be Vref/R. Using a larger power supply and placing the diodes in series is the way to go. In addition, you can pulse the Vref node to push larger amounts of current through your diodes to improve your SNR. Be careful or you’ll burn out a sensor.

Triangulation Sensors:

These sensors are quite noisy. However, since the average value of (thermal) noise is ideally 0 you can take several samples and average them to get the noise out. However, be careful because spikes can throw your average off. A great deal of experimentation is need to linearize these sensors, check out this link from www.acroname.com for more information.

Here is some sample code for the ATmega128 that reads in from Analog Channel 0, linearizes some, and outputs the the average of 5 readings to PORTA.

This is another snippet I worked on that samples Analog Channels 0, 1, and 2 and does some spike removal by comparing each value sampled with the previous. Function SensorClean() to do the spike removal is not complete, but there’s enough for you to work with.

Check back soon, I might add some more code to help with the setup.

Motors

Stay away from using DC motors unless you have a lot of time to invest in getting them to work. Yes, they are faster but they also require a level of expertise and setup that is out of reach for most teams. The best motors to use are called stepper motors. They are quick enough and easy to control. The one brand I recommend is the Vexta brand. Check E-bay and Google around for them. They are well built, sturdy, and put out good torque. Check out this link to see how stepper motors work and how to wire them up. The best way to set up bipolar stepper motors is to wire them up using the L293D H-bridge chip in the following fashion or if the site is down, here is a pdf I grabbed. Or spend some dinero and order this PCB I put together using ExpressPCB. You can order the PCB through the ExpressPCB software. Check out chopper motor drive for even more fun.

Batteries

You want batteries that will deliver power and last a while. Simple rechargable NiMH 2000mAh or higher AA cells work well. Stack as many cells as your board regulator can handle to give your motors torque and speed. Another good choice is this from All Electronics. Leftover cell-phone batteries, don’t forget the charger. Contact me if you find any other good batteries.

Wheels

Your mouse isn’t going to go anywhere without wheels. Most MicroMouse designs have two wheels and a third pivot wheel in the middle to keep it from tipping over. A good pivot wheel as well as regular wheels can be obtained from www.pololu.com. Another good choice for wheels are aluminum ones that are used for model aircraft landing gear. They usually have a set-screw so you can size them to fit your axle.

Programming

Programming is the meat and potatoes of the MicroMouse. Without programming all you have is a paperweight. To get the mouse to solve a maze go investigate Flood-Fill, there’s enough papers out there that I’m not going to bother with its description. It is an algorithm designed to solve the maze on the first run. Implement your sensor code as an interrput so your mouse doesn’t start to lag. Here is some source to get you started, courtesy of DrTak.org. It is written for the ATmega128 processor. In particular take a look at testStepper.c to get started with driving your stepper motors. Pay attention to the license.

Links

Links, Links, everybody likes links.

A big fat movie involving many MicroMouse robots.

This person wrote a whole big report on his MicroMouse. Its pretty useful for hints on how to set up the sensors and how to size your mouse. If the link is dead, download a local copy.

Loughborough University MicroMouse page. Full of useful information.

UK site on MicroMouse. Very in-depth on general topics.

Please contact me if you have more links or videos you’d like to put up.

Written by M Kapoor

December 21, 2009 at 2:54 am

Leave a comment