PID Controller based Line Following and Obstacle Avoidance Two Wheeled Robot

DOI : 10.17577/IJERTCONV7IS02026

Download Full-Text PDF Cite this Publication

Text Only Version

PID Controller based Line Following and Obstacle Avoidance Two Wheeled Robot

K. K. Suriya Kumar, S. Kalayappan, M. Keerthana, P. Balasurya, S. Julius Fusic

Department of Mechatronics Engineering, Thiagarajar College of engineering, Madurai, India.

AbstractThis paper presents the development of an obstacle avoided for two wheeled robot more accurately than existing sensor interfaced robot application. In this project Arduino UNO is used as the main controller to react towards the radiations received from ultrasonic sensors and makes the robot to move safely without any collision with the obstacle. A dynamic PID control algorithm has been proposed to increase the accuracy of finding obstacles which will be very useful for the physically disabled. The experimental results show that the R1 dynamic PID algorithm can be performed under the system real time requirements.

KeywordsArduino, PID control algorithm, ultrasonic sensor, wheeled mobile robot.


    It is a mobile robot system where it can automatically sense and overcome obstacles on its path. It is mainly designed for performing various tasks for the physically disabled.

    It uses ultrasonic sensors to detect the obstacles on its path [1]. The ultrasonic sensor senses if any obstacle is presented and it passes the signal to the microcontroller. The microcontroller performs functions according to the coding which we have given and it pass the information to the motor drive. The motor drive alternate the speed of the motor as required and it is send to the two actuators [2]. This paper presents about the introduction of PID (Proportional-Integral-Derivative) controller in obstacle avoidance. Each of these element performs a different function and has unique property while finding obstacle, travels away from the obstacle, finding a proper pathway and start / stopping a motor. By using this technique there will be more accuracy while finding an obstacle and make it to move away from it. So it will very helpful and secured method for physically disabled [3].and not as an independent document. Please do not revise any of the current designations.

    Digital pins D4, D5, D6 and D7 of arduino. The output pins are connected to two DC motors. Power are given to 5v and all the grounds are connected to vin of arduino and negative of the battery is connected to Gnd of arduino.

    Fig 1: Block diagram for obstacle avoidance system


      1. Obstacle avoided robot:


        1. Block diagram:

    Obstacle avoider:

    Components used here is arduino, motor drive, ultrasonic sensor, servo motor, two DC motors and a battery.

    The positive of the servo motor is connected in vcc of ultrasonic sensor and the negative is connected to the ground. In ultrasonic sensor, the trigger is connected to the analog to 5v and GND of arduino. In motor drive the 4 input pins are connected to






    l o c k

    d i a g r a





    l o c k

    d i a g r a

    Fig 2: Flow diagram for obstacle avoidance system

    When the bot has started to move its own path the ultrasonic sensor senses whether the obstacle is presented or not. The ultrasonic sensor is attached with servo motor to check the obstacle in the surroundings. If the sensor senses any obstacles the bot is stopped then the servo motor rotates in left and right direction to check the obstacle. After the checking has been over the bot moves 100cm. Backwards then turn to the side where there is no obstacle.

    Fig 3: Flow diagram for line following robot

    When the robot get started to move, the IR sensors senses the line. If it is a black line then the motor started to move forward in a black line. If there is any error in the detection of black line i.e. fi the sensor not exactly senses the black line then it goes to the PID controller concept and make some calculations in order to reduce the error. According to the error occurred by the calculations, the left and right motor speed will alter in order to make the sensor to sense the line exactly and it started to move in a black line.


    PID controller algorithm is the algorithm of partial integral derivative controller. Where is control loop feedback mechanism widely used inn industrial control systems and also in other variety applications. Where other applications requires a continuous modulated control with the help of PID calculation we can able to calculate the set point. Where the P controller means to reach the set point with maintaining the perfect track. I controller means future controller. It comes like advanced controller, which responds to the error suddenly. D controller means delay controller, which response to the error with some delay time.


    The Arduino board is a combination of microprocessor and is having both analog and digital input/output. There is a further communication cable from the board to the PC(personal computer) for programming

    that is called Universal serial Bus(USB). The Arduino can be programmed using embedded C or C++ project.

    Fig 4a}: Arduino board 4b) Ultrasonic sensor

    The ultrasonic sensor works on the similar principle of sonar or radar i.e, which works on the echoes of radio waves or sound waves .It has the capability of generating high frequency sound waves. This sensor will calculate the time interval between the sending and receiving of signals to identify the object .where ,the sound generation will be 18000 Hertz, which turns electrical energy into sound…where the coming echoes will be turned into electrical energy and it will be measured. L293d motor drive allows the motor drive to drive on either is a 16 pin IC so it can control two motors at a consists of two h bridge circuit inside the ic which has the capability of rotating two motors simultaneously. H bridge is used to allow the voltage in either direction. The motors will be rotating based in the logic input as 0 and 1. For the clockwise rotation the inputs has to be provided with LOGIC 1 and LOGIC 0.the enable pin 1 and 9 should be high so that the associated drives gets enabled this is

    Fig 5a}: L293D driver 5b) servo motor

    the working of L293D. The servo motor may be rotary or linear that follow for angular or linear position. This sensor is coupled with suitable sensor for maintaining its doesn't come under any specific type of works on the closed-loop servo-mechanism. This motor has been paired with a type of encoder to give speed feedback and position.

    The IR radiation is an electromagnetic wave which has its wavelength of 700nm to 1mm.these sensor detect IR radiation or change in the radiation from outer source or inbuilt source.

    It is used to detect the changes happening in the surroundings. The SIR sensor will have emitter and receiver which is placed in a manner that the emitted IR falls directly into the receiver. During this process there will be continuous emitting of IR beam. The DC Motor works only on the DC current. Where it has the major components of stator and an armature. The armature is the windings of insulated wire over a soft core. The end will be connected to the commutator. The commutator allows the armature to get energized and it connects the rotating coil with external output has the capability of developing high torque at low speed.

    Fig 6: DC motor for driving wheels


    The obtacle avoidance robot is programmed with normal arduino coding using ultrasonic sensor as a comparison purpose in evaluating the performance of the dynamic algorithm used in obstacle avoidance robot. The results of the experiment are summarized in Table-1. From the data in the table, it can be observed that dynamic PID algorithm used in obstacle avoidance robot has better performance in every criteria listed in the table compared normal coding obstacle avoidance robot. PID algorithm based obstacle avoidance robot is built from the combination of normal obstacle avoidance robot and dynamic PID algorithm based obstacle avoidance robot has higher accuracy, higher velocity and less time to detect the obstacle as compared to normal obstacle avoided robot. Therefore, this system can be used in training undergraduate students.

    Fig 7: The designed obstacle avoided robot

    The dynamic PID algorithm has its application and implementation in the real world and the advantages it offers. The below mentioned figure shows the designed PID controlled obstacle avoided robot used in the environment.

    Fig 8:The designed line follower robot:

    Table 1: Experimental results for obstacle avoided robot


The designed obstacle avoided robot has an ultrasonic sensors on the top of a servo motor. The controller board includes Arduino UNO and motor drive L293D which were used to control the direction and speed of motors. The proposed dynamic PID algorithm used in finding the obstacle in a less time with more accuracy. Experimental results show that the proposed algorithm can successfully achieve in finding obstacles, for even more distance and detect the obstacle in less time. We are working currently to develop a more sophisticated algorithm which can performance faster obstacle detection with less energy consumption.


  1. Kiran kumar lekkala and Vinay kumar mihal, PID controlled 2D precision robot @ 2014 IEEE.

  2. Zhang zhang, Wang li, Li lihua, Design and implementation of Two-wheeled mobile robot by variable structure sliding mode control, proceedings of the 35th Chinese control conference July 27-29, 2016, Chengdu, China.

  3. Vikram Balaji, M.Balaji, M. Chandrasekaran, M.K.A. Ahmed khan, Elamrazuthi Optimizatonof PID control for high speed line tracking robots 2015 IEEE International symposium on robotics and intelligent sensor (IRIS 2015)

  4. Ledin, Jim, Embedded control system in C/CH, CMP Books.

  5. Chan, Desktop line following robo, Accessed May 26, 2015.

Leave a Reply