Analog input - Not getting good readings
December 21, 2009
I am using a Sharp IR Analog Sensor (2 different ones, in fact) and the readings I'm getting on both are not 'correct'. I'm using a PICAXE 28 & a Sharp GP2D120XJ00F or GP2Y0A21YK.
The problem initially was that Mr. First Robot (the beginner robot) was not moving forward. Or, not very often, even when in front was clear. So, I put a debug program on to read all the analog inputs. When I did this, the sensor would read '60'-ish until I put something in front of it and it would go up/down depending on the distance. So, it's 'default' value, when there is NOTHING in front of it is in the 60s, but when there is really something there the sensor then starts reading correctly, descending & ascending as expected.
Any ideas? I have jumpers to ground (I have tried jumpers the other way as well, like shown in the beginner robot walkthrough) on the other 3 analog inputs.
I think it might be the connectors, I used 3 female jumper wires to the JST wires. I just snipped in half and stripped and soldered em to the JST connecter, then electrical taped over em. I have a servo connector, so I'm gonna take off the jumper wires and replace and see if I get better results. Gonna try that now, but any other suggestions will be greatly accepted.
On a side note, I had made changes to the Start Here Robot program to take 3 readings and then average them to hopefully make a better decision, i.e. clean up the numbers a bit. I just wonder if that's a good way to try and cleanup the readings (once it's working correctly, that is)?
Thanks, Happy Holidays