Sharp Range Sensor gives inconsistent results
June 15, 2008
I'm trying to use a Sharp range sensor (http://www.pololu.com/catalog/product/136) on the Picaxe 18x project board but I seem to be getting bad results. When the sensor is not facing anything within range, the analog input jumps around 95 - 110 in the debug window. When an object gets closer the results seem to be more accurate, but still jumps around a little bit.
The problem is that when objects are in range and getting closer, the number goes up (I believe this is correct behavior). So if my robot is trying to avoid objects, 100 looks really close -- even though nothing is in range. I would expect the sensor to show something close to zero when nothing is within range.
I've connected the wires to the board in the order of: red, white (data), black. This seems to be correct based on the datasheet for the board.
Based on the "First Robot" tutorial, I also shorted the other analog input. Then I added a 10 micro farad capacitor to the power input line to the sensor. I'm running this circuit with 4 AA batteries.
Is my seonsor bad or could I be doing something wrong?