Author Topic: [Axon] Programming for a Line Detector Sensor?  (Read 1473 times)

0 Members and 1 Guest are viewing this topic.

Offline Hasan999Topic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 1
[Axon] Programming for a Line Detector Sensor?
« on: January 05, 2010, 11:33:19 AM »
It's a Reflective IR Sensor (Optek OPB745): http://www.lynxmotion.com/Product.aspx?productID=58&CategoryID=8

I couldn't find any programming code for that sensor in SoR Function list...

Anyway,

According to its manual, it is suppose to Switch its LED ON when it senses BLACK (or when nothing is in range) and Output should be Low. Likewise, if it senses White, that means: LED OFF, and Output = High !

It's operating range is in between (approx) 3mm to 12mm

I tried this code:

for(int l=0;l<5000;l++) {
int output = a2dConvert8bit(13);
rprintf("%d \n\r",output);
delay_ms(500); }


After a lot of trials on Black and White surfaces at varying heights, I got these results:

For more than 12mm from any surface, LED is ON and the output = 8
For less than 3mm from any surface, LED is ON and the output = 8
Within the range, for any surface, LED is OFF and the output = 255

So, basically, it operates within the range, but without diffrentiating colours at any height !
[According to the manual, I can adjust the Treshold from 1.5vdc to 3.5cvd, I tried, but same results]

Need help with the programming code(s)...

Thanks

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
Re: [Axon] Programming for a Line Detector Sensor?
« Reply #1 on: January 05, 2010, 04:16:12 PM »
You ask for help in programming, but clearly your sensor is not working as intended, and no programming can fix that.

The sensor is suppose to go high or low based on what color (white or black) it detects within it's operating range. Can you confirm that your sensor is operating as such?

Offline Hasan999Topic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 1
Re: [Axon] Programming for a Line Detector Sensor?
« Reply #2 on: January 05, 2010, 06:40:25 PM »
Quote
You ask for help in programming, but clearly your sensor is not working as intended, and no programming can fix that.

I'm sorry, but that's probably a wrong conclusion that you've made there^...

As I said, there is no Programming for initializing (or calibrating) the sensor that I'm using, unlike other sensors such as IR Range Finder, they are all already installed in Sensors.c

And, as I also said, I just "tried' the code: output = a2dConvert8bit(13); to check whether the sensor is operational, and can detect LOW and HIGH outputs, which turns out, which it does - BUT not correctly ! <--- so for that, I needed some programming code, to somehow calibrate it in order to get it work perfectly.

Besides, I've bought 2 of these sensors, both operate the same way... which certainly means that there is nothing wrong with the sensors (but, the programming).



Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
Re: [Axon] Programming for a Line Detector Sensor?
« Reply #3 on: January 05, 2010, 08:04:02 PM »
I'm sorry, but that's probably a wrong conclusion that you've made there^...

No, it's not.

According to its manual, it is suppose to Switch its LED ON when it senses BLACK (or when nothing is in range) and Output should be Low. Likewise, if it senses White, that means: LED OFF, and Output = High !

Ok, so let's look at the results of you test.

For more than 12mm from any surface, LED is ON and the output = 8

Ok, so out of range, the output is LOW, led on.
Quote
For less than 3mm from any surface, LED is ON and the output = 8
Out of range again, output is LOW, led on
Quote
Within the range, for any surface, LED is OFF and the output = 255

Now in range, however output is HIGH led is off, for "any surface". This is incorrect. It should be HIGH for white surfaces, and LOW for black surfaces, as you stated at the beginning of your post. Until you confirm it goes LOW, led on, for black surfaces in range, no programming will help you.

If you still thin it's the Axon's fault, use a volt meter to see the voltage on the signal line of the sensor.
« Last Edit: January 05, 2010, 08:07:41 PM by madsci1016 »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: [Axon] Programming for a Line Detector Sensor?
« Reply #4 on: January 06, 2010, 01:49:17 AM »
Actually, these sensors don't report color or distance. They only report back the amount of light they detect.

Dark colors absorb more light, and greater distances result in less light coming back, etc. So in a sense you can 'detect' color or distance, sort of, if you fix distance.

That being said, given the output you mentioned, it appears you didn't calibrate the sensor using the pot. You need to turn the pot until it outputs correctly at the distance you want.

Then try this code:

Code: [Select]
while(1)
{
if(a2dConvert8bit(13)>127)
  do_something();
else
  do_something_else();
}

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
Re: [Axon] Programming for a Line Detector Sensor?
« Reply #5 on: January 06, 2010, 08:35:26 AM »
I think you might be thinking of another sensor.

From there spec sheet:
"The sensor delivers a stable TTL compatible high or low voltage depending on the
color of the surface it is positioned over."

So it is a digital output, depending on the color of the surface.

But yes, it does loo like you need to adjust the pot to get it to function correctly.

 


Get Your Ad Here