The IR line tracking sensor consists of analog to digital and comparator module and TCRT5000 IR Sensor Breakout Board. The IR light emitted by the LED strikes the surface and is reflected back to the IR photodiode. The photodiode then gives an output voltage proportional to the reflectance of the surface (high value for light surface and low for black/dark surface).
This line follower robot are pretty straight forward. These robots have the capability to detect a black/dark line on a lighter surface depending on the contrast. They estimate whether the line underneath them is shifting towards their left/right as they move over them. Based on that estimation, they give respective signals to the motors to turn left/right so as to maintain a steady center with respect to the line.
These robots usually use an array of IR (Infrared) sensors in order to calculate the reflectance of the surface beneath them. The basic criteria being that the black line will have a lesser reflectance value (black absorbs light) than the lighter surface around it. This low value of reflectance is the parameter used to detect the position of the line by the robot. The higher value of reflectance will be the surface around the line. So in this linear array of IR sensors, if the leftmost/rightmost IR sensor presents the low value for reflectance, then the black line is towards the left/right of the robot correspondingly. The controller then compensates for this by signaling the motor to go in the opposite direction of the line.
Step 1: Material Planning
For this tutorial, we requires these items:
1. Arduino UNO
2. 2WD Smart Car Chasis 2 Wheels
3. Arduino Mini DC Motor Driver Dual H-Bridge PW Control (L293D)
4. IR Line Tracking Sensor (4 bits)
6. Double side tape
8. Jumper wire
9. Black tape
Step 2: Hardware Installation
1. Assemble the 2WD Smart Car Chasis 2 Wheels
2. Connect the IR sensor to Analog to Digital and Comparator Module
IN1 > IR Sensor 1
IN2 > IR Sensor 2
IN3 > IR Sensor 3
IN4 > IR Sensor 4
3. Then, connect the output pin to Arduino UNO analog pin
OUT1 > A2
OUT2 > A3
OUT3 > A4
OUT4 > A5
4. Connect Vin to 5V and GND to GND in Arduino UNO
5. Then, connect the motor driver pin to Arduino UNO pin
IN1 > D10
IN2 > D9
IN3 > D6
IN4 > D5
6. Connect the both motor to motor driver
Motor A > Right motor
Motor B > Left motor
After completing the connection, connect the Arduino to power supply with USB cable.
Step 3: Insert Source Code
1. Download the test code and open it by using Arduino software or IDE.
2. Make sure that you have choose the right board and the corresponding port. (In this tutorial, Arduino Uno is used)
3. Then, upload the test code into your Arduino Uno.
Step 4: Video
Enjoy the tutorial!