Line Tracking is a Very Important Notion in the World of Robotics as It Give to the Robot a Precise

Embed Size (px)

Citation preview

  • 8/2/2019 Line Tracking is a Very Important Notion in the World of Robotics as It Give to the Robot a Precise

    1/16

    Line tracking is a very important notion in the

    world of robotics as it give to the robot a

    precise, error-less and easy to implement

    navigation scheme.

    As you may have seen, many robotics competitionspromote this concept, by adding lines on theplayground for the robot to follow, or sometimes, thesole purpose of the competition is to race with otherrobots following a line along a track.

    In this tutorial, I am going to rely on the experienceachieved by building the line sensors of the robots thatparticipated to the robocon 2007 competition.

    1. Number of cells in a sensorA line sensor is one that will gather information about the position of a line traced on the groundunderneath the robot, to help it to navigate through an eventual grid of lines and intersections. For thesoftware to function correctly, the sensor's electronic circuits have to provide a maximum number ofinformation about that line.

    As you can see in figure 1, a line sensor is composed of a numbercells and each cell is composed of a sender and a receiver. Theparticularity of this sender/receiver pair, is that it sends light thatshall be reflected by the line to be detected but not by theeventually opaque background surrounding this line. Anysender/receiver pair that is able to make a difference between aline and the rest of ground (of a different color) can be used in a

    line sensor.

    Usually, to make it easier on the designer of the sensor, there is animportant contrast between the line and the ground (for example:white line on a dark blue ground), But in case there isn't enoughcontrast, there is a method to easily build a line sensor adapted tothat specific situation, relying on old physics rules Figure 1that states that a colored surface will absorb the light of different colors, and reflect the light of thesame color. For example, If you want to build a line sensor to detect white lines drawn on a light bluefloor, you can send red light, as the blue will absorb all of it, and the white line will reflect all of it.Actually this was the case in the playground of Robocon 2007 competition, there wasn't enoughcontrast between the white lines and the blue ground, so we had to use RED LEDs as senders instead ofour preferred IR LEDs

    So the first aspect that affects the precision and the quality of a line sensor, is the number of cells.Some roboticists use only 2 cells to know whether the line is at the left or at the right of the robot, butas you shall see later in the software part, this very poor source of information wont allow thecontroller to gradually guide the robot back on the track, instead you will notice that the robot will keepbrutally turning right and left, but will never be able to smoothly follow the line. On the other hand, an8 cells line sensor will give a spectrum of relatively rich information to the controller, indicatingwhether the robot is very close to the line, close, far, or very far away. This variety of information willallow the controller to take actions that are proportional to the distance between the robot and the line,resulting in a smooth line tracking system.

    2- Distance between the cellsThe second aspect the be considered when building a line sensor, is the cell spacing (or the

  • 8/2/2019 Line Tracking is a Very Important Notion in the World of Robotics as It Give to the Robot a Precise

    2/16

    distance between a cell and the other). To understand the effect ofcells spacing, consider the differential drive robot shown in figure2, with an 8 cells line sensor, whose cells are numbered from 1 to8 (from the left to the right). Three different situations are shown,In the first one, the cells 4 and 5 detect the line, indicating that therobot is perfectly centered on the line. In the first situation, the

    spacing between the cells is not very critical, but if the robotaccidentally makes a 10 turn away from the line (secondsituation), you will notice that only the cell number 6 detect theline, which is the only indication that the controller will haveabout that 10 error. This means that, most probably, an errorsmaller than 10 wont even be noticed.

    But in the third situation, the cells are closely collated together,and you can notice that with the same 10 deviation from the line,the sensor's cells 6 and 7 detected the line, leaving some otherpossible states in between the perfectly centered position and the10 deviation. In other words, the closer are the cells from eachothers, the more will be the resolution of the sensor.

    The same effect can be observed by changing the distancebetween the sensor and the center of steering. In general, It isimportant to always try to keep the sensor as far as possible fromthe center of steering, which is the back of the robot in adifferential steering one, because this will also help to amplify thedeviation detected by the sensor, resulting in a better response

    Figure 2

    from the controller.

    3. Building the sensorThere are many electronic components that can be used to build the sender/receiver cells of a linesensor. Two of them are discussed in this article, showing the advantages and disadvantages of eachone, and showing how to implement each one of them in an electronic circuit.

    IR LEDs LDRs and LEDs

    This method relies on our famousIR proximitysensor with some modification. It has the advantageof being cheap and easy to implement, butunfortunately need an important contrast betweenthe line and the ground. Refer to the thistutorialformore information.

    When you need to adapt to low contrast situations,as discussed before, this is the most commonalternative. You chose the most suitable color ofLED for sending the light, then, the LDR will pickup the reflected light, but it's slower to respondthan IR LEDs.

    Figure 3.A: One cell implementation Figure 3.B:One cell implementation

    http://ikalogic.com/ir_prox_sensors.phphttp://ikalogic.com/ir_prox_sensors.phphttp://ikalogic.com/ir_prox_sensors.phphttp://ikalogic.com/ir_prox_sensors.phphttp://ikalogic.com/ir_prox_sensors.phphttp://ikalogic.com/ir_prox_sensors.phphttp://ikalogic.com/ir_prox_sensors.php
  • 8/2/2019 Line Tracking is a Very Important Notion in the World of Robotics as It Give to the Robot a Precise

    3/16

    D1: Emitter LEDD2: Receiver LED

    R6: Sensitivity adjustment D1: Emitter LED R1: Sensitivity adjustment

    After a lot of experiments, I personally recommend the LDR based line sensor because it can be easilyadapted to many different environments by adjusting the sensitivity using the potentiometer R1 or bychanging the color of the LED D1.

    Here is the electronic circuit of the LDR based line sensor we used in our robots in the Robocon 2007competition. As you can see it is composed of eight cells, each one resembling the cell in figure 3.B.There are many reasons to choose to build a sensor with exactly eight cells, no more, no less: Eight canprovide enough precision, it connects directly to one port of the microcontroller, and is represented byone single Byte of data, making it easier to implement in the programming and in the memory of an 8bit microcontroller.

    Figure 3.C

    The wire connections W3 to W10 are the outputs of the 8 cells of the sensor.

    The value of R1 to R9 cannot be lower than 50 ohm, actually this value is very low and that's why the

  • 8/2/2019 Line Tracking is a Very Important Notion in the World of Robotics as It Give to the Robot a Precise

    4/16

    sensor sinks a lot of current. You may try to use larger values first, like 220 ohm, then if the intensityof the light is not en ought, reduce it gradually.

    You will also notice that there are 9 sender LEDs (not 8), that's because the the LEDs and the LDRs arepositioned in such a way that each LDR has one led on its right and another on its left (as you can seein figure 3.D). The purpose of this technique is to make sure all LDRs share the same reflected light

    intensity, and this way, only one potentiometer can be used to calibrate all of them.

    Figure 3.D

    4. Proportional Control AlgorithmsNow that your sensor is working and is providing a correct reading of the line underneath it, you stillneed to develop some algorithms to use the data collected from the line sensor. The quality of thosealgorithms is as important - if not more important - than the quality of the sensor it self. Its thosesoftware procedures that will give to the robot the ability to smoothly and correctly track lines in a gridof lines and intersections, perform 90 turns and many others moves that can be implemented in such a

    lines grid.

    Proportional Control, which is usually used in line following algorithms, means that the intensity of therotation of the robot towards the line is proportional to the distance between that robot and the line. Inother words, if the center of the robot is positioned exactly on the line, the rotation of the robot will beequal to zero, but if the robot gets deviated from the center of the line, the intensity of the rotation willgradually increase, until it reaches maximum intensity if the line is completely out of reach. Thisproportional Algorithm will prevent the robot from oscillating to the right and to the left of the linewhile trying to follow it.

    What I mean by the intensity of rotation, is the speed at which the wheels will turn (in a differentialsteering robot) or the angle of the front wheel (in a car-like steering robot).

    This may be true in theory, but in practice, due to the non-linearity of the behavior of DC motors, andmany others sources of error that cannot be clearly defined, the robot would still oscillate while tryingto track the line, and would sometimes fail, because the error would eventually increase instead ofdecreasing. That's why the proportional control scheme have to be tailored for each robot, dependingon it's moment of inertia, on the type of motor, on it's weight and on many other factors. After lot oftesting, the graph in figure 4.A shows a control scheme that proved to work correctly on mostdifferential steering robots.

  • 8/2/2019 Line Tracking is a Very Important Notion in the World of Robotics as It Give to the Robot a Precise

    5/16

    Figure 4.A represents a relation between the speed that should beapplied on the right and left wheels of a differential steering robotand the position of the line relative to the center of the robot. Asyou can see, for an 8 cell line sensor, the line is considered to beat the center of the robot when it reads 4.5, while it is consideredto be totally at the left when the first cell of the sensor is detecting

    the line.

    The only thing you may have to to do, is to define the value ofSmax suitable to your robot. The easiest way to do this is by trialand error. You will probably notice that High values of Smax willresult in very fast response, but with a lot of oscillations.

    Figure 4.A

    An important question is how to obtain analog readings from such a digital output line sensor? Theanswer is we actually don't obtain real analog signals, we just calculate an average of the position ofthe line, when more than one cells detect the line. For example, when cells number 4 and 5 detect theline, the average of 4 and 5 is 4.5, and we will consider this value as the reading of the line to be usedin the graph of the figure 4.A. Depending on the thickness of the line being tracked, you can optain a

    multitude of readings between a integer and the other.

    In order to precisely control the speed of the motors in a differential drive robot, you need to adaptwhat is called closed loop speed control of DC motors, which is explained in detail in this tutorial.

    For a 8051 microcontroller programmed in C, here is an example source code of a function namedfollow_line() which when called, reads the value of the sensor which is connected to port 0, calculatesthe average then deduces the required speed of the right and left wheels to smoothly adjust the robot tothe line.

    follow_line(){max_speed = 8;half_speed = 4;

    line_to_speed_factor = (max_speed) / 4.5;

    //The line sensor is connected to P0if (P0 != 0 ){ //Keep the old line reading in case the line is lostold_line = P0;}new_line = P0;l1 = P0_0; //Store the values of each cell of the 8 cells of thel2 = P0_1; //line sensor in the variables l1 to l8.l3 = P0_2;l4 = P0_3;l5 = P0_4;l6 = P0_5;

    l7 = P0_6;l8 = P0_7;fwd(); //Call a function that orders the robot to move forward

    if (P0 == 0){ //In case the line is out of reach, rely on the last validif (old_line > 45){ //reading to decide whether to pivot right orpivot_left(); //left to reach the line again.req_right_pulses = max_speed;req_left_pulses = max_speed;}else{pivot_right();req_right_pulses = max_speed;req_left_pulses = max_speed;

    }}else{

    http://ikalogic.com/tut_closed_loop_spd_ctrl.phphttp://ikalogic.com/tut_closed_loop_spd_ctrl.phphttp://ikalogic.com/tut_closed_loop_spd_ctrl.php
  • 8/2/2019 Line Tracking is a Very Important Notion in the World of Robotics as It Give to the Robot a Precise

    6/16

    if(old_line != new_line){//Calculate the average reading of the line.

    line = (l1) + (l2*2) +(l3*3)+(l4*4)+(l5*5)+(l6*6)+(l7*7)+(l8*8);line = line / (l1+l2+l3+l4+l5+l6+l7+l8);//Calculate the required right and left speed//according to the graph.

    req_right_pulses_ = floor((line*line_to_speed_factor)+0.5);req_left_pulses_ = floor(((9-line)*line_to_speed_factor)+0.5);

    if (req_left_pulses_ > max_speed){req_left_pulses = max_speed;

    }else{req_left_pulses = req_left_pulses_;

    }

    if (req_right_pulses_ > max_speed){req_right_pulses = max_speed;

    }else{req_right_pulses = req_right_pulses_;

    }}

    }}Note that this code is not stand-alone, it is a part of more complicated program that contains the theclosed loop speed control and many other functions allowing the robot to navigate according to aspecific path. for example, the values 'req_left_pulses' and 'req_right_pulses' have to be fed to theclosed loop speed controller.

    You will also notice that the speed is calculated in two steps, the first result is stored in'req_right_pulses_' then the final result is stored in 'req_right_pulses'. This is because the graph infigure 4.A is composed of two independent linear relations, the first is for the readings from 1 to 4.5,and the other relation is for the rest of the readings, 4.5 to 8, (and the same applies to the

    'req_left_pulses' variable). This is just an example, there are many ways to implement such a graph intoa microcontroller program, it's up to you to see the most suitable method according to the architectureand organization of your program.

    5- Navigation through lines and intersectionsNow that you know how to make your robot follow a line, you can use that same sensor toallow it navigate through a grid ofhorizontal and vertical lines as theone in figure 5.A, using the same 8cells sensor.

    The main clue to an errorlessnavigation in such a maze, is to beable to precisely detect intersections.To do that, first you have to analyzethe nature of those lines, the angle ofintersections, and the differentreadings of the line sensor whencrossing intersections. Actually, youhave to adapt your code to each andevery playground you expect yourobot to navigate on.

    After a lot of testing we developedthis simple technique to detectintersections, whatever the way therobot crosses it.

    Figure 5.A

  • 8/2/2019 Line Tracking is a Very Important Notion in the World of Robotics as It Give to the Robot a Precise

    7/16

    As you can see in figure 5.B, three different situations are shown,in each one of them, the robot crosses an intersection, comingfrom a different angle. The cells of the line sensor that detect theline are designated by bright red spots, while cells that don'tdetect it are designated by dark red spots.

    What we tried to do is to find what is common between those 3different possibilities, and the following rule was developed todetect intersections:

    'If one of the end cells (1 or 8) detects the line while one or moreof the last 4 cells at the other end also detect the line, then thesensor is crossing over an intersection'

    In other words, for an intersection to be validated, the reading ofthe sensor must be as follow:

    Cell number 1 detect the line AND one or more of the cells 5 to 8

    detect the line

    OR

    Cell number 8 detect the line AND one or more of the cells 1 to 4

    detect the line

    Then you have to develop the code that will analyze the readingsof the sensor, count intersection, and guide your robot through Figure 5.B

    the desired path, which can be done with a multitudes of methods. The choice of the method to guide arobot, and precisely localize it in a map can be very difficult task, even if you are using line followingalgorithms. Some methods will even involve a combination of dead reckoning and line following toachieve more accurate results. Generally, it's your job to design the navigationscheme which is most suited to theenvironment of the robot. It's important tonote that robot navigation is subject to manyresearch and is still in an intensivedevelopment phase in the robotics labsaround the world.

    I hope this article covered the main aspectsrequired to construct a simple robotnavigation system based on line followingalgorithms and helped to introduce some ofthe scientific principle behind the operationof such a system.

    D

    http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28
  • 8/2/2019 Line Tracking is a Very Important Notion in the World of Robotics as It Give to the Robot a Precise

    8/16

    This small line follower robot, was designed to be

    easily built at home without any special

    equipment, and using a minimum number of

    mechanical parts. You wont need more than 2

    small motors, 2 free wheels and a piece of pcb (to

    hold the micro-controller, the motors driver andthe line sensor) and sure.. your soldering iron!

    The main trick making this design simple and affordable, isthat the robot's chassis is actually the main board of therobot, where some supports for the wheels - also made ofsmall parts of copper boards - are soldered to it. All themotors, and the skids are mounted on the main PCB. For anelectronics hobbyist, PCB manufacturing is a skill that will

    be learnt sooner or later, so this design lets you use your experience in PCB manufacturing to design ahigh precision chassis for your robot.

    In case you're not familiar with line following algorithms, it is recommended that you read that tutorialabout line tracking sensors and algorithms before reading this article.

    1-Overall Design

    Fig. 1.A

    Figure 1A shows a 3D graphical representation of the robot, where different parts can be clearlyidentified according to the following table:

    Part # Description

    1 The base of the robot, also the main PCB.

    2 Front skid

    3 Free Wheel, shaped as a pulley4 Plastic pulley

    http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://www.ikalogic.com/phpBB3/viewtopic.php?f=16&t=28http://ikalogic.com/tut_line_sens_algo.phphttp://ikalogic.com/tut_line_sens_algo.php
  • 8/2/2019 Line Tracking is a Very Important Notion in the World of Robotics as It Give to the Robot a Precise

    9/16

    5 Battery holder

    6 Pipe clamp use to hold the motors

    7 Ni-Cd 7.2V battery pack

    8 1200 rpm 6V motor

    It is clear that the drive train of this robot is differential type, meaning the two rear wheels areresponsible of moving the robot forward and backward, but are also used to turn the robot in anyrequired direction depending the difference of speed between the right and left wheels.

    The first thing that need some explanation is the fact that there are only 2 wheels, Well, while not beingthe best thing to do, a caster wheel can sometimes be replaced with a skid, when the robot weight andsize are not important, and when the robot is designed for indoor environment, where the robot canmove on relatively smooth surfaces, where friction wont be a serious problem.

    It may seem strange that the battery was placed on the top of the robot, and it is actually an importantmistake, as a battery at that height totally destabilize the robot because it raises the center of gravity,increasing the moment of inertia. For more information about robot stability and moment of inertialread this tutorial. For this size of robot, a smaller li-ion battery, placed beneath the robot, would have

    given much better results.

    2-The chassis

    http://ikalogic.com/tut_mech_1.phphttp://www.tkqlhce.com/click-2978450-10303874http://www.jdoqocy.com/click-2978450-10298731http://ikalogic.com/tut_mech_1.php
  • 8/2/2019 Line Tracking is a Very Important Notion in the World of Robotics as It Give to the Robot a Precise

    10/16

    Again, in figure 2.A, a graphical layout ofthe main PCB was used rather than a pictureto make it is easier to differentiate betweendifferent parts of the PCB.

    As you may have notices, the main board

    has a dual function: Electrical andmechanical. From the mechanical point ofview, this boards is the chassis of the robot,where the motors, the wheels and theelectronics are mounted. You can see infigure 2.A that the holes to be used to fix themotors are present on the layout, as well asthe holes to mount the front and read skids.Using PCB layout software to design thechassis, as well as PCB techniques tomanufacture it, gives a lot of accuracywhich is very important for the mechanicalsystem to work correctly. You can see that

    the line sensor is integrated in that samemain board. It's important that the linesensor be as far as possible from the drivewheels in a differential steering robot. Thisprinciple is explained in detail in this articleabout line tracking sensors andalgorithms.

    There are many kinds of materials fromwhich the copper plated boards are made.Try to choose a relatively thick one for thischassis, to be able to bear the weight of the

    motors and the batteries, all concentrated infour points, where the screws are fixed. Fig. 2.A

    3-The wheelsThe wheels in this design also have a dual function, they act as a wheel andas a pulley, with which power is transmitter from another smaller pulleyusing a rubber belt.

    Those wheels were originally free wheels used in sliding doors andwindows. they are small, cheap and can bear very important loads. Theyhave been modified as shown in figure 3.A so that they can be fixed to the

    chassis using those 4mm standard screws. Note that the wheel is still freeto rotate around the axe of the screw, so the only way to transmit power tothat wheel will be though a belt directly mounted on it, as you shall seelater. Fig. 3.A

    You can also notice that the wheels are mounted on the chassis using small rectangular pieces

    http://ikalogic.com/tut_line_sens_algo.phphttp://ikalogic.com/tut_line_sens_algo.phphttp://ikalogic.com/tut_line_sens_algo.phphttp://ikalogic.com/tut_line_sens_algo.phphttp://ikalogic.com/tut_line_sens_algo.php
  • 8/2/2019 Line Tracking is a Very Important Notion in the World of Robotics as It Give to the Robot a Precise

    11/16

    of copper board weldedthe main board using aregular soldering iron,and where the center ofthe wheel is etched on itfor maximum accuracy,

    this way, both the rightand left wheels are atthe exact same height.You can also notice thatanother small piece ofPCB is added to caryany eventual shearstress on the main partholding the wheel. (seefigure 3.B and 3.C)

    Fig. 3.B Fig. 3.C

    4-Motors and power transmissionThe motors, which are DC motors originally made for cassette players, are cylindrical and thus verydifficult to mount and firmly fix to a chassis.So this unique techniquewas used, which is to usepipe clamps, originally usedto mount water pipes allalong the walls of buildings(see figure 4.A). Those pipeclamps are easily availablefor all the diameters you canimagine, at least you willeasily find a pipe clampwhose diameter fits thediameter of your motor. Fig. 4.AYou can notice a small black plastic pulley fixed at the end of the motor's shaft, which will be thenused to transmit power to the wheels using a belt. This small pulley can be found from the same storewhere you can buy those motors, the rubber belts, as well as all kind of accessories of cassette players.

  • 8/2/2019 Line Tracking is a Very Important Notion in the World of Robotics as It Give to the Robot a Precise

    12/16

    When the motors and thepipe clamps are assembledas shown in figure 4.A, theycan finally be easily insertedin their place in the chassis(main board), then all you

    need is to add a rubber beltto obtain the transmissionsystem shown in figure 4B.

    This pulley / belt assemblyacts exactly as as thegearbox added to a DCmotors to reduce speed andincrease torque.

    Depending on the size of thebelt you have, you canadjust its tension by

    adjusting the height of themotor itself, which caneasily be done by changingthe position of the nuts onthe screws holding themotors to the PCB. Theoptimum tension in the beltcan be easily found by trialand error.

    Fig. 4.B

    5-Electronics

    Fig. 5.A

    http://www.anrdoezrs.net/click-2978450-10274367
  • 8/2/2019 Line Tracking is a Very Important Notion in the World of Robotics as It Give to the Robot a Precise

    13/16

    Circuit description:

    Being powered from a 7.2V battery, the regulator U3 provi

  • 8/2/2019 Line Tracking is a Very Important Notion in the World of Robotics as It Give to the Robot a Precise

    14/16

  • 8/2/2019 Line Tracking is a Very Important Notion in the World of Robotics as It Give to the Robot a Precise

    15/16

    des regulated 5V for the microcontroller and for the logic gates of the motor driver. You can add acapacitor between the output of the regulator and the ground to absorb the noise caused by the presenceof motors in the system, but I didn't use any, and didn't face any problems regarding this issue.

    When the switch SW1 is switched OFF, the battery can be charged using the jack J2.

    The line sensor is composed of 4 cells, and is based on the IR emission/reception technique describedin thistutorial. D1 to D4 are IR LEDs used as receivers, D9 to D12 are also IR LEDs, but used asemitters this time. The output of the line sensor is directly fed from the Op Amps to themicrocontroller. Only two outputs are connected to the LEDs D7 and D8, giving a direct indication ofthe output of the sensor, making the calibration process very easy through thepotentiometer R6. For moreinformation about linesensors, check this tutorialspecially dedicated tolinetracking sensors and

    algorithms

    Figure 5.B shows the 4

    emitter and 4 receiver LEDsat the front of the robot.Note that this is the optimalposition of the line sensor,as you can see in the tutorialabove about line sensors.

    It is also clear that they aremounted on the copper sideof the board, even throughthey are regular LEDs (notSMT type). The Leads ofthe LEDs are used to adjust

    the height of the sensorfrom the ground. 10 to 20millimeters proved to be afair height for the sensor tofunction properly.

    Fig. 5.B

    The connections around the microcontroller are standard in most of our 8051 based projects, they arethe crystal resonator along with the two decoupling capacitors, the debouncing circuit attached to thereset pin, and the ISP (In system programming). Upon switching on the robot, The software loaded onthe microcontroller simply directs the robot to the line, using standard line following algorithmsdescribed in the followingarticle. You can download the C code along with the HEX file to be loadedinto the microcontroller at the end of this article.

    The two motors of the robot are driven using the reliable L293D Motor driver IC, the motors areconnected to the wire connections W3, W4, W5, and W6. Being controlled by the microcontroller, thespeed of the motors can be easily adjusted using PWM pulses fed to the motor through the Enable PINsof the driver. Note that each channel has it's own independent Enable PIN, making it very easy tocontrol the speed of two different motors simultaneously.

    REMINDER: Operating the L293D motor driver

    http://ikalogic.com/ir_prox_sensors.phphttp://ikalogic.com/ir_prox_sensors.phphttp://ikalogic.com/tut_line_sens_algo.phphttp://ikalogic.com/tut_line_sens_algo.phphttp://ikalogic.com/tut_line_sens_algo.phphttp://ikalogic.com/tut_line_sens_algo.phphttp://ikalogic.com/tut_line_sens_algo.phphttp://ikalogic.com/isp.phphttp://ikalogic.com/tut_line_sens_algo.phphttp://ikalogic.com/tut_line_sens_algo.phphttp://ikalogic.com/tut_line_sens_algo.phphttp://ikalogic.com/ir_prox_sensors.phphttp://ikalogic.com/tut_line_sens_algo.phphttp://ikalogic.com/tut_line_sens_algo.phphttp://ikalogic.com/tut_line_sens_algo.phphttp://ikalogic.com/isp.phphttp://ikalogic.com/tut_line_sens_algo.php
  • 8/2/2019 Line Tracking is a Very Important Notion in the World of Robotics as It Give to the Robot a Precise

    16/16

    Using the L293D motor driver,makes controlling a motor assimple as operating a buffer gateIC. It totally isolates the TTLlogic inputs from the highcurrent outputs.

    Putting a logic 1 on the pin In1will make Out1 pin go toVpower (36 Volts MAX.), whilea logic 0 will make it go to 0V

    Each couple of channels can beenabled and disabled using E1and E2 pins. When disabled achannel provide a very highimpedance (resistance) to themotor, exactly as if the motorwasn't connected to the driver IC

    at all, which makes this featurevery useful for PWM speedcontrol.

    Figure 5.Cshows different waysto connect a motor to the IC.

    One way is to use 2 channels tobuild

    Fig.5C: Using the L293D motor driver

    a bi-directional motor driver, another way is to use 1 channel per motor, building a unidirectionaldriver. In this project, we will be using the 4 channels to drive the 2 motors in both directions. To getmore specific information on this very useful IC, you can always download and inspect thedatasheet

    Ica logic

    http://ikalogic.com/art_pics/wfr2/l293d.pdfhttp://ikalogic.com/art_pics/wfr2/l293d.pdfhttp://ikalogic.com/art_pics/wfr2/l293d.pdf