This project combines the capabilities of Raspberry Pi 4B and Arduino Uno microcontrollers to create an innovative maze-solving robot. Using OpenCV for image processing and implementing the breadth-first search (BFS) algorithm on the Raspberry Pi, the robot intelligently navigates a ball towards the maze’s exit. Servo motors controlled by the Arduino are employed to manipulate the ball's movement through complex mazes.
This project was completed as part of the Final Project, Spring 2024 at the New York University, Tandon School of Engineering.
- OpenCV for Image Processing: Processes images to detect the ball's position and maze walls.
- Breadth-First Search (BFS) Algorithm: Used to find the optimal path through the maze.
- Arduino Integration: Controls servos to execute movements based on navigation commands from the Raspberry Pi.
- Real-Time Maze Solving: Continuously tracks the ball’s position and recalculates its path through the maze.
- Develop a reliable ball detection algorithm using OpenCV to accurately identify the ball’s position and differentiate maze walls from the base.
- Implement preprocessing techniques for maze detection.
- Use contour detection to precisely locate the ball in the maze.
- Employ the BFS algorithm to plan the optimal path through the maze.
- Use Arduino-controlled servos to physically manipulate the ball based on commands from the Raspberry Pi.
- Establish a communication protocol between the Raspberry Pi and Arduino for seamless data exchange.
- Raspberry Pi 4 Model B (4GB): Handles image processing and path planning using BFS.
- Raspberry Pi Camera Module v1.3: Captures images of the maze for processing.
- Arduino Uno: Controls servo motors to manipulate the ball's movement.
- MG996R Servo Motors: Precisely control the ball's rotation across two axes.
A series of image processing techniques are employed using OpenCV:
- Image calibration and cropping to focus on the maze.
- Color space conversion and masking to enhance ball detection.
- Ball localization using the Hough Circles Algorithm.
The maze is represented as a graph where each cell is a vertex and passages between cells are edges. The BFS algorithm is used to explore the maze and find the optimal path from the start to the exit.
- The Raspberry Pi captures an image of the maze and processes it to determine the ball’s position and solution path.
- Based on the relative position of the ball, the Raspberry Pi sends movement instructions to the Arduino.
- The Arduino then controls the servos to manipulate the ball according to the instructions.
The following schematic illustrates the connections between the Raspberry Pi, Arduino, camera module, and servo motors used to control the maze-solving robot:
Fig 1: Circuit schematic showing the connections between Raspberry Pi, Arduino, camera, and servos.
The system successfully detects the ball and navigates it through the maze using the BFS algorithm. Below are the captured images showing different stages of the process:
Fig 1: Image captured from RPi Camera |
Fig 2: Image highlighting the detected ball |
Fig 3: Solution path determined by the BFS algorithm |
- Stewart Platform: Integrating the robot with a Stewart platform (hexapod) and an improved camera could enhance dynamic positioning.
- Optimization of Path-Planning Algorithms: Further refinement of algorithms could allow the robot to adapt to dynamic maze patterns.
- Machine Learning: Integrating machine learning techniques could improve image processing and ball detection.
This project currently does not have an associated license.