Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

QTR-8RC 'Position' Reading when line is below 3 sensors at a time


Hi Pololu,

I need your Guidance.
I am using Pololu QTR-8RC (all 8 sensors) sensor for line follower robot. I have tested my robot for line width of 15-20mm in which line just fits in the distance between two sensors. I used the Position reading of the sensor to calculate my Error value and then obtained the motor speeds using PID calculation.
But now I want my robot to follow the Line of width of 30-35mm. Here, in the desired position, the central three sensors are on the line at the same time.
So, in this scenario, Will the position reading from the sensor be accurate and Can I use this reading to calculate my error and Motor Speeds?.

Devansh Atray


Hello, Devansh.

If you are using our library for those QTR sensors, I expect the wider lines will not be a problem. Have you tried running a course with wider lines?



Hi Derrill,

Thanks for your reply.
I have not tried my robot as of now on course with wider lines but I plan to do so.
But I am confused as to what will be the Position reading from the sensor when line is below any three sensors at the same time?
Because I think the Position reading indicates–‘Between which sensors the line is’. For e.g: If the position is 3500, then the line is exactly in the middle of 3&4 sensor. But if the line is under three sensors at the same time, then what will the position reading be and will it be accurate?

Devansh Atray


The position value is a weighted average of the position times 1000, so if the line was being seen by 3 sensors equally, the value reported would be the middle sensor of those three sensors multiplied by 1000. You can see more about this in the “QTRSensors Methods & Usage Notes” section of the “Arduino Library for the Pololu QTR Reflectance Sensors” documentation.