# Question for begginer project

The sharp IR sensor drops off after two inches from the 'start here project'.

https://www.robotshop.com/letsmakerobots/start

The closer you get to the IR it increases a value until two inches, after that the value starts dropping. I've read Dan M solution here:

https://www.robotshop.com/letsmakerobots/node/31733.

From what I interpreted he talked about recording the value at 1 cm, 2 cm, 3 cm etc. Then taking a bigger number(his was 165) and subtracting the number the IR picks up. But isn't the at 10 cm?

for example(just an example not real recordings) at 20 cm the value is 40, at 15 its 60, at 10 its 80 but at 5 its 70.

So if used Dan M's method and picked say 101 as a number I'd get 61 at 20cm(looks good, the further away I am the bigger the number is), at 15 I'd get 41, at 10 I'd get 21, but at 5 I get 31.

From his "actual measurements"  it remained consistent and doesn't add in the 'drop' at 10 cm or 2 inches. Am I missing something here?

What he said was

he took a number larger than the largest number he got, which was at about 2", and subtracting it from the values he recieved from the sensor. He does this because if you were to look at a graph of the unaltered output from the sensor you would see the curve is inverted; closer to minimum accurate sensing distance will be a larger number, everything else after that falls off. Now, if you subtract the sensor response from the largest value you can get, you will have a ‘pretty’ sensibly oriented graph that you can understand. The larger the number, the farther away the object is from the sensor.

You might be able to pick up on what I just said if you look at the greyed-out numbers in his graph. At 2" the sensor reports between 161 and 164. At 15" the sensor reports 15. If you subtract 165 from 15 you will get 150. Bigger number, farther away. If you subtract 161 from 165, you will get 4. Smaller number means the object is closer.

His intent is to make the sensor output follow a normalized logic. All you would need to do to follow his example is to find the nearest distance your sensor will measure and use a number larger than that to invert the numbers that your sensor outputs. You will not have a one to one correlation of output and distance, but, at least when you get a higher number back after your subtraction you will know the object is farther away. If you make a graph like he did, you could add a look-up table to your bot that would let it keep a certain distance from objects and avoid objects at a different distance, or, any number of other ideas.

I understand the reason why

I understand the reason why he used a bigger number after recording all his readings.(the closer you are the smaller the number is, the further you are the bigger the number is, makes sense).

However is there anyway to fix the drop from 2 inches away? On the graph he showed, even beyond the 2 inches from ther actual reading he still is receiving consistent values.

//Ahh nevermind I misread the graph as it stops at 2 inches.

Are there any ideas how to fix it?

The baffling thing with my

The baffling thing with my IR is that it isn’t the 2 inches…my god I should have taken a ruler earlier, the ‘drop’ happens happens at 4 to 5 inches. Could this be my sensor?

Been researching

http://rocketbrandstudios.com/

I think my solution would be a bumoer switch(someone mentioned it before juat didn’t know what it was).