In this Instructable, we are going to build a simple generic line following arduinobot. There will be a lot of room for creativity in this Instructable.
The robot, in this tutorial, is powered off of 4 AA batteries and is able to follow black electrical tape off a white surface.
Step 1: Parts
1 Arduino Uno or compatible
2 Parallax QTI sensors
2 Solarbotics GM9 Motors or compatible
2 Solarbotics GM10 Wheels or compatible
2 VEX motor controllers or compatible
Breadboard, wires, etc
Scrap plexiglass to make chassis out of
Step 2: Building the Physical Part of the Line Follower
You have a lot of room for creativity when building the robot. You simply have to follow three guidelines to ensure the robot will work with the code we will write later.
Firstly, the two QTI sensors must be placed side by side.
Secondly, the QTI sensors must be placed in front or inline with the wheels. The robot will not follow the line well, if the QTI sensors are behind the wheels.
Thirdly, the majority of the weight must be between the motorized wheels. This is to ensure the robot is not affected by weight when turning. If you are building a simple line follower, it is very likely that the battery holder will be the heaviest part of the robot. It is recommended to place the battery pack between the wheels.
The rest of the design is up to your imagination. You can incorporate extra components, like LEDs and buzzers.
I made a simple 4x6x1in U channel, out of plexiglass, on which I mounted all of the parts.
Step 3: Wiring the Line Follower
So now its time to wire up all the components together.
Here is the diagram of the line following circuit. Just attach the components as you see in the diagram.
If you have any trouble watch the video where I explain how to wire up the circuit.
Step 4: Coding the Line Follower
Attached is the line following code for the robot. Download it and load it onto your arduino.
Any line in the code that has a comment you might have to modify. This will only happen if the ports you connected your QTI sensors and motor controllers too are different than the ports they are connected with in the schematic. For example, in my schematic the left motor controller is connected to pin 10. If yours is connected to a different pin than you will have to change the values of certain variables in the code.
If for any reason you cannot download the attached file you can also download it at this link:
Step 5: Test Out Your Robot
So now you should have a working line follower. Put fresh batteries in the battery holder and place the robot over a piece of black electrical tape. For convenience I would recommend adding an on-switch. The robot should reach the end tape and then stop.
From here you can go in a lot of directions with the robot. If you do happen to do anything interesting with your robot post a link.