[go: up one dir, main page]

0% found this document useful (0 votes)
22 views39 pages

WKSP Projectsa Dnmasb

The document is a project report for a Robotic Car developed by students at the Military College of Signals, focusing on Arduino-based microcontroller applications. It details the components, specifications, and programming instructions for creating a robotic car capable of ultrasonic obstacle avoidance and Bluetooth remote control. The report includes project descriptions, wiring diagrams, and sample code for various functionalities, including obstacle detection and motor control.

Uploaded by

Ali Jatt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views39 pages

WKSP Projectsa Dnmasb

The document is a project report for a Robotic Car developed by students at the Military College of Signals, focusing on Arduino-based microcontroller applications. It details the components, specifications, and programming instructions for creating a robotic car capable of ultrasonic obstacle avoidance and Bluetooth remote control. The report includes project descriptions, wiring diagrams, and sample code for various functionalities, including obstacle detection and motor control.

Uploaded by

Ali Jatt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 39

Military College of Signals

National University of Sciences and


Technology

Submitted to: Lab Engr Kanza Abideen

Project Report ROBOTIC CAR


Submission Date
Section BEIS-5

Group Members Details


S.no Names
1. CAPTAIN ALI

ROBOTIC CAR
INTRODUCTION
Robot Caris a learning application development system of microcontroller based on Arduin
o. It has functions such as ultrasonic obstacle avoidance, bluetooth remotecontrol. This kit
contains many interesting programs.
It can also be expanded with external circuit modules to have further functions.
This kit is designed to help you interestingly learn Arduino.
You can learn Arduino MCU development ability while having fun.
Parameters
1. Motor parameters: 6V, 150rpm/min
2. Use L298P driver module for motor control.
3. Equipped with Ultrasonic module, can detect whether there are obstacles ahead, and the
distance between the robot car and the obstacles to realize obstacle avoidance function.
4. Equipped with Bluetooth wireless module, can remotely control the robot after pairing
with mobile phone Bluetooth.
5. Can be connected to external 7 ~ 12V power supply; with various sensor modules, it can
realize various functions.
Component List

No Name Quantity Picture

1 Yellow RC Car 2
TT Gear Motor
DC 6V-12V
Robot Smart
Robot Car
Tyre Wheel
Gear Motor Set
DC

2 MINI 1
ON/OFF-
BUTTON
SWITCH

3 JDY-31 SPP- 2
C Bluetooth
serial

P a g e 2 | 39
4 ARDUINO 1
L298N Motor
Driver

5 W420 steel 1
ball

6 SG90 9g 1
Micro Servo
Mini Gear
Motor

7 LM393 1
Infrared
Velometer

8 Jumper Wires 12
Male to
Female

P a g e 3 | 39
9 Acrylic chasis 1
plate

10 Cell Battery 1
Holder

Introduction
What’s Arduino?
Arduino is an open-source hardware project platform. This platform includes a circuit board
with simple I/O function and program development environment software. It can be used to
develop interactive products. For example, it can read signals of multiple switches and
sensors, and control light, servo motor and other various physical devices. It’s widely
applied in robot field.
Arduino installation and program upload:
First, download the Arduino development software, click below hyperlink:
arduino-1.5.6-r2-windows.rar
Downloaded file is a arduino-1.5.6-r2-windows.zip compressed folder, unzip it to your hard
drive.
Double click Arduino-1.5.6 .exe. Click “I agree”;

P a g e 4 | 39
Click “Next”;

And then “Install”;

Wait for the installation to be completed, click close.

P a g e 5 | 39
Below figure is what Arduino 1.5.6 looks like.

P a g e 6 | 39
Next, let’s install Arduino driver.
For different operating system, there may be slight difference in installation method.
Below is an example in WIN 7.
When you connect Arduino Uno to your computer at the first time, right click
“Computer” —> “Properties”—> “Device manager”, you can see “Unknown devices”.

P a g e 7 | 39
Click “Unknown devices”, select “Update Driver software”.

