Best way to use IR distance sensor

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
wjdzm
 
Posts: 13
Joined: Tue Jul 12, 2016 1:42 pm

Best way to use IR distance sensor

Post by wjdzm »

Hi all,

I am trying to use IR distance sensor (PID: 164) to measure the distance of my object.
My adafruit shield and arduino uno are set up.
When I read the voltage of the sensor using readVoltage(a,'analog_pin#'), the voltage fluctuates very much even though the object reflecting is stationed still.
Is there an equation I can use to derive an accurate distance?

Thanks,

User avatar
adafruit_support_bill
 
Posts: 88086
Joined: Sat Feb 07, 2009 10:11 am

Re: Best way to use IR distance sensor

Post by adafruit_support_bill »

The output of these does tend to be a bit noisy. You may need to average a bit over time to get a steady reading.
Here is a library that does that for you: http://playground.arduino.cc/Main/SharpIR

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”