Line Follower V2

      6 Comments on Line Follower V2

I have created a new line following programm. This time I have included a light sensor calibration function and the option to adjust the power settings by pressing the left / right buttons.

Line Follower V2 - Main Menu

Line Follower V2 – Main Menu

After some (failed) experiments with polynomial functions to calculate the speed of the wheels I decided to do something rather simple 🙂

Converting light sensor values (0 - 100) into steering values (-90 - +90)

Converting light sensor values (0 – 100) into steering values (-90 – +90)

The light sensor range is simply mapped to the range of the steering block. This works great with low power settings and is still acceptable with higher settings.

Download the Mindstorms Project File

I have a created two test tracks (A4 sized) that you can download here and here.

Building instructions for the robot can be found in this blogpost.

6 thoughts on “Line Follower V2

  1. moh

    it is a great program, any idea if we need it to stop at the end if there is white end and, how to maximize the power and make it move straight .

    Reply
  2. alaa touni

    light sensor calibration (min 128) and (max128)
    and when run program it round it self
    can you tell me where is the mistake?

    Reply
    1. Bjoern Post author

      Hi, I am not sure what exactly causes your problem but the light sensor should return normalized values between 0 and 100…

      Reply
  3. Natiole

    Hey we are trying to program your idea in Java.
    Our Colorsensor only return values from 0 to 1
    Can you please explain your calculation again, so we can transfer it to our code?

    Reply
    1. Bjoern Post author

      It´s a simple linear function. http://www.wolframalpha.com/input/?i=plot+1.8x-90

      The result is passed to the steering block that takes values from -100 to 100 (I chose to limit it with +-90 for no special reason but I suppose it runs smoother this way).
      (1,8*100)-90=90 (turn e.g. left)
      (1,8*50)-90=0 (don´t turn just drive)
      (1,8*0)-90=-90 (turn e.g. right)

      You could use (180*lightsensorvalue)-90=steeringblock_input (If you have implemented something like the steering block)

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *