3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.


Maze Solving Robot

Maze Solving Robot






In this instructable I will be showing you how to build a maze solving robot. This is actually my 3rd attempt at making one. The first was a complete failure. The second was alright at finding the end of the maze, but it could not go back and drive the quickest path. This is my current and 3rd one. It is able to find the end of the maze and then, when put back at the start, drive the shortest path to the end of the maze without going down any dead ends. What surprises me is that it really does not mess up. 

This was just a short introduction, everything else from theory, building, and programming will be explained in later steps. 

Parts list:

General Parts:
  • 3 1in Spacers (Home Depot)
  • Bolts and nuts that fit the spacers (Home Depot)
  • Hook up wire (I use 22 gauge)
  • Solder
  • .100" Female and Male headers
  • Velcro

Tools:
  • Soldering Iron
  • Philips Screw driver
  • Wire Strippers
  • Something to cut the wire with
 
Remove these adsRemove these ads by Signing Up
 

Step 1The Theory Part 1

The Theory Part 1
What are the steps In maze solving?
There are basically 2 steps. The first is to drive through the maze and find the end of it. The second is to optimize that path so your robot can travel back through the maze, but do it perfectly with out going down any dead ends.

How does the robot find the end of the maze?
I use a technique called the left hand on the wall. Imagine you are in a maze and you keep your left hand on a the edge of the wall at all times. Doing this would eventually get you out of a non-looping maze. This instructable will only deal with mazes that do not loop back on themselves.

This left hand on wall algorithm can be simplified into these simple conditions:
- If you can turn left then go ahead and turn left,
- else if you can continue driving straight then drive straight,
- else if you can turn right then turn right.
- If you are at a dead end then turn around.

The robot has to make these decisions when at an intersection. An intersection is any point on the maze where you have the opportunity to turn. If the robot comes across an opportunity to turn and does not turn then this is consider going straight. Each move taken at an intersection or when turning around has to be stored.

L = left turn
R= right turn
S= going straight past a turn
B= turning around

So let us apply this method to a simple maze and see if you can follow it. View the photos to see this method in action.
The red circle will be the robot.  

As you can see in the photos for this example, the final path is LBLLBSR.
« Previous StepDownload PDFView All StepsNext Step »
39 comments
May 13, 2012. 3:29 PMmuno1 says:
So I wrote some code to test the sensors and I realized that the sensors are not sending any signal back to the microcontroller. So I removed the sensor from the design and I put on 5V from the board and the ground from the board and put the entire senor on a piece of black tape (for it to set all of the outputs to around 5V) then I put an led on each hole and realized that it isnt lighting up at all. Is it an adequate conclusion to come to that the sensor is defective? Thanks again for all the help.
May 12, 2012. 6:52 PMmuno1 says:
I have finished building the design with the same motors and chips you have used except I used an arduino uno. but I am running into issues when I first put in the power both motors go forward about an inch and then stop. I am not sure what to do to solve this issue I have it on a straight black tape maze right now just to see if it is working but I am not sure what could be the issue, is there any way to test if the sensors are working or any way to isolate the problem, and as always thank you for your help.
Apr 17, 2012. 3:34 AMmuno1 says:
thank you for this posting first and foremost, I was wondering do I have to have the same gear ratio or will any two motors work (i want to maintain your code to be consistent), also will the same code work on a arduino uno...Thank you very much for your time :)
Apr 22, 2012. 6:38 PMmuno1 says:
Thanks for the help your designs are well thought out and I appreciate it.
Apr 7, 2012. 1:44 PMmr.kitux says:
Next step could be to change L for R and R for L so it would come back to the start by itself and then go back to the goal through the shortest path :)
Feb 24, 2012. 1:53 PMpingpongkid5 says:
We purchased the motor controller that you suggested (http://www.sparkfun.com/products/9457), and we are now having trouble deciding which holes are corresponding on the two boards (yours that you made personally and the one on Sparkfun). Could you please tell me which hole on your board corresponds to which hole on my board? Such as In-1A = AIN1 or something like that. Thank you.
(an image of my board is attached)
Feb 22, 2012. 7:40 PMpingpongkid5 says:
A couple questions.
1. What happens when you plug it in? Should some kind of software or something pop up? Does it need to be a mac or windows or can in be both?
2. does the arduino need power when it is connected for the program to be put on it?
3. Is there alternate software I need to read this code or put it on the arduino?
Feb 16, 2012. 6:55 PMpingpongkid5 says:
Is there an alternative site to get this board? Or would you happen to have an extra? I need this for a school project and the guy at Dorkbot will not respond to my order. Thanks.
Feb 18, 2012. 7:01 PMpingpongkid5 says:
Thank you very much. Is the schematic any different?
Feb 6, 2012. 1:51 AMjanoo4u says:
Can we use Arduino UNO instread of freeduino.
If yes then can u explain PIN Diagram.
Jan 25, 2012. 5:41 PMpingpongkid5 says:
How do you add the code to the arduino? Like how is it connected to the computer?
Nov 9, 2011. 5:08 PMfrafi1 says:
i need help, i think i'd prefer buying the motor driver, so how about this?? http://www.pololu.com/catalog/product/713 and can i use regular DC motors with these??

and could you tell me how to connect this motor driver to the arduino (the same way you told in step 8)and about the DC motor..

plz reply soon, i want to do this robot very soon..
thank you
Oct 25, 2011. 6:25 AMfrafi1 says:
hi. I dont get the exact parts which you used. firstly, can i use a arduino uno instead of the one which you used?

can i use regular DC motors? (http://www.rhydolabz.com/index.php?main_page=product_info&cPath=121&products_id=815)

and can i use a motor driver (http://www.rhydolabz.com/index.php?main_page=product_info&cPath=108&products_id=858)

if yes, could you please guide me through the process, it would be of great help.
thanks
Oct 25, 2011. 1:28 AMfrafi1 says:
can i use a arduino uno to do this project..
and could you plz tell more specifically how to make the motor controller?
Oct 10, 2011. 5:01 PMrmartin27 says:
How long does it take to build this robot?
Jul 26, 2011. 12:11 AMBeFit says:
Great work!
Jul 22, 2011. 10:58 AMjobard says:
What happens if after the first recognizing run, you place it in a different start location?
Jul 21, 2011. 7:10 PMblinkyblinky says:
Nice. How do you reset it if you want it to go the long way agaibn AFTER it has calculated the shortest path.? Nice, though.
Jul 14, 2011. 3:29 PMkimvellore says:
Nice concept. Thank you for explaining in detail. I enjoyed reading it.
Jul 6, 2011. 2:23 PMhyruler_ says:
that is awesome
Jul 6, 2011. 11:36 AMmaximeke2 says:
Can you please give me some information about your sensor? Does it use LEDs or infrared, and also the type/datasheet of emitter/transmitter?
Jul 6, 2011. 12:15 PMmaximeke2 says:
oops... I was just looking for the sensor and didn't read it. Sorry about that
Jul 4, 2011. 11:00 AMerror32 says:
I have used some parts from the pololu store before. Very good quality!
Though i personally liked it better to make my own PIC based board instead of the too easy arduino solution.
Jul 3, 2011. 9:47 PMSHIFT! says:
This is a great 'ible, but you forgot the most crucial thing- The Title! Please name this project soon!

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
20
Followers
2
Author:patrickmccb(Click here to visit my website)