Autonomous Line Maze-Solving Robot

Small robot that will be able to map out the shortest possible to the finishing point utilizing Flood Fill algorithm (Micromouse)

Similar projects worth following
Using a Pololu 3pi robot, I will attempt to autonomously traverse a self-made line maze and find the shortest possible path to the finishing point using Flood Fill algorithm. The maze will include obstacles such as dead ends and infinite loops so that the robot will not be able to find the finishing point simply with left or right hand maze-solving algorithms. After mapping out the shortest path, the robot will traverse the maze one final time with better speed and maneuvering to cut time off its run.


The goal of this project was to create an autonomous line maze solving robot with inspiration from the Micromouse maze solving competition. The algorithm of choice for mapping the maze and solving for the shortest distance to the end was the Flood Fill algorithm. Flood fill allows the robot to set and update the distance from any point in the maze to the end as it collects information on walls, dead ends, etc. Once it maps the entire maze, the shortest path is revealed. The implications of such technology extend to areas such as autonomous driving, area mapping, search and rescue, and even teaching. To complete my task, I utilized a modified Pololu 3pi robot with optical encoders and high power gearmotors. I used the Arduino programming language and software to code the 3pi. I designed my own line maze, a 16 x 12 grid with 3” x 3” grid squares. My goal was to traverse this maze within 15 seconds. The flood fill code is currently a work in progress. The provisional code uses a left wall following algorithm which allows the robot to solve mazes without infinite loops.


The goal of my project was to create a robot that is capable of mapping out an unknown maze and then navigating the shortest possible path through the maze in the least amount of time. The idea for this project was based off of the Micromouse competition, and the robot and maze were designed and built with the secondary goal of following Micromouse competition regulations so that the robot could theoretically compete. Micromouse is an event in which small, mice-like robots are placed into a 16 x 16 maze and must autonomously map and solve it. Outside of the niche of Micromouse competition, it seems that many robotics hobbyists as well as university research teams are looking at different methods and algorithms for maze mapping and solving. Research into this topic has the potential to be applied to a wide variety of academic subjects as well as everyday life.


The concept of having a robot map a foreign environment can be applied to numerous real world functions. For example, self driving cars need to have the ability to detect shifts in a constantly changing environment and adjust accordingly. While a self driving car does navigate on mapped roadways, the constant variability in factors such as surrounding vehicles, obstructions, and traffic patterns are circumstances in which an autonomous vehicle’s response time and efficiency must be well tested.

Similarly, mapping technology could also be applied to robots that map caves, explore new areas, or perform search and rescue operations. In scenarios such as these, the algorithm in play influences the robot’s ability to create accurate, whole pictures and the speed in which it can do so. It can also affect variables that are not necessarily present or entirely the same as in testing and research, such as the safety of the vehicle.

The idea of finding the shortest possible path is also very important in a variety of fields. The algorithm I initially planned to use, Dijkstra’s algorithm, is not just limited to the function of finding the shortest path. In computer science, optimization of a program is a key component just as traversing the shortest possible distance in a maze is. A faster program means less processing power and less time needed to execute. Translated into real life, optimization of anything equates to a more efficient use of time and resources.

Autonomous technology can additionally be utilized in the classroom setting. There has been a push to introduce amateurs and beginners to the fundamentals of robotics through Micromouse-esque competitions. This type of project combines many skills such as CAD, electronics work, construction, and programming, all while keeping the designer engaged with the desire to perform well in competition as an incentive. However, such technology can expectedly be expensive for schools and learning programs to afford, and...

Read more »


CAD of maze layout

AutoCAD DXF - 16.54 kB - 03/13/2018 at 15:10


  • 1 × Pololu 3pi robot
  • 2 × Motors 30:1 Micro Metal Gearmotor HP 6V with Extended Motor Shaft
  • 2 × Encoders Optical Encoder Pair Kit for Micro Metal Gearmotors, 5V
  • 1 × Black 3/4" electrical tape
  • 4 × 22" x 28" white poster board

  • update 6; final update

    lbinder06/01/2018 at 01:30 0 comments

    I achieved the majority of my goals either entirely or to some limited degree. My overarching goal of creating a robot that could map mazes and solve them by traversing the shortest path was only partially realized. I was able to implement a more basic algorithm, the left wall follower. However, this algorithm only allowed the robot to solve mazes without loops and lacked any mapping capacity. As a result, the robot could complete the maze when placed in very specific starting locations, but it could not complete the maze from the true starting point. Unfortunately I was unable to successfully implement the flood fill code to the 3pi. I was successful in keeping the cost below $150, with an estimate of around $132. More than half of this cost stemmed from the standard 3pi robot. Had I designed my own robot, I certainly would have been able to decrease the total cost even further. I also accomplished all of my goals regarding maze design and construction. I was satisfied with the complexity of my final maze design, and although I knew it would be difficult to create a perfectly accurate sized and neat maze, my work on that was as much as I could have hoped for. The installation of functional encoders onto the 3pi was an additional success. This seemed to be a choke point in terms of project completion for other similar projects that I found online, so I am glad that I was able to get them working. Although I was not able to extensively test the encoders with maze run throughs, they provided ideal output readings when hooked up to an oscilloscope.

    There are various improvements and additions that could be made for this project. The addition of the encoders introduced some issues with motor values for turning because the wheels were pushed further out from the robot body. Also, there was a lack of digital I/O lines on the 3pi itself, so I could only attach one encoder, in this case, the left wheel encoder. This affected my ability to take accurate encoder readings. The Arduino software also posed a challenge as it was difficult to debug my code. The flood fill algorithm could also be improved upon since it returns the shortest path distance wise, but not necessarily time wise. My maze design, however, would not have encountered this type of problem even had the code been functioning. Some other improvements that could be made include implementing flood fill first in Java and then translating into Arduino so I could debug beforehand in the jGrasp software, and create my own robot so that I could have more I/O lines available for customization.

  • update 5

    lbinder04/16/2018 at 23:36 0 comments

    I have now finished soldering my encoders and I am in the process of making sure the motors are still properly functioning and testing if the encoders work. Once I am done with this, I can move on to coding the maze mapping algorithm.

  • update 4

    lbinder03/13/2018 at 15:12 0 comments

    I have since completed construction of the maze and tested the robot's basic functions such as turning in the maze. I also decided that I want to use flood fill rather than Dijkstra's algorithm to map the maze. I am now in the process of installing encoders onto the 3pi.

  • Update 3

    lbinder01/07/2018 at 18:16 0 comments

    Since my last update, I have tested and confirmed that the basic functionalities for my 3pi robot are working fine. I am now in the process of sketching out my maze design onto the poster board and will tape it over once I am done. I have also looked at what I will need to do in order to switch out the existing 3pi motors for my own, and will be ready to solder them as soon as I am finished with the maze construction.

  • Update 2

    lbinder12/05/2017 at 00:21 0 comments

    I've since finished the design for the maze, and will begin construction as soon as my materials arrive. I'm also waiting for the motors and encoders to modify my 3pi robot for this project. In the meantime, I have added the 3pi libraries to Arduino and I am starting to code the 3pi to perform basic tasks involving maze solving, so I can become more familiar with the technology.

  • Update 1

    lbinder11/03/2017 at 03:45 0 comments

    I have now determined the methods I will use to both map out the maze and find the shortest path to the finish point. I have also placed my parts orders necessary for modification of the 3pi to complete the goal of this project. In addition, I have begun designing the maze on Autodesk Fusion 360.

View all 6 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates