Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Line Tracking Robot

  1. Jul 5, 2008 #1
    I am working on a robot which moves by tracking white lines. I am stuck at making a logic for making correction to robot incase it goes a little astray. How many sensors atleast will I need and where they should be placed assuming that the base of the robot is square or rectangular.

    My idea was that there will be two sensors at the back and one in front in the middle of the sensors at the back. As long as the font one is on the line the two motors will remain running. Now, for example the robot moves towards left. The right sensor will be on the line and the right motor should stop.This will make the robot rotate clockwise. Now I am stuck here and don't know how to use this three sensor design to make the robot come back to its original position where only the front sensor is over the line.
  2. jcsd
  3. Jul 5, 2008 #2


    User Avatar
    Science Advisor

    Perhaps you could add a couple of "if-then" statements so that, if the sensor on the right and the sensor in the middle both see the white line, the left motor continues at full speed and the right motor moves forward at half speed. It's not a complete solution, but it egts you closer to what you want.
  4. Jul 15, 2008 #3
    I think you are on the right track (pun intended I guess). What you are looking for is a way to reduce the 'hunting' that will occur once it gets off the line (i.e. constant zigzagging over the line). Think of it this way: online = go straight (both moters on). deviate left, as in you example, slows the right motor to point back to the line, but now the motion vector is angled to the right of the track.

    So, you need to add a condition that turns LEFT a bit once the line is regained. Say, when the right sensor comes back off the black line and hits white again. How much and how long a left motor stall to apply will be a judgement call. Probably best to have a variable that allows you to adjust it by trial and error. Some 'hunting' will still be inevitable, but you should be able to dampen it with this approach.
  5. Jul 16, 2008 #4


    User Avatar

    I think you need only "Two" sensers in Left and right side in the front of your robot.
    I have designed a robot like this and using MCS-51. For example if the Right sensor touch the line, you should slow down the right motor a little. So that the robot will run along the line by "Z" style trace.
  6. Oct 21, 2008 #5
    Thanks a lot guys...
  7. Mar 5, 2009 #6
    hey altairs....
    i am dev ....a 2nd yr students of electronics field..
    i am working on d same project (LFR)
    could u help me ...???
    which microcontroller should i USE...???
  8. Mar 6, 2009 #7


    User Avatar
    Science Advisor

    I don't like the idea of zigzagging along a line. I find that incredible inefficient. This reminds me minimzing algorithms, and how simple algorithms while they seem robust, can be horrible inefficient.

    My idea involves 4 sensors, two in front, two in back. The idea is that you not only want to know if you've gone over the line, but you want to know how fast your crossing the line.

    With only two sensors, you sense that your approaching the line and you make a correction, but the correction is seemingly arbitrary. You may find yourself going quickly to the line on the otherside.

    So, lets assume a kink in the line is up ahead. The line bends past the front sensor, which starts a counter. Then, when the line crosses the rear wheels, you now have a distance that the car has how much the line has strayed. From this, you can linearly interpolate (or higher order) from these two (or more) points to get an idea of what the line is doing. This will let you make a 'more' correct...correction.

    If your sensors can see which way the line is moving, then you could just have two sensors, one behind each other.

    Hope that made any sense at all.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook