0% found this document useful (0 votes)
8 views

Mech Project

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Mech Project

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Egyptian Academy For Engineering and

Advanced Technology

Designed and Implemented : LINE FOLLOWER WITH


OBSTACLE AVOIDING ROBOT
Team project for
elborated by:
Student name and id
Ahmed Hamada Mohamed 2020081
Hussien Esmail Hussien 2021147
Ahmed Hossam Eldien 2020147

Supervised by:
Instructor: Dr: mahmoud Abo Hatab

TA: Ahmed Said


1
ABSTRACT

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

2.4 -2 battery 3.7 V ,battery holder and ON OFF switch

2.3 Ultrasonic Sensor


ultrasonic sensor is an instrument that measures the
distance to an object using ultrasonic sound waves.
ultrasonic sensor uses a transducer to send and receive
ultrasonic pulses that relay back information about an
object’s proximity

How Ultrasonic Sensors Work


Ultrasonic sensors work by sending out a sound wave at a frequency above the range of
human hearing. The transducer of the sensor acts as a microphone to receive and send the
4
ultrasonic sound. Our ultrasonic sensors, like many
others, use a single transducer to send a pulse and to
receive the echo. The sensor determines the distance to
a target by measuring time lapses between the sending
and receiving of the ultrasonic pulse.

2.4 Motor Driver Module-L298N


It is a high voltage, high current dual full-bridge
driver de-signed to accept standard TTL logic level
sand drive inductive loads such as relays,
solenoids, DC and stepping motors.

2.5 Infrared Obstacle Avoidance IR Sensor Module


Easy to assemble and use, The effective distance range of 2cm to 80cm and If there is an obstacle, the indicator
lights on the circuit board

3. Advantages:
•Robot movement is automatic
•It is used for long distance applications
•Simplicity of building

5
•Used in home, industrial automations etc.

4. Applications of line follower robot:


•Industrial Applications: These robots can be used as automated equipment carriers in
industries replacing traditional conveyer belts.
•Automobile applications: These robots can also be used as automatic cars running on
roads with embedded magnets.
•Domestic applications: These can also be used at homes for domestic purposes like
floor cleaning etc.
•Guidance applications: These can be used in public places like shopping malls,
museums etc to provide path guidance.

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;

// keep state of all buttons


boolean prev_a_button = false;
boolean prev_c_button = false;
boolean prev_d_button = false;
boolean prev_b_button = false;
boolean prev_e_button = false;
boolean prev_f_button = false;

boolean prev_j_button = false;


boolean prev_j_left_button = false;
boolean prev_j_right_button = false;
boolean prev_j_up_button = false;
boolean prev_j_down_button = false;

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;

// if state got to 1, the button was activated


if (new_val)
{
// send a key down event to the pc
Serial.print(button_name);
Serial.println(" DOWN");
}
// if the state got to 1, the button was deactivated
else
{
// send a key up event to the pc
Serial.print(button_name);
Serial.println(" UP");
}

// update the previous value so changes in state can be registered


old_val = new_val;
}

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);

// to parse analog sensors to digital ones, we first read them and


// map them to a value in [-1, 0, 1]
int new_x_joystick = map(analogRead(x_joystick), 0, 1000, -1, 1);
int new_y_joystick = map(analogRead(y_joystick), 0, 1000, -1, 1);

// And then comparing them to specific values to check whether


// they were 'activated'
handle_button("JOY_LEFT", new_x_joystick == -1, prev_j_left_button);
handle_button("JOY_RIGHT", new_x_joystick == 1, prev_j_right_button);
handle_button("JOY_DOWN", new_y_joystick == -1, prev_j_down_button);
handle_button("JOY_UP", new_y_joystick == 1, prev_j_up_button);
handle_button("JOY_ENTER", digitalRead(j_button) == LOW, prev_j_button);

delay(10);
}

10

You might also like