Main Site Documentation

Questions about .Net MF and using reflectance sensor



my current project is to build a line-following robot. I bought some reflectance sensors from QTI, and so far, I have them working by simply reading the analog output.

It works on well lit area, but i start having issues when there’s too much shadows (the difference in readings between a black line and a white paper becomes inexistant).

So, i read a bit of documentation and saw another way of doing it by using digital port instead :

  • Set the port to OutputPort, and to High,
  • wait for the condensator to charge (230 microseconds in my case)
  • set the pour to InputPort,
  • check how long it takes for the port to read “false” instead of “true”.

My questions are :

1 - If I am to do that, I need to dynamically change the port mode. Is there any way to do that, or should I “dispose and recreate” ?
2 - If anyone has any experience in this, would that methode be more efficient than direct readings to analog port like i am currently doing?
3 - Given the time involved (hundreds of microseconds), is a microcontroller based on the .Net framework the best choice, or should i use a more “low-level” controller?

Thanks in advance for your answers.


Why don’t you light the area with an LED or two? By having a constant light source the readings should be more consistent than ambient light.

I’d say staying with analog would be easier. You should actually be able to tell how far off the line you’re going.


Thanks for your answer.

With all the I/Os availaible in the FEZ Panda II (the one iuse for this project), I will have room for two extra LEDs :-).

I would like to be able to get information on a LCD screen. Would any serial LCD work?

Thanks again.


Would you really need to use I/Os to power the LEDs? Why not just souce them off 5V? I assume your robot is always following lines. Of course, if this is a feature that turns on & off then it may be necessary to use I/O.


You are right!

I’m still a beginner. This is only my second robot (first one was a simple obstacle avoider).

Thanks for you advices.