QTR-8RC wrong sensor output

Hi everyone,

I’m using QTR-8RC sensor array with a height of 3.5 mm above a white surface and after above a piece of black electrical tape. I’ve made a simple program for Baby Orangutan B-328 to test the sensor array with the next code compiled in Atmel Studio 6.2:

#include <pololu/orangutan.h>
#include <avr/sleep.h>
#include <avr/power.h>
#include <avr/interrupt.h>

#define LON IO_B0		//Led On enable from sensor array
#define SD_VR IO_C0		//Step Down Voltage Regulator enable
#define SU_VR IO_C1		//Step Up Voltage Regulator enable
#define S1 IO_B1		//Sensor1 == Right most Sensor
#define S2 IO_B2		//Sensor2
#define S3 IO_B4		//Sensor3
#define S4 IO_B5		//Sensor4
#define S5 IO_D0		//Sensor5
#define S6 IO_D1		//Sensor6
#define S7 IO_D4		//Sensor7
#define S8 IO_D7		//Sensor8 == Left most Sensor
unsigned char n;		//numSensors
unsigned int timeout;	/*120us_3.175mm(white surface)(780us_9.525mm) to 2.6ms_3.175mm(black surface)(10ms_9.525mm) takes capacitor to discharge*/
unsigned char sensor;

int main(){
	set_digital_output(LON,HIGH);
	set_digital_output(SD_VR, HIGH);
	set_digital_output(SU_VR, HIGH);
	
	n = 8;
	timeout = 2500;
	unsigned int discharge_time[n];						/*dedicated array to store discharge time from capacitors, used in qtr_read functions*/
	unsigned char QTRCP[] = {S1,S2,S3,S4,S5,S6,S7,S8};	//Connected pins to sensor array
	qtr_rc_init(QTRCP, n, timeout, 255);				/*invalid pin specified in emmiterPin, so sensors always will be on*/
	
	while(1){
		qtr_read(discharge_time, QTR_EMITTERS_ON);
	}
	return 0;
}

And I’m trying to see in a oscilloscope the signals for each sensor, and i get correct waveform for sensors 1,2,3,4,5 but for sensors 6,7,8 I’m getting the last waveform shown in the next video when the sensors are above the black surface (incorrect signal)

http://subefotos.com/ver/?8903ad4a2c96d125b326634346fb12c6o.png

I think channel 1 signal (sensor 5 output) is the correct one because it isn’t enough time for the capacitor to discharge when it’s above black surface and the value should be decreasing form 5 V to 0 V.

But for channel 2 (sensor 8 output) signal it is always constant after 250 us, with an approximate value of 1.75 V.

So my question is:
Why am I getting this in the sensor 6,7,8 output and what can i do to correct them and make a good interpretation of the signal by the microcontroller?

Hi.

I am sorry you are having problems with your QTR sensor array. From your code, it looks like sensor 6 is on the same I/O pin as the red LED. This might be acting like a pull-down and causing issues. Could you move that sensor to a different pin and see if that changes anything? Using pin PD2 should be fine.

If that doesn’t solve the issue, could you try temporarily connecting each sensor to the same pin on the Orangutan, one at a time, and reading it to make sure that particular sensor is good? Since you know the sensor 5 pin is working, you could try reading them all with PD0.

-Claire

Thanks for your advice, I’ve done the two options you mentioned but i’ve got also the same results, then i tried to figure it out by checking the capacitors of the board and looked that the capacitors from sensors 6, 7 and 8 had different capacitance, around 30 nF, so i decided to change the capacitor from sensor 7, and tested again the sensors and now i’ve got the same results no matter the sensor output being measured (talking about sensors 6, 7, 8), so i thought it was a problem of short circuit between sensors outputs, but everything was ok.

So I really don’t know what to do, if you have any idea I’ll be really thankful if you let me know it.

As we show in the schematic on the QTR-8RC’s product page, all of the capacitors connected to the outputs of the 8 sensors are the same (10nF). Could you post pictures that clearly show the components that you modified? Also, could you send clear pictures that show all of your connections?

-Claire