In this page, click “Browse my computer for driver software”.

P a g e 8 | 39
Find the “drivers” file.

Click “Next”; select “Install this driver software anyway” to begin the installation.

P a g e 9 | 39
Installation completed; click “Close”.

After driver is installed, go to “Device manager” again. Right click “Computer” —>
“Properties”—> “Device manager”, you can see UNO device as below figure shows,
also with the Com port info.

P a g e 10 | 39
Following is a sketch uploading example called “Hello World!”.
First, open Arduino IDE. In this example sketch, we program Arduino to display “Hello
World!” on serial monitor when it receives a specific character string “R”; also the on-
board D13 LED will blink once each time it receives “R”.
First, set up board; In “Tools”, select “Arduino Uno”.

P a g e 11 | 39
P a g e 12 | 39
Next, set up COM port; In “Tools”, select “COM3”.

P a g e 13 | 39
After selection, you can see indicated area is the same with settings in “Device manager”.

Copy the example sketch and paste it to the IDE; click “Verify ” to check
compiling mistakes; click “Upload ” to upload the program to the board.

P a g e 14 | 39
P a g e 15 | 39
After uploading is done, open “serial monitor ”; enter “R”; click “Send”, the serial
monitor will display “Hello World!” and the D13 LED will blink once.

P a g e 16 | 39
Your first sketch uploading is successful!

Project Details
Project 1: Ultrasonic Sensor

Introduction
The HC-SR04 Ultrasonic Sensor is a very affordable proximity distance sensor that has
been used mainly for object avoidance in various robotics projects. It essentially gives your
Arduino eyes spacial awareness and can prevent your robot from crashing or falling off a
table. It has also been used in turret applications, water level sensing, and even as a parking
sensor. This simple project will use the HC-SR04 sensor with an Arduino and a Processing
sketch to provide a neat little interactive display on your computer screen.

P a g e 17 | 39
Specification
Working Voltage: DC 5V
Working Current: 15mA
Working Frequency: 40Hz
Max Range: 4m
Min Range: 2cm
Measuring Angle: 15 degree
Trigger Input Signal: 10µS TTL pulse
Echo Output Signal Input TTL lever signal and the range in proportion

P a g e 18 | 39
Connection Diagram

P a g e 19 | 39
Sample Code
Wiring Method:
VCC to Arduino 5v
GND to Arduino GND
Echo to Arduino pin 4
Trig to Arduino pin 5

#define echoPin 4 // Echo Pin


#define trigPin 5 // Trigger Pin
#define LEDPin 13 // Onboard LED
int maximumRange = 200; // Maximum range needed
int minimumRange = 0; // Minimum range needed
long duration, distance; // Duration used to calculate distance

void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(LEDPin, OUTPUT); // Use LED indicator (if required)
}

void loop() {
/* The following trigPin/echoPin cycle is used to determine the
distance of the nearest object by bouncing soundwaves off of it. */
digitalWrite(trigPin, LOW);
delayMicroseconds(2);

digitalWrite(trigPin, HIGH);
delayMicroseconds(10);

digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);

//Calculate the distance (in cm) based on the speed of sound.


distance = duration/58.2;

if (distance >= maximumRange || distance <= minimumRange){

P a g e 20 | 39
/* Send a negative number to computer and Turn LED ON
to indicate "out of range" */
Serial.println("-1");
digitalWrite(LEDPin, HIGH);
}
else {
/* Send the distance to the computer using Serial protocol, and
turn LED OFF to indicate successful reading. */
Serial.println(distance);
digitalWrite(LEDPin, LOW);
}

//Delay 50ms before next reading.


delay(50);
}

P a g e 21 | 39
Result After connection and uploading, when ultrasonic sensor senses obstacle within
sensing area, it is measuring the distance between itself and obstacle and the value of
distance is displayed on serial monitor as shown in below figure

Project 2: Bluetooth Module


