Note: This instructable documents a robot made by my younger brother. He is 11 years old, so this is an entry in the "Under 12" category of this contest. I will do my best to transcribe his description from here on out.
Hi. This is the first working robot I have ever made. I made it for a merit badge for Boy Scouts. I used a Lego Mindstorms kit to make the robot.
For the merit badge, the robot was supposed to follow a black line on the floor, then sense if an object was in the way on the path. If there was an object in the way, the robot was supposed to knock the object out of the way somehow. I could have made any kind of robot to follow the line. It could have driven on a string or rope, or moved like a worm, or walked, or one that flies. But I chose to make a driving robot. One reason I chose this is because I thought it would be easier and faster to make the robot this way. We didn't have very much time to make the robot.
Also, the robot needed to have some way to move an object out of the way that was in front of the robot. The robot could punch the object out of the way, or run into it, or lift the object up and throw it behind the robot. I chose to hit the object with a swinging arm. I thought this would be a good way to move the object because it was simple.
To make this robot, you will need:
*A Lego Mindstorms NXT 2.1 module
*The Mindstorms NXT 2.1 software
*Three Mindstorms motors
*4 lego wheels, 2 big wheels, and 2 small wheels
*1 ultrasonic Mindstorms sensor
*1 light sensor
*Other lego parts to make the arm and the body of the robot
In the next step, I will talk about coming up with a design for the robot.
Step 1: Planning Your Design
Before you start building, you need to plan out your design. If you don't know what you want your robot to do, and how you are going to do it, then you can't build the robot.
To make your plan, draw sketches and talk to other people about what you want your robot to do. Think about the sensors you will need to use. Think about how you are going to make the robot move.
I attached two sketches to this step. The first one is of the final design for this robot. It shows the sensors, wheels, and the arm for knocking the can out of the way. The second sketch is another idea I had for a robot that would climb a tree.
In the next step, I will talk about building the robot.
Step 2: Building the RobotNow you need to build the parts of the robot. Building the parts of the robot kind of goes together with writing the program. Because this was my first robot, I had to go back and forth a couple times between building the hardware and changing the program.
Put the motors and wheels in the right places, and put the motor on for the arm. Put the sensors on too. You will probably end up moving a lot of things around, especially the sensors, because you probably won't get them in the right place on your first try.
In the next step, I will talk about the program that I wrote for this robot.
Step 3: Making a flowchart, and programming the robot
It has been about two months since I made this robot. I will try to remember what I can about programming the robot.
Before you write the program, it is a good idea to make something called a flowchart. The flowchart makes it easier to write the program. The flowchart is kind of like a guide to help you decide what you want the robot to do and how you are going to do it. After you make the flowchart, it is a lot easier to write the program because you can just follow the flowchart. The flowchart helps you think about the logic the robot will have to follow to do the right things.
You start with a "Start Block." This is an oval on the paper. From the Start Block you make a "Question Block." This is a question in the program. The robot uses sensors to answer the question. Depending on the answer to the question in the Question Block, the robot will either try to answer another question or move on to an "Action Block." The action block shows something that the robot actually does, like driving or turning or swinging the arm.
I attached a picture showing part of the flowchart for this robot. This flowchart shows the logic for the robot to follow the black line. Depending on where the black line is, the robot will drive forward, or move to the right, or move to the left. The robot answers the questions in this flowchart by checking with the light sensor. The flowchart also shows the logic to check for an object ahead. If the ultrasonic sensor sees an object, the arm will swing 190 degrees to knock the object out of the way. Then, the program goes back to the beginning. So, if the object is still in the way, the arm will swing again. If there is no object, then the program will move on to looking for the black line and deciding where to move.
To program the robot, you need to get the Lego Mindstorms software installed on your computer. After that, you drag different "pieces" from the software toolbar into the center, where you actually build the program. Some of the pieces control each motor. You can choose which way you want the motor to go, how many turns you want it to make, and how long you want it to turn. You use the logic from the flowchart to feed into the motor controls. Other pieces that you drag in are for the sensors. These pieces that you drag in send the signal coming in from the sensor. For the ultrasonic sensor, you need to choose how sensitive you want the sensor to be, or what distance you want it to start sending a signal that something is in front of the sensor. You need to attach the signals from each sensor to the right motors, and put in different logic blocks to make the flowchart logic control the robot.
Once you put all of the pieces in the center of the program, check the notifications at the bottom of the screen to see what the program is actually doing. This makes it so you can check your program before you put it into the robot.
I can't find the file for the program that I wrote. If I find it, I will attach it here for you to see. I wrote the program on the Scout leader's computer, and I am trying to get it from him.
On the screen of the software, there is a button to click to send the program to the robot. You attach the cord from your computer to the Mindstorms module. Once the program has been sent into the robot, the robot will make a beep. On the robot screen, there will be a menu to choose the program that you want to use. Push the orange button twice on the module to run the program. If the program doesn't work the way you want it to, press the orange button to stop the program. Then make the changes in the program until you get the program working right.
Step 4: Test the Robot!
Finally you will get to test the robot. I had to go back and forth a couple times to make everything work right. I had to move the light sensor down lower on the robot so it could actually see the line on the paper.
I attached a video of the working robot. The robot makes a couple mistakes in this video. It was good enough to get the merit badge, but if I made it again, I would do some things differently.
About halfway through the video, the robot drives off the line. The robot has kind of jerky motions, and I think the sensor got too far away from the line and started driving the wrong way. Also, the sensor was kind of loosely attached on the robot because I had to move it down lower on the robot. I think because the sensor was wiggling, the robot would turn the wrong way sometimes.
A little bit after that, the robot sees a block of wood in front of it. It swings the arm at the block of wood, but it can't knock it out of the way. It can knock the pop cans out of the way, but not the block of wood. I think there are a couple of reasons for this. The block of wood is a lot heavier than the pop cans. Also, I think the robot got too close to the block of wood before it swings the arm. If it swung the arm when it was further away from the block, the part of the arm that hit the wood would be moving faster. If I change the sensitivity on the ultrasonic sensor, It would swing sooner. Something else that could help is if the arm would swing farther around the front of the robot. When the robot couldn't knock the block of wood over, the robot was driving around a curve. The block of wood may have been too far to the left of the robot. If I made the motor swing further around the front of the robot, it might work better.