QTR-3RC not reading

Hello,

I am trying to read values from a white and black surface just to test the QTR-3RC sensors I bought from you. They are Digital OUTPUTS. I used your QTRRC Example and switched to the following options:

## #define NUM_SENSORS   3    
## #define TIMEOUT       2500  
## #define EMITTER_PIN   QTR_NO_EMITTER_PIN
## QTRSensorsRC qtrrc((unsigned char[]) {3, 4, 5}, 3);

And this is what I get on the Serial Monitor:

1 1 1 
1 1 1 

0	0	0	0
0	0	0	0
0	0	0	0
0	0	0	0
0	0	0	0

I am about half a centimeter away from the floor testing the sensor and it just doesn’t work, I don’t have any Emissor pin.

Thanks,
Ricardo Graça

Hello, Ricardo.

It sounds like you are referring to the QTRRCExample Arduino sketch. Did you make any modifications to the code other than the lines you included in your post? Are you calibrating the sensor array by making sure each sensor is passed over your light and dark surfaces during the 10 second start-up calibration phase (explained in the comments of the code)? Also, can you post some pictures of your setup that show all of your connections?

Brandon

Hello,

First of all here is my complete code:

#include <QTRSensors.h>

#define NUM_SENSORS   3     
#define TIMEOUT       2500 
#define EMITTER_PIN   QTR_NO_EMITTER_PIN   

QTRSensorsRC qtrrc((unsigned char[]) {3, 4, 5}, 3);
unsigned int sensorValues[NUM_SENSORS];


void setup()
{
  delay(500);
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH); 
  for (int i = 0; i < 400; i++)  
  {
    qtrrc.calibrate();       
  }
  digitalWrite(13, LOW);     

  Serial.begin(9600);
  for (int i = 0; i < NUM_SENSORS; i++)
  {
    Serial.print(qtrrc.calibratedMinimumOn[i]);
    Serial.print(' ');
  }
  Serial.println();
  
  for (int i = 0; i < NUM_SENSORS; i++)
  {
    Serial.print(qtrrc.calibratedMaximumOn[i]);
    Serial.print(' ');
  }
  Serial.println();
  Serial.println();
  delay(1000);
}


void loop()
{
  unsigned int position = qtrrc.readLine(sensorValues);

  for (unsigned char i = 0; i < NUM_SENSORS; i++)
  {
    Serial.print(sensorValues[i]);
    Serial.print('\t');
  }
  Serial.println(position); 
  
  delay(250);
}

I do calibrate the sensor with a white A4 paper and a black A4 paper during the calibration mode.
I tried with other superficies and colors and it is always the same output on the console.

Thanks for your time,
Ricardo Graça



Thank you for the additional information and pictures. I am not familiar with that Uno32 board, but I suspect it might be having some compatibility problems with our QTR reflectance sensor Arduino library. Do you have a standard Arduino board you could try with the same code? If your setup works with a standard Arduino, then you might try looking into the source code of the library to see what commands might not be compatible with that Uno32 board.

Brandon

I tried with Arduino Uno and it worked perfectly. Is there any way that it can work with my board Chipkit Uno32?
I’d like to use it to read the sensors.

Thanks,
Ricardo Graça

As I said in my previous post, I am not familiar with the chipKIT Uno32 board, so I cannot say what part of the code that board is not handling correctly. You might try posting on the chipKIT support forum.

Brandon

Thanks Brandom,
Ricardo Graça