Our task is to build an mBot robot capable of navigating a maze in the shortest time possible. Along the route, the robot will encounter colored tiles that indicate the next direction it should take to successfully move through the maze. The maze is bordered by walls that the robot must detect and avoid while progressing toward the goal.
Pictures of our mBot project:
![]() |
![]() |
|---|---|
| Left side (Infrared sensor) | Right side (Ultrasonic sensor) |
Our robot is designed to navigate a maze similar to the one depicted below. It must avoid colliding with any walls, marked by blue lines along the sides.
During its journey through the maze, the robot will encounter waypoint challenges marked by black strips on the maze floor. Each waypoint challenge consists of a colored tile on the floor, with five possible colors: red, orange, green, blue, and purple. Each color instructs the robot to execute a specific turn to continue navigating the maze correctly.
At the end of the maze, the tile beneath the mBot at the final waypoint will be white, signaling the maze's completion.
The following are the hardware connections to the mBot for our program to run correctly.
| Motor connections | mBot sensor connections | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
Calibrate the color sensor first, this is done by running the code under the color_calibration folder, which is color_calibration.ino. Here, we simplify our worflow by reading the voltage value of whiteArray and blackArray directly and then use the formula greyDiff[i] = whiteArray[i] - blackArray[i] to calculate manually. And then input the blackArray value and greyDiff value into the project.ino. (We can test the accuracy by decomment this line)
Then run the main program, project.ino. Ensure that all other files a_utility.ino, b_navigation.ino, c_peripherals.ino, d_sensor.ino, and e_test_func.ino are set as tabs within the main ino file so that they compile together seamlessly. Verify that these files are correctly recognized as tabs to avoid any compilation errors.
The full explanation of our robot implementation can be viewed in our group report here.
The moving straight algorithm enables the robot to navigate the maze even in the absence of walls. It accomplishes this by making real-time adjustments to the robot’s movements based on input from the ultrasonic sensor, which detects pillars within the maze. These sensor readings allow the robot to apply corrective actions and stay on course.




