Problems with QTR-1RC

Hello, I have a big problem.
I have bought a QTR-1RC to see how to read data with it on a Arduino Duemilanove ATmega328.
My setup is:
QTR-1RC Vin connected to 5V
QTR-1RC GND connected to Arduino GND
QTR-1RC OUT connected to Arduino digital pin 3

The sketch that I used I found in Pololu examples with a few modifications to the entry pins and variables.

#define NUM_SENSORS 1 // number of sensors used
#define TIMEOUT 2500 // waits for 2500 us for sensor outputs to go low
#define EMITTER_PIN 2 // emitter is controlled by digital pin 2

// sensors 0 through 7 are connected to digital pins 3 through 10, respectively
PololuQTRSensorsRC qtrrc((unsigned char) {3},

The rest is exactly like the pololu sketch.

I have a big problem.

But you don't say what this problem is!

What are you seeing and what do you expect to see?


It doesn't work. On the serial monitor in arduino it shows that it reads only 0. That would mean that the line is present on all the sensors. I think that moving my hand in fort of the sensor would give it different readings. But it doesn't.

I also tried reading with raw data. (

If you know what is wrong please help. Thank You!

What you need to do is to post the actual code you have (using the # button). A reading of 0 implies that the light is not being blocked. Try blocking it with a bit of tape or card and see if you can read a 1. Try covering the sensor completely, it might be being swamped with ambient light.

Also you said:-

QTR-1RC Vin connected to 5V

and then

define EMITTER_PIN 2 // emitter is controlled by digital pin 2

These two are not consistent. Connect QTR-1RC Vin to PIn2 to be consistant.

Thank You! It works now.