Klein Bot

Kleins, robots, electricity

Blog

QTR Line Sensor - not working

Posted by Klein on October 2, 2010 at 10:21 PM

No luck getting the line sensor going. I'm asking for help from The Internet. I'm posting pictures of my setup and my code here, and posting my questions out there.


/

The setup:

Seeeduino pins 0 to 7 to QTR pins 1 to 8, respectively.

QTR enable pin unconnected.


Pictures in the photo gallery

connections to Seeduino

connections to QTR

IR LEDs are on


I verified 4.92v at Vcc on the QTR.

I verified continuity on each sensor connection


/

The code:


#include <PololuQTRSensors.h>

PololuQTRSensorsRC qtr((unsigned char[]) {0, 1, 2, 3, 4, 5, 6, 7},  8 );

void setup()
{ int i;
  for (i = 0; i < 250; i++) // make the calibration take about 5 seconds
  { qtr.calibrate();
    delay(20);
  }
}

void loop()
{ unsigned int sensors[8]; // an array to hold sensor values

  qtr.read(sensors);
  Serial.print(sensors[0]);
  Serial.print("\t");
  Serial.print(sensors[1]);
  Serial.print("\t");
  Serial.print(sensors[2]);
  Serial.print("\t");
  Serial.print(sensors[3]);
  Serial.print("\t");
  Serial.print(sensors[4]);
  Serial.print("\t");
  Serial.print(sensors[5]);
  Serial.print("\t");
  Serial.print(sensors[6]);
  Serial.print("\t");
  Serial.print(sensors[7]);
  Serial.println();
}

Results:

After 5 seconds of (presumed) calibration, the code returns only "4000"s. I'm presuming that these are timeouts. A different version of the program using readLine returned only 0 for line position.


Update:

I got a prompt update from (Site Admin) Ben at the Pololu forum. No direct fix, but confirmation that it's not me. There's also some example code (with lots of room for improvement) at the primary forum thread.

Categories: Atlanta Robot Rally 2010, Arduino