Introduction: Make a Maze Runner Robot
Maze-solving robots originate from the 1970s. Since then, the IEEE has been holding maze solving competitions called the Micro Mouse Contest. The aim of the contest is to design a robot that finds the midpoint of a maze as quickly as possible. The algorithms used to quickly solve the maze typically fall into three categories; random search, maze mapping, and right or left wall following methods.
The most functional of these methods is the wall following method. In this method, the robot follows the right or left side wall in the maze. If the exit point is connected to the outer walls of the maze, the robot will find the exit. This app note uses the right wall following method.
This application uses:
- 2 Sharp analog distance sensors
- Tracker sensor
- Motors and motor driver
- Silego GreenPAK SLG46531V
- Voltage regulator, robot chassis.
We will use the analog distance sensor to determine the distances to the right and front walls. The Sharp distance sensors are a popular choice for many projects that require accurate distance measurements. This IR sensor is more economical than sonar rangefinders, yet it provides much better performance than other IR alternatives.
There is a nonlinear, inverse relationship between the output voltage of the sensor and the measured distance. The plot showing the relationship between the sensor output and the measured distance is shown in figure 1.
A white line against a black color ground is set as the target. We will use the tracker sensor to detect the white line. The tracker sensor has five analog outputs, and the outputted data is influenced by the distance and the color of the detected object. The detected points with higher infrared reflectance (white) will cause a higher output value, and the lower infrared reflectance (black) will cause a lower output value.
We will use the pololu wheel encoder to calculate the distance the robot travels. This quadrature encoder board is designed to work with pololu micro metal gearmotors. It functions by holding two infrared reflectance sensors inside the hub of a Pololu 42×19mm wheel and measuring the movement of the twelve teeth along the wheel’s rim.
A motor driver circuit board (L298N) is used to control the motors. The INx pins are used to direct the motors, and the ENx pins are used to set the speed of the motors.
Also, a voltage regulator is used to reduce the voltage from the battery down to 5V.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Algorithm Description
This Instructable incorporates the right wall following method. This is based upon organizing direction priority by preferring the rightmost possible direction. If the robot cannot detect the wall on the right, it turns to the right. If the robot detects the right wall and there is no wall in front, it goes forward. If there is a wall to the right of the robot and the front, it turns to the left.
An important note is that there is no wall for reference after the robot has just turned to the right. Therefore “turning right” is accomplished in three steps. Move forward, turn right, move forward.
In addition, the robot must keep its distance from the wall when moving forward. This can be done by adjusting one motor to be faster or slower than the other. The final state of the flow chart is shown in figure 10.
A Maze Runner Robot can be very easily implemented with a single GreenPAK configurable mixed-signal IC (CMIC).
You can go through all steps to understand how the GreenPAK chip has been programmed to control Maze Runner Robot. However, if you just want to easily create the Maze Runner Robot without understanding all the inner circuitry, download GreenPAK software to view the already completed Maze Runner Robot GreenPAK Design File. Plug your computer to the GreenPAK Development Kit and hit program to create the custom IC to control your Maze Runner Robot. The next step will discuss the logic that is inside the Maze Runner Robot GreenPAK design file for those that are interested in understanding how the circuit works.
Step 2: GreenPAK Design
The GreenPAK design consists of two parts. These are:
- Interpretation / processing of data from distance sensors
- ASM states and motor outputs
Interpretation / processing of data from distance sensors
It is important to interpret the data from the distance sensors. The robot’s movements are deliberated according to the distance sensors outputs. Since the distance sensors are analog, we will use the ACMPs. The position of the robot relative to the wall is determined by comparing the voltages of the sensors with the predetermined threshold voltages.
We will use 3 ACMPs;
- To detect the front wall (ACMP2)
- To detect the right wall (ACMP0)
- To protect the distance of the right wall (ACMP1)
Since ACMP0 and ACMP1 depend on the same distance sensor, we used the same IN+ source for both comparators. Constant signal change can be prevented by giving ACMP1 25mv of hysteresis.
We can determine the direction signals based on the ACMPs’ outputs. The circuit shown in figure 12 depicts the flow diagram outlined in figure 7.
In the same way, the circuit which indicates the position of the robot relative to the right wall is shown in figure 13.
ASM States and motor outputs
This application utilizes the Asynchronous State Machine, or ASM, to control the robot. There are 8 states in the ASM, and 8 outputs in each state. The Output RAM can be used to adjust these outputs. The states are listed below:
- Move away from the right wall
- Close to the right wall
- Turn Left
- Move Forward-1
- Turn Right
- Move Forward-2
These states determine the output to the motor driver and direct the robot. There are 3 outputs from the GreenPAK for each motor. Two determine the direction of the motor, and the other output determines the speed of the motor. The motor movement according to these outputs is shown in the following tables:
The ASM Output RAM is derived from these tables. It is shown in figure 14. In addition to the motor drivers there are two more outputs. These outputs go to the corresponding delay blocks to allow the robot to travel a certain distance. The outputs of these delay blocks are also connected to ASM inputs.
PWMs were used to adjust the speed of the motors. The ASM was used to determine what PWM the motor would run on. The PWMA-S and PWMB-S signals are set to the mux select bits.
In this project, we created a maze-solving robot. We interpreted data from multiple sensors, controlled the robot’s state with the GreenPAK’s ASM, and drove the motors with a motor driver. Generally, microprocessors are used in such projects, but a GreenPAK has a few advantages over an MCU: it is smaller, more affordable, and can process the sensor output faster than an MCU.