I am building a line following robot using the QTR-8A sensor module, with the end two sensors broken off. The remaining six sensors are connected to a teensy 3.5 on pins 12,13,0,1,6 & 7, with LEDON pin disconnected, an external 3.3v regulator powering the sensors and soldered connectors on the sensors.
The line is printed inkjet black ink on matte white paper. The sensors are mounted parallel to this, at a distance of about 3-4mm, on a custom robot chassis.
All 6 sensors work, using the QTRAraw example sketch in the library, however when I try to use the readLine function demonstrated in the QTRA example sketch the values are not deviating much from the centre line position of 2500. The raw values are clearly detecting the difference between the white and black (black is around 600, white is around 900) but no matter how slowly I move the robot across the line when calibrating, or how many cycles of calibration I perform, the line position never exceeds 2000-3000 no matter where I move the line on the paper, where I expect the full range to be 0-5000. Looking at the serial output’s first lines where it prints the calibration values is has found, the minimum values are very, very low compared to what I experienced with the raw values - anywhere from 24-300.
I believe this to be the problem, in that there is a large amount of noise in the readings as the black is detected as in-between the calibrated white and black.
My question is this - how can I set the calibration values (min for a start, both would be great) that the QTRSensor library uses in the sketch. I am happy to modify the library if necessary, but the changes to the values should be able to be changed on the fly within the sketch.
If this is not possible, what it the best way to incorporate the line position algorithm into my sketch without using the library (I would still use the raw reading function from the library, but would map and constrain the sensor values myself)?
As to my code, it is just the QTRAExample example sketch, with the pin numbers changed and various values for i<400 in the for loop.
My environment is a windows 10 computer with the official teensyduino program using the Arduino 1.8.1 IDE with teensy 3.5, 120MHz, faster, US English selected on the connected COM port.
Thanks is advance!!