The Line Follower does exactly what the name suggests, it follows a line. Make it go where ever you want by showing the way with a 3 cm wide, black line.
Materials
- 1 Arduino Uno board
- 1 Basic Education shield
- 1 IR Array
- 2 continuous rotation servos
- 4 black jumper wires
- 8 coloured jumper wires
- 2 power connectors (One without the plug but with two loose wires)
- 1 4 AA battery pack
- 1 9V battery
- 4 AA batteries
- 1 Line follower kit
- 1 metal ball
Instructions
Code
You can find the code in File -> Examples -> BasicEducationSheild-> Robots-> LineFollower
How it works
The IR sensors in the IRArray can detect black and white. By using the command readLine()
we get a value from -100 to 100 representing the direction the line is heading. This value is then used to tell the wheels what direction to go by writing wheels.follow(direction)
.
Troubleshooting
- Refer to the illustration and double check your connections. Make sure the shield and wires are firmly connected.
- Motors are not working? See the reference about how to debug servo motors used as wheels.
- Debug the IRArray, see the IRArray reference.
Experiment further
- Print a track and build obstacles for the robot. If the obstacles are too difficult, see if there is a way to improve the robots performance by modifying the wheels
- Make the robot react in some way when it “sees” only white. That is, when it has lost the track of the black line.