QTR-8RC array sensor , help me plz

hi ,
I had bought a qtr-8rc array sensor , but some problems face me , so that I want anybody help me

  • How can I programme this sensor using MikroC Pic to use it in linetracking robot ?
  • The two sensors at the side of array sensor , whom may broke off , don’t work separately , but if one of them be 1 the other be 1 and if the first be 0 the other be 0 , why ? and how I can separate them ?

Hello.

I do not have MCU-specific code I can give you. The procedure for reading the sensors is described on the product page. Do you have any specific questions about that procedure?

Also, I do not understand the description of your problem. Can you describe exactly what you are doing with the sensors that you broke off? How are you reading the sensors? Did you add the included resistor? Pictures of your setup might help.

- Ben

Hello.

I deleted your other forum post. Please do not post duplicate messages.

- Ryan

when i turn on my room light sensor will send 1 to ports of my pic !!!
when i turn off it sensor will send 0 !!!
and this is my code

void main() {
  trisc=0;
  portc=0;
  delay_ms(1000);
 while(1){
   time=0;
  trisb=0x00;
  portb=0xff;
  delay_us(10);
  trisb=0xff;
  portb=0x00;
  delay_ms(150);
  portc=portb;
         }
}

when it detect little shadow it will send 1 !!!
it is unnecessary for you to till me the exact code just make me understand what had happened and how to use it as line tracking sensor ??

i just want it to detect black area !!

thanks in advanced :slight_smile:

The way the sensor works is that you initially charge the sensor’s capacitor (by driving the line high for 10 us) and then you time how long the capacitor takes to discharge through the sensor’s phototransistor. If there is a lot of incident IR on the phototransistor, the capacitor will discharge quickly. If there isn’t much incident IR, the capacitor will discharge slowly. However, even in the dark, the discharge time is probably going to be a lot faster than 150 ms. Can you try setting your last delay to something much shorter, like 500 us or 1 ms?

Ultimately, it might be most informative if you actually try to time how long it takes the sensor output to go from high to low and return that time value so you can get a better sense for what the sensor is doing when the lights are on and off. Also, keep in mind that the sensor responds to IR light; if your room light does not have a significant IR component, you won’t get much of a response from the sensor.

- Ben

it seems like try and error >>

i found that i must made the last delay to be 500 ms to detect black and white line (!!!)

when my paper which have ablack line be at distance 1 cm from sensor all sensors send 0 to pic expect one which see the black line send 1 …

so 500 ms is very big !!!

what should i do now ??

You should look for a bug in your code or a connection problem. Do you have access to an oscilloscope? Can you tell me how you have everything connected? A picture of your setup might help. Also, can you try using a basic digital camera to verify that the IR LEDs are on?

- Ben

img02.arabsh.com/uploads/image/2 … 60fa06.jpg

this is apicture of our sensor
as you see here we use 8 pins from pic to connect 8 output from sensor

the first pin of sensor from left connected to GND and second pin to Vcc(5v)
third one (not connected)

now it work according this code

void main() {
  trisc=0;
  portc=0;
  while(1){
  trisb=0x00;
  portb=0xff;
  delay_us(10);
  trisb=0xff;
  portb=0x00;
  delay_ms(500);
  portc=portb;
}}

this is a simple vidio of our sesnor

now what should i do to reduce the last delay !!!

Can you confirm that the IR LEDs are on? Do you have access to an oscilloscope? Can you post a picture that lets me actually confirm all of the connections? What are you using to supply Vcc?

- Ben

this is the battary

this is my connection
http://goo.gl/sePDS

i don’t have a camera with no IR filter

i can see the output from 8 sensor throught 8 leds on portc

if i use oscillscope >>>> how can it help me ?!

Posting a tiny picture of a battery isn’t really a helpful answer to my question. Are you passing that battery through a regulator before using it for Vcc. If so, what are you using for your regulator? What voltage is the battery? Do your PIC and QTR sensor share a common ground?

You can use an oscilloscope to monitor the sensor outputs to see what they’re doing. That is much more useful than the threshold-type approach you are taking with your code.

- Ben

yes i use a regulator
it is 6 volt battary
5 volt regulator 7805 , the output volt from it is sharing between pic and QTR-sensor
they have acommon ground

The 7805 has a drop-out of > 1.5V, so you’re not getting 5V out of a 6V battery (unless the battery is very fresh and greater than 6V voltage.)
If you want to turn 6V to 5V (or, a variable input rate to 5V) you might want to try the pololu step-down converters, or the pololu SEPIC up/down converters.
Or you can use a LVDO part with 0.35V drop-out, like the LF50ABV (has the same pin-out as 7805, maximum current 500 mA.)
Note that I have no idea whether the voltage is actually causing this particular problem, but it’s likely to cause other problems in the future if you expect to actually have 5V proper.

thanks
ok i will use LF50ABV :slight_smile:

IR led does’t work !!!

how can i open it !!!

How do you know the LEDs aren’t working? Can you check your solder connections to make sure VCC and GND are getting to the board? Are you doing anything with the LEDON pin?

- Ben

my phone has no IF filter so i can check if the leds on of off :confused:
i checked Vcc and GND
ledon not connected

sensors are working but without IR I am sure about that but in this case i will not be able to use it as line forward :frowning:

We have the schematic for the sensor available on the product page. Can you start probing voltages/currents in an attempt to figure out why they aren’t working? The sensor has two parallel sets of four LEDs, so if none of the LEDs are working, the problem is not likely to be with the LEDs themselves. Note that we test the board before it ships, so the best place to start would be things you did/added/changed.

- Ben