View Single Post
  #9   Spotlight this post!  
Unread 07-05-2005, 08:46
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 588
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Help with motion detector

The easiest way to measure the short distances that you're looking for is to use an infrared rangefinder. The device mentioned above (GP2D120) is a good choice. it gives you the value directly. With an ultrasonic rangefinder you need to do timing of the return (echo) pulse to measure distance. So now you need timers and interrupts.

With the GP2D120 you get the distance back directly with only an A/D conversion so it's really simple.

One thing that you need to be aware of is that the value that the value that is returned is inversely proportional to distance - the closer the distance the higher the value. But you are probably only looking for fixed distances so that should not be a problem - you an simply look to see if you're less than the range where you want to turn (that is the value is greater than some reference you choose).

The other quirky thing about these components is that if you are less than the minimum sensing range (which in this case is 3cm) then the values start decreasing, remember decreasing values normally means longer distances.

You can get around that problem by mounting the sensor in such a way that it never sees things less than 3cm - for instance mounting it 4cm above the floor as it's looking for stairs.

If you look at the datasheet: http://www.acroname.com/robotics/parts/GP2D120_SS.pdf
you can see a graph of distance vs voltage returned.

Hope this helps.

Brad