Today we are going to learn how to make a maze solving robot! We will first talk about how to make the circuit on your robot that will allow you to use your bumpers. After creating the circuit you want to start phase 2 which is building the bumpers for your robot which will help it navigate through a maze since the robot does not have any eyes. After planning and building your bumpers you want to design a code which will help your robot solve the maze, now lets begin!
Step 1: Build Your Circuit
The first step in order to build a robot that will solve a maze, you want to create a circuit that will allow your robot to use the bumpers.
Building the circuit for your bumpers is fairly simple, as you can see in the picture above, there are 2 LED's these are placed in the circuit because it will help us test to see if the bumper is working or not and this part is completely optional. You can build this circuit by following the diagram above and you can also look at the pictures provided.
Step 2: Creating the Bumpers!
Step 3 is to create an attachment for your boe-bot, in this case we want to create bumpers for it. First you want to grab a bunch of Popsicle sticks, aluminium paper, masking tape, wires and a sponge. There a lot of steps required in order to build this bumper, to make it easy for you to follow I have prepared a step by step presentation that you can follow to create your own bumpers for your robot. Here is the link: Presentation!
Step 3: Part 1 for Creating Bumpers
Step 1: You want to add two Popsicle sticks and place them in your robot as shown in the picture below.
Step 4: Part 2 for Creating Bumpers
Step 2: You want to add a wire that is connected on your circuit to your Popsicle stick. You want to connect the green wire shown below to one of the Popsicle sticks and wrap it along the Popsicle stick until the end as shown in the picture. Repeat the same step with the blue wire but on the other Popsicle stick
Step 5: Part 3 for Creating Bumpers
Step 3: Next you want to wrap aluminium paper around the Popsicle stick as shown in the picture above
The reason why we are doing this is because aluminum paper is a good conductor which will help us transfer the signal later.
Step 6: Part 4 for Creating Bumpers
Step 4: The next step is fairly simple, you want to attach two more Popsicle sticks in the exact position as shown in the picture and make sure that they are taped down so they wont move.
Step 7: Part 5 for Creating Bumpers
Step 5: The next step is to add a Popsicle stick between the two you just added but this time it should be facing upwards as shown in the picture be sure to tape it down so it is secure.
Step 8: Part 6 for Creating Bumpers
Step 6: The next step is to connect the wires as shown the picture below where the two black wires are connected to Vss you want to bring both those wires and place them downwards. You want to bring one wire and place it under each Popsicle stick on each side as shown in the picture beside to the right.
Step 9: Part 7 for Creating Bumpers
Step 7: Next you want to make sure that you tape the wires from the top so they won't move around and you also want to tape the wires onto each end of the Popsicle stick but make sure you allow enough wire to curve around the outer two Popsicle sticks.
Step 10: Part 8 for Creating Bumpers
Step 8: Next you want to wrap aluminum paper around the wire as shown is the picture to the right so it is easier to conduct and you have a better chance and connecting the wires as more surface area is there.
Step 11: Part 9 for Creating Bumpers
Step 9: The final step to building your bumpers is to add some sponge on the bottom of the middle two Popsicle sticks and be sure to hot glue the sponge on. Also add sponge to the outer aluminum paper as shown in the picture to make sure that when the robot pushes it will come back into position after.
Step 12: How Your Robot Should Look Like
Once you completed building your bumpers your robot should look something similar to this.
Step 13: Test Code
This right here is a quick code I made to see if each bumper is working, that way before I code I can make sure it is working and avoid fixing this problem later. What this code does is it checks if the the bumper is hit and it should turn on one of the LED's, and when the other bumper is hit it should turn on the other Led. When both bumpers are hit it should turn on both LED's and when it stops making contact with the bumper, the LED should turn off.
Step 14: Building the Code
Here is a picture of my code to test to see if the bumpers are working. The code is provided in the pictures shown above. To build this code the first step is to define which pins the Motors are connected to. You want to define which variables are going to be the motor. Next you need to state all your speeds that the motor will spin at, the speed on each wheel will determine if the robot will go forward, backward, right, or left. Once you have the basics down onto your code, you can now start coding for the robot to solve the maze. First off you want to make your robot keep on moving forward until one or both of the bumpers hit something. To do this you want to make a Do Loop and place all your commands inside of it telling it what to do. So if your right bumper were to hit you want the robot to move back and turn left so it can move on and does not bump into that spot again. If your left bumper were to hit you want your robot to move back and turn right so it does not bump into that spot again. If both your bumpers hit you want it to move back and for it to turn left or right depending on which way is needed. All this can be done by "If statements" to check if any of the bumpers is hit or not. You must define each variable in order for it to be placed in the if statement, for example:
For MLoopC = - to --
Pulsout Lmotor, LRev
Pulsout Rmotor, Rfast
You need to classify each command in order to just type Turn Right in your main code.
Here is a link to my code to see a clearer an bigger picture: Clear Picture of Code!
Step 15: Robot Going Through the Maze!
Here is a video of my robot going through a maze!