Distance sensor for Rover5

If we take a look at the pins on the arduino we see it goes GND, VCC, SENSOR.


And if we look at the pinout from the distance sensor on the end of the lead we see SIGNAL, GND, VCC or VCC, GND, SIGNAL. Either way it isn’t going to work.


So, as a crude fix I just swapped the red and the black cables around half way down the cable and then used electrical tape to label the plug pins correctly.


Then I ran some basic test code on the Arduino and read in the values from the sensor. It seems that numbers under 10 are very close objects, 10 – 20 near by, and anything over 100 seems to mean nothing much around. Will need to do some more tuning later on this I expect.

Screen Shot 2013-05-18 at 8.27.49 PM

Here’s my current test code:

#include <SoftwareSerial.h>
int i;
int val;
int redpin=6;
void setup()
void loop()
int i=analogRead(redpin);
int val=(6762/(i-9))-4;
Share on Facebook

Leave a Comment