1.1 Introduction

Line following car is a system that traces black lines on white surfaces. There are
various sensing methods available to sense these lines. The choice of these schemes
depends upon sensing accuracy and required flexibility. In my project, I have used 6 Tx
LEDs and 6 IR sensors to accurately calculate the position of the robot on the tape.
Sensors keep sensing the line and microcontroller system will keeps maneuvering the
robot to stay on the course. In addition, microcontroller constantly keep correcting wrong
moves using feedback from previous states, making it an effective closed loop system.
The core of the car is ATMEGA168 microcontroller from ATMEL. To detect the
line, 6 IR LEDS (Tx) and 6 IR sensors (Rx) are used with distance between each sensor is
25mm. The Tx will emit the light, this light will be reflected by the black line and Rx will
receive it. These signals will be sent to microcontroller comparator.
There are many ways to move a car [1]. In addition, I used differential steering
method. It relies on two back-wheels, DC motor is connected to each of the two wheels
on the back and front wheels were kept free for easy turning. For forward drive, both
motors are given same voltage. In addition, for right turn, the voltage on the right wheel
needs to be reduced to decrease the rotation of the wheel. Exact opposite is applied for
left turn.

1.2 Organization of the Report

Chapter two of the report explains the fundamentals of line following and
Obstacle avoiding car structure. It explains in detail about DC Motors, Differential Drive
Mechanism and H-Bridge.
Chapter three gives information about ATmega168 microcontroller. It
summarizes the features of ATmega168 microcontroller. It also explains about
timer/counter registers and specific application of those registers in this project.
Chapter four explains about Ping))) ultrasonic sensor used for object detecting
and avoiding. Use of this sensor in this project and the limitations are also discussed.
Chapter five contains information about the implementation of the algorithm for
object avoiding car. It discusses about various steps of algorithm in detail. Suitable
images are also provided to show output at different stages in applied algorithm.
Chapter six presents the result of the project, challenges, limitations and future
applications are discussed.


2.1 Block Diagram

This car it built using ATmega168, IR sensors, Motor Driver (LM293D) and
aluminum chassis [3]. At the bottom, it has line sensor array to detect the line and send
signal to microcontroller for accurate control and steering of motors. Microcontroller
ATmega168 and motor driver L293D are used to control the motors.

Figure 2.1 Block Diagram of Line Following Car

Basic operations for line following car are as follows:
1) Capture the black line with the help of mounted sensors on the car. The sensors used
are opto-couplers i.e. they consisting of transmitting and receiving LEDs.
2) Steer the car to track the line with differential steering method. This is achieved by
using two DC geared motors.

2.2 Line Following & Obstacle Avoiding Car Structure

Structure of the line following car can be divided into several parts as follows.
• I.R. LEDs and Phototransistor
• DC geared motors
• Motor Drivers
• ATmega168 microcontroller
• Chassis and body structure

2.2.1 I.R. LED and Phototransistor

Sensors are important components in the process of making line follower [3].
There are different types of sensors available to use for line following car. When
selecting sensors, three characteristics should be kept in mind: response time, sensitivity
and ambient light protection.

As I.R. LEDs have good response time [3], they are used as sensors in this
project. Moreover, they are less sensitive to ambient light. A photodiode has a p-i-n
structure. When an infrared photon of sufficient energy strikes on the diode, it excites an
electron and creates free electron and hole. Due to absorption in depletion region of the

junction, holes move toward the anode and electrons move toward the cathode, which
generates photocurrent [4]. The LED and detector have very narrow emission and
detection angles, so their placement is very important. Best method to place them is to
place them in parallel and also close to the track surface. In this case, they are placed
apart by 5-7 mm. Figure 2.2 shows a pair of similar type of I.R LED and sensor.

Figure 2.2 IR Transmitter and Receiver

To get accurate result for line tracing more than one Tx/Rx pairs are used. Use of
fewer numbers of pair will make the car wobble about the line and may not be fast
enough. Figure 2.3 & 2.4 describes this situation in detail.

Figure 2.3 Line Following with Only One Sensor Pair [3]

