|
|
Fun Projects for your LEGO® MINDSTORMS® NXT! |
| Line Follower |
|
1
Note: Be sure to get the NXT brick facing the right way. Note which side the USB port is on.
2
Note: Be sure the NXT brick is facing the right way. It will only fit correctly this way.
3
| The gray "skis" (which are on the front on the robot) allow the robot to slide from side to side so that it can turn accurately. |
4
5
| The light sensor is placed between the front "skis" and near the place where the skis contact the surface, so that the skis will push down lightly and smooth out any large wrinkles in the mat under the light sensor, to help it get a consistent reading. |
6
| The dark gray angled beams in the back will normally
hover just above the surface, but they are there to provide stability in
case the robot tries to tip backward (for example, when pressing the NXT
buttons). See the tip on weight balance. |
7
8
9
| Use the shortest wire to connect the light sensor to port 3 on the NXT. If you temporarily remove the two cross beams on the bottom of the robot, you can route the wire neatly under the robot as shown. |
10
| Use two wires to connect the left motor (the light sensor is near the front of the robot) to port B on the NXT and the right motor to port C on the NXT. |
|
Building Tip: Weight Balance When building a robot that depends on sliding on something (the gray front "skis" in this project) to turn, it is important to consider the weight balance of the robot. You want to have most of the robot's weight over the drive wheels, and just enough weight over the sliding part to keep the robot stable and avoid tipping over. If too much weight is over the sliding part, the robot will struggle to turn, might get caught up and stall, or the drive wheels might start slipping. This Line Follower robot is designed to have almost all of its weight over the drive wheels. Using a small scale in the experiment shown below, we find that the robot weights a total of 622 grams, with 560 grams over the back wheels. This means that the robot has 90% (560/622) of the weight over the wheels and only 10% of the weight over the front skis. This is good for line following at slow speeds, but note that it could cause the robot to pop a wheelie if a lot of power was suddenly given to both wheels going forward (see the Dragster).
|
| Line
Follower Programming Two programs are provided for use with your Line Follower. The program Line Follow uses a simple "zigzag" method of line following where the robot is constantly turning back and forth as it sees either side of the color boundary. The program Smooth Follow uses a somewhat more complex method of following the line with the goal of going straighter and smoother (and therefore faster). When the robot gets aligned with the color boundary that it is trying to follow, the robot will go straight as far as it can and make small corrections left and right to try to stay on the boundary without zigzagging as much. See the program comments for details. Both programs start with instructions for the user to follow a procedure to calibrate the light sensor to the actual colors and lighting conditions that will be used. Light sensor calibration is essential for accurate line following. See the program comments for details. If you use line following in your own programs, you could start with a similar procedure at the beginning of the program, or run the calibration steps as a separate program ahead of time. |
| The gray skis and the light sensor are on the front
end of the robot. The NXT display should be right side up for
reading when you are behind the robot. At the start of both line following programs, the user is asked to place the robot over white and then black and press the orange button after each, in order to calibrate the light sensor to the actual light and dark colors that will be used for the line following. This is important because the actual brightness seen by the light sensor will depend on many things, including the colors of the surface, how shiny the surface is, the exact height of the light sensor off of the surface, and the amount of other ("ambient") light in the room. |
|
|
|
|
| Step 1 of the light sensor calibration wants the sensor to be over all white. | Step 2 of the light sensor calibration wants the sensor to be over all black. | When following, the robot will try to align itself centered over the boundary between white and black (not centered over the black line), with black to the robot's left. |
Challenges
|
|
|
Copyright
©
2007-2008 by Dave Parker. All rights reserved. |