Let's Make Robots!

inverted sharp ir

i have been using a sharp ir sensor on my first project but it seems to me that when a distance is smaller it is bigger?

i made a short program to test it:


readadc 0, b0

if b0 < 20 then

high 5

low 4

high 7

low 6

pause 500 

low 4

low 5

low 6

low 7


goto main

when i put my hand infront of it it stopped and when i removed my hande it move. shouldn't it be the other way?

i got round this by putting > istead of < and < instead of >

is this right or is something wrong. thanks :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Well, this could be exactly the way they work or inverted as you say...

What did the manual or datasheet say about it when you checked?

More reflected light (greater signal on IR detector) means you are closer in proximity, it makes sense to me.

the data sheet talks about how far it can measure, how much voltage to give it and how reflective surfaces affect it

a diagram showing how reflective surfaces affect it seem to show that it is supposed to be that way but i am not sure if that is just because it is a reflective surface. i built it along with the instructions on the start here bot  and code on part 2 suggests i am wrong (ie there is a constant called clear path a head and it is larger than the constant called danger) the graph leads me to think this is how it should be but the start here part 2 code leads me to think it is wrong. that is why i'm confused D:

it is definetly inverted.

as stated below, the way it works is by detecting reflected IR light.
the closer the object, the more light efficiently light is reflected, the more light
shines on the sensor, so the higher the output.

as for the angle of the object, if it is at an angle the ir light will be reflected in that direction,
and the beam is strongest in its center.
so the more accute the angle, the less light makes it back to the sensor, thus the lower the output signal.

i have read sharp ir sensors don't do it by the amount of reflected light but by the angle it comes back at.

pleas correct me if i'm wrong

And, it seems to go along with what Davey said. The highest number is the closest measurable range and then from there the numbers decrease as the angle of the beam gets farther away from the center of the sensor.

Yes, it is inverted. The closer the object, the bigger the number.