Unsure how to Implement Pololu QRTXL Line Sensor

My team tried testing the Pololu QRTXL analog reflectance sensor but has been unsuccessful. We want to use them line detection and following

Last year, we ordered 16 channel QRT sensors and could get voltages, but they were inconsistent between the different channels and hence could not be useful. All of the channels went to the Analog In ports.

This year we got the 1 channel QRTXL sensor. We have it wired up to the Analog In on the roboRIO (VCC to power, G to ground, and S to signal). Once again we are getting a voltage through the getVoltage() method, but it is not varying. We think the sensor is working properly because we briefly checked that the voltage was actually varying with voltage meter, but there is more testing we have to do.

How do we implement these sensors? Would this be a code error or an electronics error.

How did you get 16 analog in ports? Four on the board and four in the MXP as I recall. Yup, figure 14:

For line following, I would recommend the digital version, and move the sensor up/down until the sensor is reliably detecting line vs non-line. As you already have the analog version, you should still be able to find a cutoff value that works as long as it is level and directed down at the carpet.

Also, for anyone else trying to help, they’re QTRXL, near the bottom of this page:

The first thing I do on debugging an Analog port is to get a 10K Potentiometer. Run power in one side, ground in the other, then the middle pin (sweep) on the signal. Then run you code and change the sweeper to see if the port is working.

Then next thing is put a multi-meter on the signal coming out of the QTR XL and look to see if the voltage out of the QTR XL is changing.

usually one of those two things are not working.

A trick I teach my students is to read all of the sensors in disabledPeriodic(), and display them to the console with a System.out.println when a joystick button is depressed. This way you can check all your sensors anytime you need.

-Jim

The robots entered in the SRS line maze use these sensors. What builders do is before the robot starts the solving it calibrates all of the sensors. The robot rotates over the line to get the high value and low value of each sensor, then find the middle point for each sensor and puts that value into an array. Once the robot starts moving it refers to array when following the line.

You can do this, and right before the match bring a ‘calibration hunk of carpet’ a chunk of the carpet with the line on it and run that under the sensor during setup and configure the sensor array in the disabledPeriodic().

-Jim

Have you looked at the protocol for the digital version of these sensors? It doesn’t seem particularly easy to implement.

I thought the ping-response class would work for this, but I see that it is designed for the ping and response to be on two different pins. Still, that class could probably be coerced to the task, and it could certainly be copied and tweaked into it.

To get 16 I would use two SparkFun Multiplexer Breakout - 8 Channel:
SparkFun Multiplexer Breakout - 8 Channel

Two of them would allow you to read 16 analog lines two at a time. Both would take 2 analog lines and 3 digital lines. If you really wanted to get radical, put four of these on an Arduino, and let the Arduino spin through the ports, and then send the results back over a I2C line between the RoboRio and the Arduino.

-Jim

It had 16 channels but we only hooked up 4 to the analog. Sorry I didn’t clarify that.

I a have been thinking that some of the analog ports on our RIO are broken since I remember last year only having some of the sensors getting appropriate values

Thank you for the advice. I will be testing again this afternoon and will get back to you what the problem is

So the sensor is pretty delicate so we think something got fried while soldering. Thank you for the support