Arduino interface with maxbotic maxsonarEz1
http://snipt.net/teos0009/arduino-maxsonar-pw-pin?key=327e03f8dfda55271e87ed42d99f16ac
Maxsonar comes with a couple of flavours to interface, namely the analog and the pulse width. Below are the experiments I have done with them.
Connect MaxSonar pin 5v and Gnd to Arduino's 5V and gnd respectively. I am using Analog pin on max sonar, hence I connect it to A0 on arduino.
The ruler here is to help me to identify whether my readings are as accurate as possible. As I would put my hand across the sonar sensor at 15cm point and hopefully the readings will be 15cm too.
There are some sample code for sonar in arduino itself. I am using this from allen bruce. But he interface it to PING sonar instead.
http://snipt.net/teos0009/arduino-maxsonar-analog-pin/?key=2f06d19e68c5145fe0bbe650d3624ff8
The readings are plain crazy. 35x cm before I move my hand across the sensor. The analog pin is not accurate for short distance. But for longer distance where granularity in terms of 10s' of cm is still acceptable.
Next up, try with the PW pin. PW= pulse width. It is the Tc of the pulse generated by maxsonar that is measured. Wire to pin D8 instead of A0.
Same setup as previous. But the code have to change to reflect the method.
The data looks so much more interesting.......
No comments:
Post a Comment