Mech Project
Mech Project
Advanced Technology
Supervised by:
Instructor: Dr: mahmoud Abo Hatab
shows design and implementation of the Line Follower Robot and its ability to select the
desired line among black and white line. This can be combined with different colours. Since
each colour has its own distinct property, robot can therefore easily differentiate among
different colours and possess the ability to detect the presence of an obstacle and choose the
other path to find its target. It is programmed in such a way that instructions are given to the
robot which senses a line and attempts to move towards the target.
2
Tabel of content
2. Component..................................................................................................................................................................
2.1Arduino uno...........................................................................................................................................................
2.2 Dc motor...............................................................................................................................................................
2.3 -4 wheel car kit....................................................................................................................................................
2.4 -2 battery 3.7 V ,battery holder and ON OFF switch.............
2.3 Ultrasonic Sensor..................................................................................................................................................
2.4 Motor Driver Module-L298N...............................................................................................................................
2.5 Infrared Obstacle Avoidance IR Sensor Module..................................................................................................
3. Advantages:.................................................................................................................................................................
4. Applications of line follower robot:............................................................................................................................
5. Simulation...................................................................................................................................................................
6. Code in Arduino..........................................................................................................................................................
3
1. INTRODUCTION
THE LINE FOLLOWING ROBOT IS AN AUTONOMOUS ROBOT THAT DETECTS A PATH AND
ACCORDING TO THE PATH DRAWN, IT FOLLOWS THE PATH WITH THE HELP OF AN IR SENSOR
ATTACHED TO THE ROBOT. THE PATH CAN BE EITHER A BLACKLINE DRAWN OVER A WHITE
SURFACE OR A WHITE LINE DRAWN OVER A BLACK SURFACE THUS AVOIDING ANY
DETECTION ERROR. LINE FOLLOWER ROBOT ALSO CONSISTS OF AN OBSTACLE SENSOR THAT
DETECTS ANY OBSTACLE IN FRONT OF THE ROBOT THUS AVOIDING ANY UNNECESSARY
ACCIDENTS
2. Component
2.1Arduino uno
Arduino Uno is a microcontroller device based that allow you
to create different types of electronic circuits. It has 14
programmable digital pins as inputs or outputs (which also
have the ability to be used for dedicated functions such as
PWM signal generation or UART communication) and 6
input for the acquisition and processing of analog signals. The microcontroller is the
ATMega328 produced by
2.2 Dc motor
Dc motor class of electrical motors that convert direct current
electrical energy into mechanical energy
2.3 -4 wheel car kit
3. Advantages:
•Robot movement is automatic
•It is used for long distance applications
•Simplicity of building
5
•Used in home, industrial automations etc.
5. Simulation
6
7
6. Code in Arduino
// hardware pin numbers for the joystick shield V1.a
const int a_button = 2;
const int c_button = 4;
const int d_button = 5;
const int b_button = 3;
const int e_button = 6;
const int f_button = 7;
const int j_button = 8;
const int x_joystick = A0;
const int y_joystick = A1;
void setup() {
// initialise the digital pins
pinMode(a_button, INPUT);
pinMode(c_button, INPUT);
pinMode(d_button, INPUT);
pinMode(b_button, INPUT);
pinMode(e_button, INPUT);
pinMode(f_button, INPUT);
pinMode(j_button, INPUT);
8
// start serial at a baud rate of 9600
Serial.begin(9600);
}
void handle_button(const char *button_name, bool new_val, bool &old_val)
{
// if there is no change in state, don't generate events
if (new_val == old_val)
return;
void loop()
{
// handle normal buttons, the state will be true on LOW, when the
// button is pressed (low resistance on button press)
handle_button("A", digitalRead(a_button) == LOW, prev_a_button);
handle_button("B", digitalRead(b_button) == LOW, prev_b_button);
handle_button("C", digitalRead(c_button) == LOW, prev_c_button);
handle_button("D", digitalRead(d_button) == LOW, prev_d_button);
9
handle_button("E", digitalRead(e_button) == LOW, prev_e_button);
handle_button("F", digitalRead(f_button) == LOW, prev_f_button);
delay(10);
}
10