Introduction: Maze Solving Boe-Bot
Hello! My name is Maahum Imran.
I am part of a grade 11 Technology class. We were challenged with an assignment to take our Boe-Bot's and program it to go through a maze skillfully. This was a tough challenge at first, and I'll admit, without the help of my peers, I might have stayed lost for a while.
Nonetheless, I choose to use Infrared Sensors. Mostly to avoid having to create bumpers when these are already made, you just have to program them.
This project took me a while and many failed attempts. It is not completely perfect, but I will continue to work on it hoping to get it to be even smarter.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: The Circuit Set-up
As you can see, I used the Infrared Sensors. The wires may look crazy, but the logic of setting up the circuit is pretty basic and easy.
You will need:
- 1K Resistor (x 3)
- 220 Resistor (x 3)
- 330 Resistor (x 3)
- 3 Sensors
- 3 Infrared LED
- 3 LEDS
The construct is pretty simple. You connect the resistors to the pins (if you're using the motors then you cannot use the motor pins). The 1K resistor connects to the positive end of the Infrared LED. The 220 resistor connects to the end of the sensor. The third (right) side of the sensor. This way you can send frequency through the 1K resistor and the sensor will pick it up and send the signal back in which you can reference in the code.
The middle of the sensor connects to the negative side of the Infrared LED. then, both ends connect to the VDD (the +V). This way if the sensor is not sensing anything, the current can flow back. Last but not least, the first (left) side of the sensor connects to the VSS (0V). That way any current flowing through will go to ground If the LED is sensing something.
You repeat this construct for all three sensors and Infrared LEDs. To check if the LED's are working, you can sync the LEDs to the sensors, so when the sensor senses something, the LED turns on. It makes it easier to test. The construct for LEDs is very simple. You use the 330 resistor to connect to a pin. Then that connects to the positive side of the led. and the negative side of the LED connects to VSS (ground). In my example, to maximize space, I used a construct of wires to directly go to each LED, then to ground. Connecting all three LEDs to one port of the VSS.
There is a circuit diagram above to help you create the build shown above as well.
Step 2: Getting the CODE!
Explaining the code is very tricky to do. There are comments in my code that tell you what every line says so that you won't be lost. But the basic idea is that:
- if nothing is sensed; go straight
- if the left and/or middle sensor are sensed; go right
- if the right and/or middle sensor are sensed; go left
- If all three are sensed; go left first, if no wall, continue. If there is a wall, then turn 180 (initially) right
This way I can get the robot to move basically through the maze.
I have also synced my LEDs to turn on or off based on what is being sensed. This way I can see how my robot is picking up on things, even when it is going in the maze. It tells me what it sees, which is pretty cool and I HIGHLY recommend to use this technique for testing.
The pictures at the top are very blurry and small. If you would like a better look at the code, click the link to be sent to a google doc, that contains the same pictures at a much readable size
This other google document is a link to the code in a document if you would like to read it better.
Step 3: TEST the Code (in Maze As Well!)
The first video shows how the LEDs work when my hand was purposefully in front of the sensors. Showing, that the sensors work and can sense properly. After we had tested to make sure it worked, we put it to the test in a maze!
I hope you enjoyed this instructable on how to make a robot go through a maze! Thank you!