Line Following Robot
Your task this week is to program your robots to follow a dark line on a
light background. You can use any method you use. In room 213 you
will find two white boards with strips of black electrical tape. You will
program your robot to follow this tape as well as you can. The boards have
paths of varying complexity -- do as well as you can. You will have two
lab periods (and your own time) to write and debug your program.
Again, I ask you to make sure that everybody in the group is participating
- If you know more C than the others in your group, you have a
responsibility to teach and help the others. If you are doing all the
work, you are cheating your lab partners out of a beneficial
- If you think you know less than others in your group you have a
responsibility (to yourself and to the others in your group) to ask
questions, and make sure you are understanding everything. If you
aren't following what is going on you are cheating yourself out of an
educational experience, and cheating your group out of the contributions
that you could be making.
is only one deadline for this lab.
On Tuesday, November 14th you will demonstrate your robot for the rest of the
class and you will have about 2 minutes to describe how your algorithm
works. On that day you must also turn in a documented program, along with
a brief (1-2 page) description of how your program works. Make sure your
program is well documented so the grader can follow what you did.
Things to think about, or not, at your discretion:
- The reading from the sensor goes down with increasing light, and each
sensor is different.
- How can your computer tell light from dark, especially under different
lighting conditions? You might want to calibrate the sensors by
placing it over a light spot on the board, as well as a dark spot before
- Do you want to set the speed based only upon the current sensor readings,
or do you want to use the sensor readings to incrementally change the speed
of the wheels, or some combination of both.
- You might want to have the computer constantly display the sensor
readings, as well as describing whatever decisions it is executing.
This might make debugging a lot easier.
- How can you keep the robot from zigzagging back and forth across the path,
rather than smoothly converging on the path?
- Try your program first on a relatively straight path, and slowly increase
the difficulty (e.g., use a more curved path, or start the robot out so that
it is not centered on the line).
I may add to these lists during the course of the project as I see what
common problems people are having.
Extra things to program (if you want an additional challenge):
- Get the computer to turn around 180 degrees if it comes to the end of the
- Program your computer to follow the light and dark tiles in the hallway of
Hicks. You could program it to try to keep two photosensors on the
brown tiles, and two on the right.
- Program the computer to respond to intersecting lines of tape (e.g., going
straight or turning at the intersection). This would be useful if you
choose to write a maze-solving routine for your project later in the
- Incorporate feedback from the bump sensors to change behavior if you run
- Implement your program with multi-tasking.
- Incorporate sound into your program so your computer will "whistle as