arduino awdhesh
arduino awdhesh
Working Principle: A Line Following Robot is an autonomous robot that follows a specific path,
usually a black line on a white surface or vice versa.
1. Line Detection:
o The IR sensors detect the difference in color (black or white)
on the surface.
o A black line absorbs IR light, while a white surface reflects
it.
o The IR sensor module has an IR LED and a photodiode.
When the photodiode detects the reflected light, it generates
a signal (HIGH or LOW) that tells the Arduino about the
presence of the line.
2. Decision Making:
o If both sensors detect white: Move FORWARD.
o If the left sensor detects black: Turn LEFT.
o If the right sensor detects black: Turn RIGHT.
o If both sensors detect black: This may indicate a junction
or stop signal, depending on the design.
3. Motion Control:
o The Arduino reads the sensor
o inputs and controls the motor
driver (L298N or L293D) accordingly.
o The motor driver allows the Arduino to provide enough
current and voltage to drive the DC motors.
Implementation:
Step 1: Gather Required Components
Step 8: Troubleshooting
1. Robot not moving:
o Check if the motor driver is getting power.
o Check if the motors are connected properly.
2. Robot not detecting the line:
o Adjust the height of the IR sensors.
o Make sure the line is properly visible (use thick black tape on a
white background).
3. Robot not turning properly:
o Check the sensor alignment.
o Verify the motor wiring.
4. Random movement:
o There may be noise in the IR sensor signals.
o Use resistors to stabilize the input or add a capacitor.
Flowchart
Code: #define IR_SENSOR_RIGHT 11
#define IR_SENSOR_LEFT 12
#define MOTOR_SPEED 180
//Right motor
int enableRightMotor=6; int rightMotorPin1=7;
int rightMotorPin2=8;
//Left motor
int enableLeftMotor=5; int leftMotorPin1=9; int
leftMotorPin2=10;
void setup()
{
TCCR0B = TCCR0B & B11111000 | B00000010
;
void loop()
{
if (rightMotorSpeed < 0)
{
digitalWrite(rightMotorPin1,LOW); digitalWrite(rightMotorPin2,HIGH);
}
else if (rightMotorSpeed > 0)
{
digitalWrite(rightMotorPin1,HIGH); digitalWrite(rightMotorPin2,LOW);
}
else
{
digitalWrite(rightMotorPin1,LOW); digitalWrite(rightMotorPin2,LOW);
}
if (leftMotorSpeed < 0)
{
digitalWrite(leftMotorPin1,LOW); digitalWrite(leftMotorPin2,HIGH);
}
else if (leftMotorSpeed > 0)
{
digitalWrite(leftMotorPin1,HIGH); digitalWrite(leftMotorPin2,LOW);
}
else
{
digitalWrite(leftMotorPin1,LOW); digitalWrite(leftMotorPin2,LOW);
}
analogWrite(enableRightMotor, abs(rightMotorSpeed));
analogWrite(enableLeftMotor, abs(leftMotorSpeed));
}
Stimulation:
Development of
System
Conclusion: The development of a Line Following Robot using Arduino is a practical
demonstration of embedded systems, robotics, and automation. This project
introduces key concepts such as sensor integration,
motor control, and decision-making algorithms.
Remarks:
Faculty in charge