Introduction
This Bluetooth module can easily achieve serial wireless data transmission. Its operating
frequency is among the most popular 2.4GHz ISM frequency band (i.e. Industrial, scientific
and medical). It adopts Bluetooth 2.1+EDR standard. In Bluetooth 2.1, signal transmit time
of different devices stands at a 0.5 seconds interval so that the workload of bluetooth chip
can be reduced substantially and more sleeping time can be saved for bluetooth. This
module is set with serial interface, which is easy-to-use and simplifying overall
design/development cycle.
Specification
Bluetooth Protocol: Bluetooth 2.1+ EDR standard
USB Protocol: USB v1.1/2.0
Operating Frequency: 2.4GHz ISM frequency band
Modulation Mode: Gauss frequency Shift Keying
Transmit Power: ≤ 4dBm, second stage
Sensitivity: ≤-84dBm at 0.1% Bit Error Rate
Transmission Speed: 2.1Mbps(Max)/160 kbps(Asynchronous);
1Mbps/1Mbps(Synchronous)
Safety Feature: Authentication and encryption
Supported Configuration: Bluetooth serial port (major and minor)
Supply Voltage: 5V DC 50mA
Operating Temperature: -20 to 55℃

P a g e 22 | 39
Note: Before uploading test code, we can’t insert Bluetooth module, otherwise the program
will fail to be uploaded. After uploading test code successfully, connect Bluetooth and
Bluetooth module , pair and connect APP.
Connection Diagram

int val;
int ledpin=13;
void setup()
{
Serial.begin(9600);
pinMode(ledpin,OUTPUT);
} void loop()
{ val=Serial.read();
if(val=='a')
{
digitalWrite(ledpin,HIGH);
delay(250);
digitalWrite(ledpin,LOW);
delay(250);
Serial.println("keyestudio");
}}

Result
After powered up, power indicator D1 is on, and LED on Bluetooth module is blinking;
open Bluetooth on mobile phone, pair them, input 1234, and finish pairing as shown in
Figure 1 ; open APP—Bluetooth serial communication assistant, connect it to Bluetooth,
select normal mode, complete connection, and LED on Bluetooth module is on as shown in
Figure 2; input an “a” in the assistant, and display “keyesdudio” in it as shown in Figure 3.
Figure 1 - - - - - - - - - - - - Figure 2 - - - - - - - - - - - - - Figure 3

P a g e 23 | 39
Project 3: Obstacle Avoidance robot car

Introduction
This project is a simple obstacle avoidance ta robot car based on Arduino, including the
software and hardware design. The controller part is a UNO board. Ultrasonic sensor and
servo motors are used to detect whether there are obstacles ahead, and feedback the signal
to UNO. UNO will analyze the signal to determine and control the motors movement to
adjust robot car moving direction. Therefore the robot car can automatically avoid
obstacles.
Working Principle
Ultrasonic ranging: the controller sends out a a high level signal of more than 10μs, when
the output pin receives the high level signal, the timer will be on; when the signal changes
to low level, we can read the time period of the timer, which is the time used for this
ultrasonic wave transceiving. Together with its transmission speed, we can calculate the
distance.
After we use the ultrasonic sensor to detect the distance from an obstacle, we can control
the movement of the robot car according to the data.
If the distance from the obstacle is < 10cm, the robot car moves backward; if the distance is
>=25cm, the robot car moves forward; if the distance is <25cm, we control the movement

P a g e 24 | 39
of the servo motors to measure the distance of the left and right. If both the distance are
<10cm, the robot car moves backward; if the distance are both >= 10cm, and distance on
the left is more than the distance on the right, the robot car moves to the left; if distance on
the left is <= the distance on the right, the robot car moves to the right.
Schematic and Connection Diagram

L = Left
R = Right
F = forward
B = backward
*/
#include <Servo.h>
int pinLB = 12; // define pin 12
int pinLF = 3; // define pin 3
int pinRB = 13; // define pin 13

P a g e 25 | 39
int pinRF = 11; // define pin 11
////////////////////////////////
int inputPin = 4; // define pin for sensor echo
int outputPin =5; // define pin for sensor trig

