Sensing movement with GP2D12 IR sensor

Started by elle...@hyperisland.se July 24, 2006
Hi!

I have a GP2D12 IR sensor from Sharp connected to my basicx 24. I get read the signals through getADC on one of my pins. The value I get back vary a lot even though there is no object in front of it or even a movement. I want to detect motion in the range of 20 cm to 80 cm so I compare the old value from the new value every second. But this feels very unreliable since the value I get back seems so unstable. Is there a more acurat way to sence movement with the sensor?

Thanks in advance!

Ellen Sundh

.......................................................
Email: e...@hyperisland.se
Home: http://www.sundh.com

Hi Ellen,

Something sounds amiss, I think you are right in expecting better stability form your system.
I would suggest a 2 step approach:

(disconnect the GP2D12)
1) Make a "known DC voltage source" out of a 10K potentiometer. Connect one end to the +5 VDC
BX-24 voltage, the other end to the BX-24 GND pin, and the wiper to the BX-24 ADC analog voltage input pin.
Using a screwdriver and a voltmeter, you can set input voltages in the 0.4 to 2.4 VDC range. With "known" input, Debug your code and/or
trouble-shoot your hardware until you get reasonably stable and realistic numbers.
(re-connect the GP2D12)
2) Read and study the information at:
http://www.acroname.com/robotics/info/articles/irlinear/irlinear.html
for converting the GP2D12 signals to distance. This will provide the accuracy you need to sense movement.

Best Regards, Eric

----- Original Message -----
From: e...@hyperisland.se
To: b...
Sent: Monday, July 24, 2006 12:46 PM
Subject: [BasicX] Sensing movement with IR sensor

Hi!

I have a GP2D12 IR sensor from Sharp connected to my basicx 24. I get read the signals through getADC on one of my pins. The value I get back vary a lot even though there is no object in front of it or even a movement. I want to detect motion in the range of 20 cm to 80 cm so I compare the old value from the new value every second. But this feels very unreliable since the value I get back seems so unstable. Is there a more acurat way to sence movement with the sensor?

Thanks in advance!

Ellen Sundh

.......................................................
Email: e...@hyperisland.se
Home: http://www.sundh.com