How to Program a Robot to Follow a Line

The Lego Mindstorms NXT kit allows you to create and programme a whole range of fun and interesting robots. This is even possible if you do not have any past programming experience. A good project for amateurs is to take a two wheeled robot and ask it to follow a line drawn on a piece of paper. It is relatively easy to programme a robot to follow a line if you understand the techniques behind it.

Things Required:

– Black marker
– Large sheet of white paper
– Mindstorms NXT kit
– PC running Mindstorms programming software

Instructions

  • 1

    Getting started

    Place the light or colour sensor if have the version 2.0 installed on your robot to make sure it is pointing at the ground. Mount the sensor right in front of and between the wheels, as near the ground as you can. Put the sensor on to the NXT brick. In addition to this, draw a line on a piece of paper so that the robot can follow that. The line needs to be around ½ inch wide and should not have any sharp turns. The radius of the turns should be more than half the width of the robot.

  • 2

    NXT brick

    Switch on the NXT brick and choose the View sub-menu. Click on the Reflected Light icon and choose the port to which the light sensor is connected. Place the sensor over the paper and write down the reading on the NXT brick screen. Mount the sensor over the line you drew in the last step and write down the new reading as well. On the other hand, build a programme for your robot. Then have the robot drive the left wheel forward when the sensor gets over the line and the right wheel forward if the sensor goes out on to the blank piece of paper.

  • 3

    Sensors and movement of the robot

    Once you have done the basics, put the robot on the piece of paper with the sensor only to the right of the line. After that, switch on the NXT brick, choose the programme you have made in the previous step and run it. Remember that the robot will perform according to the function installed and nothing more.

Leave a Reply

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


nine − 9 =