int Fspeedd = 0; // forward speed


int Rspeedd = 0; // right speed
int Lspeedd = 0; // left speed
int directionn = 0; // forward=8 backward=2 left=4 right=6
Servo myservo; // set myservo
int delay_time = 250; // settling time after steering servo motor moving B
int Fgo = 8; // Move F
int Rgo = 6; // move to the R
int Lgo = 4; // move to the L
int Bgo = 2; // move B
void setup()
{
Serial.begin(9600); // Define motor output pin
pinMode(pinLB,OUTPUT); // pin 12
pinMode(pinLF,OUTPUT); // pin 3 (PWM)
pinMode(pinRB,OUTPUT); // pin 13
pinMode(pinRF,OUTPUT); // pin 11 (PWM)
pinMode(inputPin, INPUT); // define input pin for sensor
pinMode(outputPin, OUTPUT); // define output pin for sensor
myservo.attach(9); // Define servo motor output pin to D9 (PWM)
}
void advance() // move forward
{
digitalWrite(pinLB,LOW); // right wheel moves forward
digitalWrite(pinRB, LOW); // left wheel moves forward
analogWrite(pinLF,255);
analogWrite(pinRF,255);
}
void stopp() // stop
{
digitalWrite(pinLB,HIGH);
digitalWrite(pinRB,HIGH);
analogWrite(pinLF,0);
analogWrite(pinRF,0);
}
void right() // turn right (single wheel)
{
digitalWrite(pinLB,HIGH); // wheel on the left moves forward
digitalWrite(pinRB,LOW); // wheel on the right moves backward
analogWrite(pinLF, 255);
analogWrite(pinRF,255);
}
void left() // turn left (single wheel)

P a g e 26 | 39
{
digitalWrite(pinLB,LOW); // wheel on the left moves backward
digitalWrite(pinRB,HIGH); // wheel on the right moves forward
analogWrite(pinLF, 255);
analogWrite(pinRF,255);
}

void back() // move backward


{
digitalWrite(pinLB,HIGH); // motor moves to left rear
digitalWrite(pinRB,HIGH); // motor moves to right rear
analogWrite(pinLF,255);
analogWrite(pinRF,255);
}
void detection() // measure 3 angles (0.90.179)
{
int delay_time = 250; // stabilizing time for servo motor after moving backward
ask_pin_F(); // read the distance ahead
if(Fspeedd < 10) // if distance ahead is <10cm
{
stopp(); // clear data
delay(100);
back(); // move backward for 0.2S
delay(200);
}
if(Fspeedd < 25) // if distance ahead is <25cm
{
stopp();
delay(100); // clear data
ask_pin_L(); // read distance on the left
delay(delay_time); // stabilizing time for servo motor
ask_pin_R(); // read distance on the right
delay(delay_time); // stabilizing time for servo motor

if(Lspeedd > Rspeedd) // if distance on the left is >distance on the right


{
directionn = Lgo; // move to the L
}

if(Lspeedd <= Rspeedd) // if distance on the left is <= distance on the right
{
directionn = Rgo; // move to the right
}
if (Lspeedd < 10 && Rspeedd < 10) // if distance on left and right are both <10cm
{
directionn = Bgo; // move backward
}}
else // if distance ahead is >25cm

P a g e 27 | 39
{
directionn = Fgo; // move forward
}}
void ask_pin_F() // measure the distance ahead
{
myservo.write(90);
digitalWrite(outputPin, LOW); // ultrasonic sensor transmit low level signal 2μs
delayMicroseconds(2);
digitalWrite(outputPin, HIGH); // ultrasonic sensor transmit high level signal10μs, at
least 10μs
delayMicroseconds(10);
digitalWrite(outputPin, LOW); // keep transmitting low level signal
float Fdistance = pulseIn(inputPin, HIGH); // read the time in between
Fdistance= Fdistance/5.8/10; // convert time into distance (unit: cm)
Fspeedd = Fdistance; // read the distance into Fspeedd
}
void ask_pin_L() // measure distance on the left
{
myservo.write(5);
delay(delay_time);
digitalWrite(outputPin, LOW); // ultrasonic sensor transmit low level signal 2μs
delayMicroseconds(2);
digitalWrite(outputPin, HIGH); // ultrasonic sensor transmit high level signal10μs, at
least 10μs
delayMicroseconds(10);
digitalWrite(outputPin, LOW); // keep transmitting low level signal
float Ldistance = pulseIn(inputPin, HIGH); // read the time in between
Ldistance= Ldistance/5.8/10; // convert time into distance (unit: cm)
Lspeedd = Ldistance; // read the distance into Lspeedd
}
void ask_pin_R() // measure distance on the right
{
myservo.write(177);
delay(delay_time);
digitalWrite(outputPin, LOW); // ultrasonic sensor transmit low level signal 2μs
delayMicroseconds(2);
digitalWrite(outputPin, HIGH); // ultrasonic sensor transmit high level signal10μs, at
least 10μs
delayMicroseconds(10);
digitalWrite(outputPin, LOW); // keep transmitting low level signal
float Rdistance = pulseIn(inputPin, HIGH); // read the time in between
Rdistance= Rdistance/5.8/10; // convert time into distance (unit: cm)
Rspeedd = Rdistance; // read the distance into Rspeedd
}
void loop()
{
myservo.write(90); // home set the servo motor, ready for next measurement
detection(); // measure the angle and determine which direction to move

P a g e 28 | 39
if(directionn == 2) // if directionn= 2
{
back();
delay(800); // go backward
left() ;
delay(200); // Move slightly to the left (to prevent stuck in dead end)
}
if(directionn == 6) // if directionn = 6
{
back();
delay(100);
right();
delay(600); // turn right
}
if(directionn == 4) // if directionn = 4
{
back();
delay(600);
left();
delay(600); // turn left
}
if(directionn == 8) // if directionn = 8
{
advance(); // move forward
delay(100);
}}

Result
After power-on, the car runs and will avoid obstacle automatically when catching obstacle.
Project 4: Bluetooth Control robot car
Introduction
This project is a robot car based on Bluetooth communication, including software and
hardware design. The controller part is a UNO board. A Bluetooth module is used to
receive the Bluetooth signal from the cellphone and feedback the signal to the UNO. UNO
will analyze the signal to determine and control the motors movement to adjust car moving
direction. Therefore the robot car robot can be controlled by cellphone.
Working Principle
1. The Bluetooth module is connected to UNO; the module communicates with cell phone
through a Bluetooth APP.
2. The Bluetooth APP on the cell phone will pass information of “U”“D”“L”“R”“S” to the
Bluetooth module.
3. The Bluetooth module will pass the information to the UNO, so the UNO can determine
car movement according to the information received.
4. When the UNO receives a “U”, the car goes straight forward; when it receives a “D”, the
car goes backward; “L” for turning left; “R” for turning right; and “S” for stop.
Bluetooth Usage
Connect main board +5V to Bluetooth VCC, GND to Bluetooth GND, TX to Bluetooth RX
and RX to Bluetooth TX.

P a g e 29 | 39
Remember to open the Bluetooth on your phone; when you open the Bluetooth APP, it will
remind you.Pair up Bluetooth device on your phone, search and pair.
Pair up device, PIN No. is 1234.
Open Bluetooth APP and pair up Bluetooth device. After it’s paired, the Bluetooth module
can communicate with cell phone.
Note: Before uploading test code, we can’t insert Bluetooth module, otherwise the program
will fail to be uploaded. After uploading test code successfully, connect Bluetooth and
Bluetooth module , pair and connect APP.
Schematic and Connection Diagram

P a g e 30 | 39
Sample Code