Figure 2.3 shows most basic algorithm of line following, which includes only one
sensor. The sensor is placed on the right. When sensor detects no line, it will move the
car to the left, after this, when sensor detects the line, it will move the car to right. As a
result, the car with algorithm will wobble along the line and the detection speed will also
be slow. [3]

Figure 2.4 Line Following with more than One Sensor Pair [3]

The modification of the method used as in Figure 2.3 is to use more number of
sensors. If the sensors are used on the both side of the line as shown in Figure 2.4, then

line detection will be less wavering along the line. So if left sensor senses the line then it
will move the car on the left and if right sensor sense the line then it will move the car on
the right [3]. To get more precise line tracing result, Line Sensor Array is used. In this
project, 7 sensors are totally used. They are placed in the form shown in Figure 2.5. The
sensors are mounted on a seperated board along with the biasing amplifiers and a power
is provided with 2 pin connector. Output of each sensor is connected to the main board
via an 8-pin connector to the comparators on the main board. To prevent the interference
among IR sensor, each receiving sensor is covered with black tape.

Figure 2.5 Line Sensor Array

2.2.2 DC Motors

DC motors are widely used, inexpensive, small and poweful for their size. They
are most easy to control. One DC motor requires only two singals for its operation. They
are non-polarized, means you can reverse the voltage without any damage to motor. DC
motors have +ve and –ve leads. Connecting them to a DC voltage source moves motor in
one direction (clockwise) and by reversing the polarity, the DC motor will move in

opposite direction (counter clockwise). The maximum speed of DC motor is specified in
rpm (rotation per minute). It has two rpms: no load and loaded. The rpm is reduces when
moving a load or decreases when load increases. Other specifications of DC motors are
voltage and current ratings. Table 2.1 shows the specifications of the motor used in the

Table 2.1 DC Geared Motor Specifications

Speed of the motor can be changed by changing the applied voltage across motor.
DC motors don’t have enough torque to drive the car directly by connecting wheels with
it. As noticed in table 2.1, the torque provide can hardly move 30 gm of weight. This is
not acceptable if requred load capacity is in Kgs. To achieve more torque by gears, the
speed will be reduced and effectively increase the torque. One more advantage of using
gearbox motors instead of DC motors is it has gears and an axle, so speed does not
change towards uphill or downhill. It is noteable that the more speed is, the less precesion
will be. Figure 2.6 shows the DC geared motor used in this project.

Figure 2.6 DFRobot 6V DC Geared Motor

2.2.3 Differential Drive Mechanism

This is the most common locomotion scheme used for building cars. It is a
method of controlling a car with only two polarized wheels. It is easy to build, easy to
control and permits the car to move in all directions. In this method two motors are
connected to each left and right wheels at car’s base. These two motors are responsible of
driving the car in desired direction. This system allows car to spin in its place [6].

Figure 2.7 Differential Drive Mechanism [7]

The term “differential” means that car’s turning speed is determined by the speed
difference between both wheels. Figure 2.7 shows in a simplified way the principle of
operation of differential drive. If both motors rotate in the same direction at equal speeds
the car will move forward or backwards based on the rotation of the wheel. If the speed
of one motor is faster then the other, the car will turn in the direction of the slower motor.
If both motor rotates in opposite directions, the car will spin in its place [7].
This kind of two wheel differential drive system needs one or more caster wheels
(free wheels) to support the rest of the chassis while freely following the movement of
the robt engaged by the two main drive wheels. In this perticular project, only one caster
was enough. It is shown in Figure 2.8.

Figure 2.8 Ball Caster

2.2.4 H-Bridge

H-Bridge is an electronic circuit which enables a voltage to be applied on either
side of the load and the H-bridge DC motors allow the car to run backwards or forwards.
H-Bridge is a configuration of 4 switches, which switch in a specific manner to control
the direction of the current through the motor. Figure 2.9 shows simplified H-bridge as
switches. The states of these four switches can be changed in order to change the voltage
across the motor, of the current flow and the rotation of motor [7] [8].


About The Author

Muhammad Bilal

I am highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Scroll to Top