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?