/*
L = Left
R = Right
F = forward
B = backward
*/
int pinLB = 12; // define pin 12
int pinLF = 3; // define pin 3
int pinRB = 13; // define pin 13
int pinRF = 11; // define pin 11
int val;
void setup()
{
Serial.begin(9600); // define pin for motor output
pinMode(pinLB,OUTPUT); // pin 12
pinMode(pinLF,OUTPUT); // pin 3 (PWM)
pinMode(pinRB,OUTPUT); // pin 13
pinMode(pinRF,OUTPUT); // pin 11 (PWM)
}
void advance() // move forward
{
digitalWrite(pinLB,LOW); // right wheel moves forward
digitalWrite(pinRB, LOW); // left wheel moves forward
analogWrite(pinLF,255);
analogWrite(pinRF,255);
}
void stopp() // stop
{
digitalWrite(pinLB,HIGH);
digitalWrite(pinRB,HIGH);
analogWrite(pinLF,0);
analogWrite(pinRF,0);

P a g e 31 | 39
}
void right() // turn right (single wheel)
{
digitalWrite(pinLB,HIGH); // left wheel moves forward
digitalWrite(pinRB,LOW); // right wheel moves backward
analogWrite(pinLF, 255);
analogWrite(pinRF,255);
}
void left() // turn left (single wheel)
{
digitalWrite(pinLB,LOW); // left wheel moves forward
digitalWrite(pinRB,HIGH); // right wheel moves backward
analogWrite(pinLF, 255);
analogWrite(pinRF,255);
}
void back() // move backward
{digitalWrite(pinLB,HIGH); // motor moves to left rear
digitalWrite(pinRB,HIGH); // motor moves to right rear
analogWrite(pinLF,255);
analogWrite(pinRF,255);
}
void loop()
{ val=Serial.read();
if(val=='U')advance();
if(val=='D')back();
if(val=='L')left() ;
if(val=='R')right();
if(val=='S')stopp();
}

Result
Connected to Bluetooth APP, the movement of the car is controlled by the APP.

Line Follower Robot


1. Arduino Uno - 1Nos

2. L293D motor driver- 1Nos

3. IR sensor module -2 Nos

4. 7.4 or 9V battery -1 Nos

5. BO motor - 2 Nos

6. Motor wheel - 2 Nos

7. Castor wheel - 1 Nos

P a g e 32 | 39
8. Hobby robot chassis - 1 Nos

9. Wires

10. Screws

Apart from the above components you will also need a few tools
like, a soldering iron and solder, wire stripper, screwdriver set, hot
glue gun, etc. Also, it is recommended to have a few additional
components like a battery voltage monitor, power switch , and
extra IR sensor module just in case you want to troubleshoot the
robot later.

Working Principle of Line Following Robot


As stated earlier, a line follower robot (LFR) follows a line, and in
order to follow a line, robot must detect the line first. Now the
question is how to implement the line sensing mechanism in an
LFR. We all know that the reflection of light on the white surface is
maximum and minimum on the black surface because the black
surface absorbs the maximum amount of light. So, we are going to
use this property of light to detect the line. To detect light, either
LDR (light-dependent resistor) or an IR sensor can be used.

For this project, we are going with the IR sensor because of its
higher accuracy. To detect the line, we place two IR sensors one on
the left and the other on the right side of the robot as marked in
the diagram below. We then place the robot on the line such that
the line lies in the middle of both sensors. We have covered a

P a g e 33 | 39
detailed Arduino IR sensor tutorial which you can check to learn
more about the working of IR sensors with Arduino Uno.

Infrared sensors consist of two elements, a transmitter and a


receiver. The transmitter is basically an IR LED, which produces the
signal and the IR receiver is a photodiode, which senses the signal
produced by the transmitter. The IR sensors emits the infrared light
on an object, the light hitting the black part gets absorbed thus
giving a low output but the light hitting the white part reflects back
to the transmitter which is then detected by the infrared receiver,
thereby giving an analog output. Using the stated principle, we
control the movement of the robot by driving the wheels attached
to the motors, the motors are controlled by a microcontroller.

How does a Line Follower Robot Navigates?


A typical line follower robot has two sets of motors, let's call them
left motor and right motor. Both motors rotate on the basis of the
signal received from the left and the right sensors respectively. The
robot needs to perform 4 sets of motion which includes moving
forward, turning left, turning right and coming to a halt. The
description about the cases are given below.

