Incorrect sensors readings

I have programed the 3pi with the line follower.
The robot was put on a light brown table with black line on it.
The first stage is the inialization which afterwards the robot shows the readings of the sensors.
When i pass the robot manualy on the left sensor i get readings of up to 1000,
Next i put it on the second sensor and get readings of up tp 2000, and so forth up to the fifth sensor (reading is about 3900-4000).

When i put the robot on the table (not on the line) i get a constant 4000 reading (i was expecting 0)
second of all, after moving the robot over a line from side to side usually i get the following readings:
When not on line 4000
Crossing the line -changes between 1000-3000
After crossing the line 4000

But after a few time doing that the reading after crossing the line changes to 0 and is stuck at this value until crossing the line again.

Can you suggest a solution?
Thanks.

I think you are getting incorrect readings because of placing the 3pi on a colored table (even if only lightly colored). I always use white poster board so as not to confuse the sensors. I may be wrong, but you might want to test the sensors on a white surface anyway just to see what they say. If they are still acting weird then the sensors could be defective.

Hello.

I think that mr.roboto is correct. Note that it isn’t about the visible light color, but the IR reflectivity that matters. Since you seem to be seeing some difference between the surface and the line, you might be able to write some code that uses the raw values to determine where the line is.

- Ryan

I’ve tried running the robot on a white board with black line and I got the same readings.
When the robot pass several times over a black line the readings are stuck at 0 until the next crossing.
Another thing that might be helpful to diagnose what I see is that I have used the line follower example and just changed it that instead of following the line, the robot will turn by 90deg if the sensors readings is higher than 100 (you can recreate wy code just by using the example and deleting the following code, making the robot turn is there is a line detection and running the robot in a closed shape).
Also, when adding a delay to the example or by making the robot move slower the problem occures less often.
This makes me think that it might happen due to the sensors reading function and the time it takes or its reset state.