Why make a line follower? Ans:As human beings , we respond to stimuli.Our actions are due to the feedback given by our sensory organs.A line follower is the simplest way to demonstrate that. Sensing a line and maneuvering the robot to stay on course, while constantly correcting wrong moves using feedback mechanism forms a simple yet effective closed loop system.*Before you go through this tutorial , it is highly recommended you go through the tutorial on microcontrollers and have a fair idea on the basics. Uc used in the tutorial is based on avr architecture. Advantages of uc :
In the tutorial on line following using logic gates etc we have observed that we switch off one motor one let the other move till the bot corrects itself.There are a fewdisadvantages in this : 1.Your intensity of correction completely depends on the distance between the two motors.Since one is stationary and the other is moving , their distance forms the radius of curvature that the machine takes while correcting itself.Now the path can be completely irregular.For every irregular curve you will get very inefficient line following.You machine will simply wobble along itspath wasting power,time etc. With a uc, you can actuate a motor to run at a certain rpm and the other to move at another .This can generate any radius of curvature and give the most efficient line followers as you see on youtube videos.
Basic Block Diagram *You can use external LM324 when you are using a large array of sensors and assign weights to each sensor(explained ahead).But it isrecommended to use the ADC of the uc. You can also use an l293d or some other driver in place of the l298. Building the line follower : Before we begin , lets get to know a few terms that will be used ahead : Error : Your machine being exactly on the line with the respective sensors being on the either side of the line denotes zero error.While if the sensory array is on one side of the line denotespositive error and on the other side
denotes negative error.
Correction : Denotes the magnitude of the parameter needed to bring the system to zero error.
So our job basically boils down to finding the error term and the correction term and to reduce the error to zero. Sensors : It has been observed that to attain efficient line following for any track we need not more than two sensors oneither sides of the line for motors with speed within 500rpm( Lamington Dc motors).But it is upto the maker on the number of sensors , the quality of the motor etc. 1.Please refer to the tutorial for line following for beginners to make the
sensors and placing the sensors on the board. 2.Do not feed the values to the comparator(LM324) and take the analogue values to the uc starightaway if using ADCof uc.(Refer datasheet of your uc ). 3.Every photodiode behaves differently from the other photodiode.So we have to claibrate our sensors(in our code) so that the logical part of the code deals with the same range for every sensor. Driver hardware: 1.Pwm signals to the input pins of the driver will drive the motor at a rpm dependent on the duty cycle of the pwm. 2.We can configure different pinsof the uc to generate pwm signals or use pins that are pwm generators. 3.We can send pwm signals to the enable pins of the driver or to the input signals of the driver.It does not make much of a difference just that in former case we need two pwm generators for bidirectional control of two motors(one each) and for the latter case we need four pwm channels for bidirectional control of twomotors(two for each). Algorithm: Note: This discussion of PID is intended for hobby robotics and line following. It is not a perfect example of PID and is simplified in some aspects to make it easier to understand. If you are looking for more detailed information, perform a Google search on "PID controller" for numerous sources of information. We sample our sensor inputs and generate ADC values of each...