Pages: [1]   Go Down
Author Topic: Reflectance (line following) sensor being very sensitive to distance  (Read 1025 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello! Thanks for reading this. I am pretty new with using the Arduino, all help is greatly appreciated. I am using a Pololu QTR-1A reflectance sensor, which is a 5V analog sensor with a single infrared LED and a photoresistor. It is meant for edge following and line following, and outputs a voltage from 0 to 5V depending on the amount of light reflected (translated to an integer from 0-1023 on the arduino). I am also using an Arduino UNO R3.

I am trying to determine whether this sensor is pointing at a black surface or a white surface, and I have noticed that the sensor is incredibly sensitive to movement and distance from the surface. It is very difficult to get any meaningful data from my sensor readings - I would expect the sensor to clearly give a high or low voltage depending on whether it is pointing at a black or white surface, but instead I am getting nearly random values. When the sensor is brought within the manufacturer's recommended range of a surface (5mm), the output difference between black/white surface is only 100-200 (about a volt), whereas the manufacturer says it should be somewhere in the realm of 4-5V difference. Moving the sensor even 1mm closer or further away from the surface will change the analog reading of the white or black line by almost 200.

I have a circuit hooked up to an Arduino Uno R3 board, with Vin attached to the 5V pin on the Arduino, GND attached to ground on the Arduino, and OUT attached to an analog pin A4. I am using the Serial port to display the raw data (0 to 1023) from the sensor. My basic code is below, it just sets up a Serial port, then prints readings from an analog pin.

I also have two of these sensors and have gotten the same results with both. Any ideas or experiences with reflectance sensors are greatly appreciated, and whether this behavior is to be expected (online reviews/videos didn't seem to show this behavior) or not.

Here's the code I am using, it is pretty simple:
Code:
void setup(){
  Serial.begin(9600);
}



void loop(){
 
  int reading = analogRead(4);
  Serial.println(reading);
  delay(100);

 
}
Logged

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 49
Posts: 2551
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you were able to adjust the resistances on that sensor you could get a bit more variance but not a whole lot. Reflectance sensors are very sensitive to distance, and also quite sensitive to the "blackness" of the line.

I'm using an RPR220 trying to build a simple barcode reader. Went through a couple types of paper and tweaked the printer quite a bit but still having similar troubles getting good readings; my barcodes are about 3 inches wide just for an 8 bit value :/
Logged

Pages: [1]   Go Up
Jump to: