25
LINE FOLLOWER ROBOT BY:- YASH PATEL Computer engineer

Line follower(theory + coding + videos)

Embed Size (px)

Citation preview

Slide 1

LINE FOLLOWERROBOTBY:-YASH PATELComputer engineer

INTRODUCTION A line follower, as its name suggests is a robot that is capable of following a predefined line using sensory devices. A line follower should have the following essential parts to it:Locomotion system.Sensor Circuit.Processing unit.

LOCOMOTION SYSTEM Robot locomotionis the collective name for the various methods thatrobots use to transport themselves from place to place. A major goal in this field is in developing capabilities for robots to autonomously decide how, when, and where to move. Autonomous robot locomotion is a major technological obstacle for many areas of robotics, such as humanoids.

SENSORY SYSTEMThe most common features for following line for a robot is reflectance of a surface.Different intensities of reflection of light from surface makes the robot to follow a line. Example(white surface reflect light and black will absorb light).To read that difference we use sensor circuit consists of LEDs(light emitting diodes) and LDRs(light dependant resistors).An LDR is a small resistor, the resistance of which depends upon the intensity of light incident on it. More the intensity of light falling on it, lesser is its resistance. The resistance usually varies in the range of about 10k ohms.

WHAT NEXT??We know that what main things will be required but now how it works?When led throws the light it is reflected detected by the LDRs on the detection of light it gives output as 1.When no light is reflected then LDR will return 0 as output.

SYSTEM WHICH IT FOLLOWS

CONT..If robot is following white line on black background.

Left sensorRight sensorLeft motorRight motor111110010110

HOW ITS WORK

MATERIAL REQUIREDArduino board.IR sensors.Jumper wires.4 motors.

IR SensorCircuit for IR Sensors

BEFORE CODINGWHAT IS PID?PID is an acronym for Proportional Integral Derivative., these terms describe three basic mathematical functions applied to the errorMain task of the PID controller is to minimize the error of whatever we are controlling. It takes in input, calculates the deviation from the intended behaviour and accordingly adjusts the output so that deviation from the intended behaviour is minimized and greater accuracy obtained.

WHY TO IMPLEMENTThe idea behind PID control is that we set a value that we want maintained, either speed of a motor or reading from a sensor. We then take the present readings as input and compare them to the setpoint. From this an error value can be calculated, i.e, (error = setpoint - actual reading). This error value is then used to calculate how much to alter the output by to make the actual reading closer to the setpoint.

CONT..If 3 sensors are used then,If the centre sensor detects the line the robot steers forwardIf the left sensor detects the line the robot steers right If the right sensor detects the line the robot steers left.

HOW TO IMPLEMENT IT?TERMINOLOGYThe basic terminology that one would require to understand PID are:Error - The error is the amount at which a device isnt doing something right.Proportional (P) - The proportional term is directly proportional to the error at present.Integral (I) - The integral term depends on the cumulative error made over a period of time (t).Derivative (D) - The derivative term depends rate of change of error.Constant (factor)- Each term (P, I, D) will need to be tweaked in the code. Hence,they are included in the code by multiplying with respective constants.P-Factor (Kp) - A constant value used to increase or decrease the impact of ProportionalI-Factor (Ki) - A constant value used to increase or decrease the impact of IntegralD-Factor (Kd) - A constant value used to increase or decrease the impact of Derivative

CONT..Position = (Weighted average of reading of sensor)/(sum of reading of sensors)Error = position set_pointPosition is calculated for every position of robot on line. Set_point is a fixed point at which robot is straight on a line.Error is generated by the difference of two.

PROPOTIONAL ERRORWe would need to simply add the error value to the output to adjust the robots motion. And this would work, and is known as proportional control (the P in PID). It is often necessary to scale the error value before adding it to the output by using the constant(Kp).Difference = (Target Position) - (Measured Position)Proportional = Kp*(Difference)But on increasing constant Kp it will only make robot to follow a line but for large error robot will start wobbling, to stop that we have to adjust differential coefficient.

DERIVATIVEIt provides the rate of change of error.It makes us know how error changes time to time, so that output can be set.Rate of Change = ((Difference) (Previous Difference))/time intervalDerivative= Kd *(Rate of Change)

INTEGRALThe integral improves steady state performance, i.e. when the output is steady how far away is it from the setpoint.It improves the accuracy of robot to follow the line.Integral = Integral + Difference//(propotional)Integral = Ki*(Integral)

TermExpressionEffectProportionalKp x errorIt reduces a large part of the error based on present time error.Integralerror dtReduces the final error in a system. Cumulative of a small error over time would help us further reduce the error.DerivativeKd x derror / dtCounteracts the Kp and Ki terms when the output changes quickly.

CODE FOR POSITION AND ERROR

CODE FOR MOTOR CONTROL

VIDEOS