How to connect "QTR-1A Reflectance Sensor" to 3pi!

Hello!

Good day to all the forum!

I need to connect a pair of QTR-1A 3pi outside the chassis to detect other alternate lines, which function should I use? :question:

And as I read the value of the result? :question:

What 3pi pin I can use as “PC5” and “ADC7” and I have used? :question:

Thanks for the help!

Hello.

I do not understand your questions fully, but I will try to answer them the best I can. The function you want to use to read an analog voltage is analog_read. The value of the result is described in the command reference. Unfortunately, there are only three available analog inputs on the 3pi and you are already using two. The other one to use is ADC6, but you have to give up battery voltage monitoring.

- Ryan

Thank you for giving the answer! :slight_smile:

If i was reading some of 3pi ams and would have to desconetar the ADC6.

And my question was that I can read function used with the sensor connected ADC6 for reading when detecting the white or black, what are the simplest functions that I have read I can use the library functions lotengo 3pi but not very understood.

thanks

Sorry, if you asked any specific questions in your last post, I didn’t understand them. If you have any additional questions, can you try rephrasing them and elaborating?

- Ryan

Hello!

Well I’m making a robot using the “3pi” and I need to connect a “QTR-1A Reflectance Sensor” additional connected to pin ADC6, my question is what function (program) I need to use to get the result of black or white?

thanks

Something like this should work:

set_analog_mode(MODE_10_BIT); // at the beginning of the program call this once
unsigned int reading = analog_read(6);
if (reading > 800)
{
  //black
}
else
{
  //white
}

I picked 800 somewhat arbitrarily. You will need to calibrate it for your application. The point is that high values will be blacker (less IR received) and low values will be whiter.

- Ryan

Thanks for the help!
Could I do it the same way with a QTR-1C?
The 3pi only supports maximum voltage 6v I could not adapt a battery “7.4v” or maximum “9v”?

regards

No. With either sensor, you need to do what is described in the product page to use it. Please see the product page for the QTR-1RC for details on how to use it.

The 3pi is designed to be used with 4 x AAA NiMH or Alkaline cells, the battery voltages you are describing are not within spec.

- Ryan

Thanks for the Help!

If I plan to use a voltage regulator to “6v” for higher voltage batteries.

Until next time. :slight_smile: