Hello, I am building a line following robot, using the qtr-8a sensor and the arduino nano as the brain of the robot. For some tests I only connect the first and last sensor with the analog pins of the arduino and I have the following problems:
- Sometimes the values I get seem random. They might get to 0, then 400, then 800 and finally to 1023.
- The values I get change over 100 units + or -, although I don’t move the sensor at all.
- The sensors don’t have really different values when I put them on different color surfaces (white and black)
- When I try to calibrate them the values on white surfaces are around 990 and on black 1000, and when I don’t calibrate the values don’t change that much no matter the surface.
I have a competition on Sunday, so I need help as soon as possible. Don’t afraid to ask for images or any additional information.
PS: I have connected the 5v of the arduino nano with the VCC, the LEDON with the GND and the GND with the GND.
The connection should be
QTR-8A Pin |
Arduino Nano Pin |
VCC |
5V |
GND |
GND |
LEDON |
leave unconnected (or connect to VCC for always-on LEDs) |
A0–A7 |
Any analog pin |
If you connect LEDON to GND , the IR LEDs turn off, which explains: |
|
Random readings, almost no difference between white and black and calibration failing.
Disconnect LEDON from GND. Either leave LEDON unconnected or connect it to 5V to force LEDs on.
Thank you for the reply!
The problem doesn’t seem to get fixed… In addition now, the values of the sensor are like a pulse. It starts with a lot of 0s then goes to the 200s, 400s then 1023, again 400s, 200s and a lot of zeros again.
Here is an example of what I see:
0
0
0
0
0
0
120
250
480
740
1023
800
460
210
100
0
0
0
0
0
0
Hello.
As bidrohini mentioned, I recommend leaving the LEDON pin disconnected unless you specifically want to turn it off when not using the sensor to save power.
Can you try running the QTRARawValuesExample from our QTR library and posting the output you get from that when the sensors are over a white surface then a black one? You will need to modify the SensorCount value and the pins used in the qtr.setSensorPins()
function to match your setup.
Also, could you post some pictures of your setup that show all of your connections?
Brandon
Hello Brandon,
Thank you for your reply!
Using the QTRARawValuesExample I get these values when the sensor is on white:

And on black:

These are some pictures of my setup:
Those readings look fine; could you try running the QTRAExample (which uses calibrated values) and post the output? Please make sure to pass each sensor over the white and black surfaces multiple times during the calibration phase.
Brandon