Maze Solver Robot(Machine Vision).

Project overview and inspiration.

I based this project on my final year dissertation project. The main goal of the project was to create a pathfinding robot its purpose being to navigate all sections of a maze. I achieved this by using elements of machine vision so that the robot can understand its environment, and using the algorithm I designed, navigate its environment. The equipment used was a raspberry Pi model 3 b which carried out all the calculations and directed the robot. At the same time, the parallax activity board acted as the body of the robot. In which the parallax activity board receives signals from the raspberry pi which drove the motors connected to the parallax activity board.

How it works.

Lane Detection.

The robot works by obtaining images from its environment and transforming the image received into a binary image using HSV colour space. Depending on the colour of the tape used, I created an interface in which the user can use sliders to make the robot detect the colour of the lane which the user has put.


Using various static points of interest I had put on the image, the robot uses these points of interest to correct itself if it strays off the lane. The type of algorithm used to navigate the maze is the right-hand rule algorithm. When the robot is using the right-hand rule, it is guaranteed to visit all sections of the maze and find the exit of the maze. However, there should be no closed loops within the maze, and the exit is not at the centre of the maze.

Shape Detection.

The primary purpose of implementing a shape detection algorithm was to detect the end of the maze, which halts all operations of the robot. Using OpenCV's track bar and Image contouring, the shape is detected depending on the number of edges. The shape can be of any colour can be set using an interface, as shown below.

Robot movement trial maze

The following video demonstrates the robot automatically solving the maze without prior knowledge of the maze. The robot utilizes the right hand rule algorithm to solve the maze.

How to install/Project Source Code.

How to install and run the software can be found here

Tools Used.

  • C++ code base.
  • Python Code base.
  • OpenCV.
  • PiCamera.
  • RPi.GPIO.
  • SimpleIDE.
  • Numpy.

Design Flowchart.

Raspberry Pi System Flowchart.

Activity bot Design Flowchart.