Calibrating Mindstorms Light Sensors with NXT-G

To win the FLL robotics competition you should surely use light sensors for navigating on the field. But the performance of the light sensors is affected by the surrounding light which means you might get different results on the training and on the competition table. This is where calibration is useful. In this video I will show you an easy way to do calibration along with a few examples.

  • #11
  • 29 Mar 2013
  • 7:53

In short, calibrating means setting the minimum and maximum value used by the sensor for the specific environment. For example, in a dark room using the light sensors over a black line might return a result of 20 - 25. But introducing an additional light source in the room will change the value of the sensor.

English

To win the FLL competition you should surely use light sensors for navigating on the field. But the performance of the light sensors is affected by the surrounding light, which means you might get different results on the training and on the competition table. This is where calibration is useful.

 

In short, calibrating means setting the minimum and maximum value used by the sensor for the specific environment. For example, in a dark room using the light sensors over a black line might return a result of 20 - 25. But introducing an additional light source in the room will change the value of the sensor.

 

What I would like to achieve is to calibrate the sensor so that it returns 0 for black line in both cases. And I will do this in two different ways.

 

This is the final program. I could put the robot over a black line with extreme surrounding light and it will still return a value close to zero

 

Before proceeding we should make sure the sensors are not calibrated. We go to Tools->Calibrate Sensors. Select the Light Sensors on port three and press “Default”. Now the sensor is using the factory defaults.

 

Lets take a look at the value returned from the brick. We attached the light sensors to port 3 and start the View program. Moving the sensor over a black line returns a value of .. Moving the sensors over the bright table returns a value of …

 

Lets do the same experiment but this time with the values shown in the NXT-G environment. Moving over a black line returns … Moving over the bright table returns …

 

The easiest way to calibrate the light sensors is by going to Tools->Calibrate Sensor and pressing calibrate. This will download a program called calibrate to the brick. Lets see how it works.

 

- we should now position our sensors over the darkest object on the field and press enter. From now on objects with this color will return a value of …

- now lets put the light sensors over the brightest object on the field.

 

If we now start a new program and take a look at the values returned from the sensor, we would see that for the black line we have a value of 0 and for the table we have a value of 100. And this is exactly the effect we are looking for. The robot knows which is the darkest and the brightest object on the field.

 

Bare in mind that this values are different from the values shown on the brick in the view program. The brick will always show raw values, not calibrated ones.

 

Now as the sensor is calibrated we could use it to more precisely detect bright and dark object on the specific competition field, again for following a line or aligning.

 

Now lets do the same thing, but this time calibrating the sensor for the environment with the external light source.

 

Checking the values in the NXT-G environment shows that even with the external light source the sensors returns 0 for the darkest object and a value around 100 for the brightes object on the field.

 

There is a second way to do calibration and it is by using the Calibration block in the program. I will leave this for our next video.

 

Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for FIRST LEGO League Competition. Constructing and Programming a Robot Base
  • 42
  • 249:53
  • 10
Image for Simple following and aligning to lines and borders
  • 11
  • 5
  • 1
  • 3d_rotation 0