Readings from QTR-8RC

Hello everyone:

I have a QTR 8RC Reflectanse sensor and intel edision. I am not able to get right reading from the sensor. I followed the online instruction while wiring the cable. I believe the sensor works all right.


However, readings from the sensor are bit strange. No matter how I change the background, white, grey or black, all the RC sensors give the following values:

6 6 6 6 6 6 6 6
5 5 5 5 5 5 5 5
5 5 5 5 5 5 5 5
5 5 5 5 5 5 5 5
6 6 6 6 6 6 6 6
5 5 5 5 5 5 5 5
5 5 5 5 5 5 5 5

The code I am using is based on the examples provided in the arduino library folder.


#include <QTRSensors.h>

// This example is designed for use with eight QTR-1RC sensors or the eight sensors of a
// QTR-8RC module.  These reflectance sensors should be connected to digital inputs 3 to 10.
// The QTR-8RC's emitter control pin (LEDON) can optionally be connected to digital pin 2, 
// or you can leave it disconnected and change the EMITTER_PIN #define below from 2 to 
// QTR_NO_EMITTER_PIN.

// The main loop of the example reads the raw sensor values (uncalibrated).
// You can test this by taping a piece of 3/4" black electrical tape to a piece of white 
// paper and sliding the sensor across it.  It prints the sensor values to the serial 
// monitor as numbers from 0 (maximum reflectance) to 2500 (minimum reflectance).


#define NUM_SENSORS   8   // number of sensors used
#define TIMEOUT       2500  // waits for 2500 microseconds 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
QTRSensorsRC qtrrc((unsigned char[]) {3,4,5,6,7,8,9,10},
  NUM_SENSORS, TIMEOUT, EMITTER_PIN); 
unsigned int sensorValues[NUM_SENSORS];


void setup()
{
  delay(500);
  digitalWrite(EMITTER_PIN, HIGH);    // turn on Arduino's LED to indicate we are in calibration mode

  Serial.begin(9600); // set the data rate in bits per second for serial data transmission
  delay(1000);
}


void loop()
{
  // read raw sensor values
  qtrrc.read(sensorValues);

  // print the sensor values as numbers from 0 to 2500, where 0 means maximum reflectance and
  // 1023 means minimum reflectance
  for (unsigned char i = 0; i < NUM_SENSORS; i++)
  {
    Serial.print(sensorValues[i]);
    Serial.print('\t'); // tab to format the raw data into columns in the Serial monitor
  }
  Serial.println();
  
  delay(250);
}

While, if I only read a single RC sensor, for example, I change the following
#define NUM_SENSORS 1
QTRSensorsRC qtrrc((unsigned char[]) {3}, NUM_SENSORS, TIMEOUT, EMITTER_PIN);

Readings are:
2500
728
5
5
4
5
6
109
203
45
228
299
298
167
338
262

Can anyone help me with this problem ?

Also, I am bit confused about the comments:

// print the sensor values as numbers from 0 to 2500, where 0 means maximum reflectance and
// 1023 means minimum reflectance

if 1023 is the minimum, why I get 2500 ?

Thanks in advance.
Josh

Hello, Josh.

We have not tested the QTR Reflectance Sensors Arduino Library with the Intel Edison board, but it sounds like there might be some kind of conflict. Can you try testing each of the pins used in the example one at a time (like you did with pin 3) to see which ones, if any, cause problems?

Sorry for the confusion caused by the comment you mentioned. The minimum reflectance from the QTR-RC sensors should be equal to the TIMEOUT value specified, which is 2500 for the unmodified QTRRCRawValuesExample program. We have fixed that typo in the comment; thank you for bringing it to our attention.

Brandon

Hello BrandonM:

Thanks for your reply. Based on your suggestion, I have tested each RC sensor individually

by changing the example code (3, 4, 5, 6, 7, 8, 9, and 10)

and they are all in good working order. However, once I use multiple sensors (receiving reading from more than one pins), readings are not quite right. .

In the meaning time, I managed to get a UNO and the QTR sensor works perfectly. For the both two boards, I am using the same code and QTR-8RC is the only one connected to the two broads. Sorry for the delay in response, it takes me couple of days to get the UNO.

What kind of problem it would be?

Hello.

Did you try testing a known working sensor with each pin used by the example code (3, 4, 5, 6, 7, 8, 9, and 10) to make sure all of those pins on the Intel Edison board work as expected with the sensor? As I mentioned in my previous post, we have not tested the QTR sensor library with the Intel Edison board; there might be some conflicts between the two.

Brandon

.Yes, I have done that. just updated the previous post

Thank you for clearing that up; however, as I said before, we are not very familiar with the Intel Edison board, so I am not sure what might be causing the incompatibility. You might have better luck posting on the Intel Edison forum.

Brandon