top of page

Detecting Lines

One of the most important aspects of any line-following robot is its ability to detect the presence of a line. Of course everyone knows the basic line detection programme using the colour detection mode of a colour sensor.


D motor moves (50% power) till colour sensor (Port 3) detects a black line

However this method is not entirely accurate especially if your robot is travelling at a faster speed, since the colour sensor would not be able to detect the line in time.


The video below will show you a better method, of taking the average reflected light intensity value between two surfaces (for example, a tabletop and a piece of black tape), and using it as a threshold in order for the robot to determine when to stop.


B/C motors move forward at (50%) power till the reflected light intensity is less than 50.

his method is arguably more reliable as the robot will come to a standstill as long as the colour sensor detects that the light value is less than 50.


Method #3

Another method one could use would be to measure the reflected light intensities of two different surfaces, in this case the black region of the line and the white region of the World Robot Olympiad playing field and calculating the average (which again can be saved as a variable), leading to the motors stopping upon fulfilling the criteria, in this case where the light intensity is equal or lesser than the average value. The values for the variables are arbitrary and can change accordingly.



Method #4

DetectBlack My Block

We could also store all the variables in a separate My Block, which is named Values in the first picture. Instead of using such a long sequence every time we wish to detect a black line, we can simplify it into a

My Block as well, leaving a switch for us to select which sensor we would like to use.


As usual, feel free to contact us with your thoughts and suggestions, we will respond as soon as possible.


Please correct us if there are any mistakes in this article!

3 views0 comments

Comments


bottom of page