Let's Make Robots!

IR range sensor

Bench Test - GP2Y0A21YK

I little while back I was blogging about my mini-sumo project, the Pink Pearl, named after a brand of pink eraser I like. I had decided on the pink color because I believe, contrary to popular opinion, color does not matter at the mini-sumo scale. Here are the results of my first bench test using the Sharp GP2Y0A21YK (10-80 cm) sensor.

**Disclaimer - This test was not performed under highly controlled laboratory conditions, but by a robot geek in a garage.**

Robot range measurement!!!

I am trying to get a distance reading from Sharp GP2Y0A21YK0F Infrared range finder. I used the following code to get the distance reading;

readadc10 0, w2
let w2=w2+1
let w2=6500/w2
let w2=w2-4
let w3=w2
debug w3
goto main

I am getting a fluctuating reading, the distance reading seems to vary +/- 7cm from the actual value. I tried to ground the unused ADC inputs but still the problem is the same. If anyone have any experience on this please help.
Thanks in advance