QTR-A8 Set Position

Hi,
I was having a problem and i posted it here , the problem of using QTR-8A library with my ATmega32A but it was solved
i was wondering now , i’m using only 5 sensors of QTR and the middle 3 sensors on the line in PID Section what is position range suppose to be ?
int proportional = ((int)position) - 2500;
is 2500 is the right value ??
thanks in advance .

Hello.

I suspect you are looking at the code under the “PID Control” part of the “QTRSensors Method & Usage Notes” section of the “Arduino Library for the Pololu QTR Reflectance Sensors” guide.

It is not clear from your description how many sensors you are using to detect the line. Regardless, to calculate the position range based on the number of sensors used, see the formula for the readLine function under the same “QTRSensors Method & Usage Notes” section of the guide. For example, if you are using a total of five sensors, then position will range from 0 to 4000, and the center value should be half of the total range, which is 4000 divided by 2 which equals 2000. Likewise, if you are using three sensors the position will range from 0 to 2000, and the center value will be 1000.

If you have not done so already, I strongly recommend that you read the “Arduino Library for the Pololu QTR Reflectance Sensors” guide thoroughly to better your understanding of how to use the library before continuing on.

- Amanda