STEM Robotics 4 All

STEM Resources for all

Lesson 3: Follow the edge of a black line

The RoboMentors will introduce you to the use of Color Sensors to follow a black line on a white background.

What You’ll Learn:

  • Determine a color using the readings of the color sensor in the mode reflected light intensity
  • How to calibrate a color sensor to make accurate readings in a given light
  • Analyze what means to drive on the edge between two colors

What you might want to review how to use :

  • the Port View on your brick
  • the basic motion blocks to write a LabView program

There are a series of videos from the Carnegie-Mellon curriculum on color sensors. If you want to learn more about it and watch more similar videos please check the wait for color programs. We do not include them since they are not directly used for the challenges.

Since 2015, FLL competition mats have guiding black lines on white background. With their help your robot can reach far away corners of the mat, avoid obstacles, and find its way in a crowded field. A line follower is the easiest way to make a robot follow a pre-determined path. A series of algorithms can make an EV3 robot follow a black line on a white background, using only one Color sensor. The Color sensor will be used in the “Reflected Light Intensity” – mode to detect the intensity of light reflected off a source. In this mode the sensor outputs the average measurement for the measured area The lines are rather thick and the central observation is that one can program the robot to follow the edge of the line. On the edge of the line the value seen by the color sensor should be around 50, the average between white(100), and black (0). The principle is to make the robot turn towards black, when the sensor “sees” white, ie. a value larger than 50 , and to do the opposite turn when it “sees” black it. Such a “two-step simple line follower” algorithm only has two actions. It demonstrates how small local movements, i.e. turns to the right or to the left can accomplish a global optimization purpose, in this case following the line.

The proportional controller has its limitations for more complicated types of curves. For instance, the control parameter that works well for tracking a straight line might not work as well on sharp curves or semicircles. On such curves the correction might not be strong enough,or the robot might overcorrect.

The field of engineering that covers these line following algorithms is called control theory. It uses Mathematics and Engineering concepts to help dynamic systems (e.g. a robot) deal with inputs and respond to feedback by modifying its behavior. If you are interested in building more thana ssimple proportional algorithm, you can find the excellent document written by J. Sluka. He started the trend of using PID (proportional-derivative-integral) control technique for Lego Mindstorms Robotics.

Now let us see how the robot moves on the mat of FLL Replay.

Thanks for reading this article! Please like it and subscribe to our mailchimp newsletter to know when new articles are available!

© The Robo Mentors (Marc and Anne-Sarah)

Leave a Reply

%d bloggers like this: