Line Sensors

In trying to do the “Staying in a box” activity, students have the code correct, but the sensors are not picking up the line. I have a 4x4 table covered in white paper with a dark purple duct tape around the edge. What is the process for calibrating the sensors once students have downloaded the program?

The code should calibrate the sensors at startup, but you may need to play around a little bit with the sensitivity by changing the ‘30’ at the top of the forever loop.

It’s also possible your tape is shiny enough that it’s reflecting light and fooling the sensors into not seeing the tape.

You might try something like flat black paint or magic marker on a piece of poster board to see if that works better. Black electrical tape works well too since it has a dull, non shiny surface that won’t reflect light well.

Thanks for the response. I initially used electrical tape with the same results. What should the process be once students have loaded the code? Do they need to reset the micro:bit or push the A button in order to calibrate it?

Hi,

To add on to what Chris’ explanation in case you were still wondering:

  • What should the process be once students have loaded the code?

    After uploading code to the micro:bot, it will read the center line following sensor and save it. This is the baseline value that it will remember for a black line looks like. This can vary depending on the material (i.e. black ink printed on a paper, electrical tape, Sharpie, or pencil) used to make a track or fence. It will then begin to drive.

  • Do they need to reset the micro:bit or push the A button in order to calibrate it?

    They can turn off the motors with the switch, try to move the center sensor to the black line (i.e. the fence in experiment 2) and press the reset button to run again to calibrate. Or they can turn the motors off, and press button A to calibrate while the code is running. Once the sensor is calibrated, they can switch the motors back on. If there are problems with the robot following the dark line (i.e. the Sharpie/pencil line is not dark enough or there is interference from other infrared light sources), you will need to adjust the sensitivity.

  • There’s been some confusion with experiment 2 and 3 for the micro:bot kit. I am in the process of updating the tutorial to clarify what is going on. I’ll be including a way to view the sensor readings and few highlighted graphs. =)

    The [updates to experiment 2 and 3 for the micro:bot kit are live if you have not checked it out.

    Enjoy. =)](https://learn.sparkfun.com/tutorials/microbot-kit-experiment-guide/experiment-2-staying-in-a-box)