In this case, when both the sensors are on a white surface and the
line is between the two sensors, the robot should move forward,
i.e., both the motors should rotate such that the robot moves in
forward direction (actually both the motors should rotate in the
opposite direction due to the placement of motors in our setup. But
for the sake of simplicity, we will call the motors rotating forward.)

P a g e 34 | 39
Turning LEFT:

In this case, the left sensor is on top of the dark line, whereas the
right sensor is on the white part, hence the left sensor detects the
black line and gives a signal, to the microcontroller. Since, signal
comes from the left sensor, the robot should turn to the left
direction. Therefore, the left motor rotates backwards and the right
motor rotates in forward direction. Thus, the robot turns towards
left side.

P a g e 35 | 39
Turning RIGHT:

This case is similar to the left case, but in this situation only the
right sensor detects the line which means that the robot should
turn in the right direction. To turn the robot towards the right
direction, the left motor rotates forward and the right motor rotates
backwards and as a result, the robot turns towards the right
direction.

P a g e 36 | 39
In this case, both the sensors are on top of the line and they
can detect the black line simultaneously, the microcontroller is fed
to consider this situation as a process for halt. Hence, both the
motors are stopped, which causes the robot to stop moving.

Circuit Diagram and Assembling the Arduino Based Line Follower Robot
The circuit consists of mainly four parts: Two IR sensors, one motor
drive, two motors, one Arduino, a battery and few connecting
wires. The sensor senses the IR light reflected from the surface and
feeds the output to the onboard op-amp comparator. When the
sensor is situated over the white background, the light emitted by
the sensor is reflected by the white ground and is received by the
receiver. But when the sensor is above the black background, the
light from the source is not reflected back to the sensor. The
sensor senses the intensity of reflected light to give an output.

P a g e 37 | 39
The sensor’s output is fed to the microcontroller, which gives
commands to the motor driver to drive the motor accordingly. In
our project, the Arduino Uno is programmed to make the robot
move forward, turn right or turn left and stop according to the
input coming from the sensor. The output of the Arduino is fed to
the motor driver.

Why We Require a Motor Driver?


The reason to use a motor driver here is because the output signal
of an Arduino is not sufficient to drive the motor, furthermore, we
need to rotate the motors in both directions, therefore we use a
motor driver to drive the motor as required and also the motor
driver is able to supply sufficient current to drive the motor. Here,
we are using a L293D motor driver which is a dual h
bridge motor driver and is sufficient for our 2 motors.

The L293D has 16 pins, the pinout of L293D is shown in the below
diagram.

Connecting Motor Driver to Arduino UNO


Pin number 1 and 9 are the enable pins, we connect these two pins
to a 5v input to enable the motor.

Pin number 1A, 2A, 3A, and 4A are the control pins.

For eg. The motor will turn to the right if the pin 1A goes low and
2A goes high, and the motor will turn to the left if 1A goes low and

P a g e 38 | 39
2A high. So, we connect these pins to the output pins of the
decoder.

Pins 1Y, 2Y, 3Y, and 4Y are the motor connection pins.

Note: Vcc2 is the motor driving voltage pin, and only used if you
are using a high voltage motor.

Conclusion
In conclusion, the development of our robot car equipped
with line-following capabilities, Bluetooth sensor integration,
and obstacle avoidance features showcases the successful
application of advanced robotics principles. This project
demonstrates the potential of autonomous systems to
navigate complex environments efficiently and safely.
Through meticulous design and rigorous testing, we have
created a versatile and intelligent robot car that can perform
tasks with precision. This achievement not only highlights the
advancements in robotics but also opens up possibilities for
further enhancements and real-world applications. Our robot
car project serves as a testament to the innovative spirit and
technical prowess driving the future of autonomous systems.

Signature (Students)

Name of evaluator: kanza Abideen

Signature of Evaluator:

P a g e 39 | 39

You might also like