SensComp Sensor

Did anyone know how to program this kind sensor(SensComp 600 series)?

Wire Connect

INIT = 4
OSC = 5
ECHO = 6

I get the result of 191402,191338,191477 keep changing although the distance is same. And how can i convert the value to meter or inches?

#define  INIT   4  // Trigger the measurement
#define  ECHO1   6  // Receive the ultrasonic signal feedback
#define  ECHO2   5  // Receive the ultrasonic signal feedback

void setup()
{
  Serial.begin(9600);
  pinMode(INIT, OUTPUT);
  pinMode(ECHO1, INPUT);
  pinMode(ECHO2, INPUT);
  
  delay(1000);
}

void loop()
{
  long duration1,duration2;
  
  digitalWrite(INIT, LOW); // trigger the sensor to measure distance
  delayMicroseconds(5);
  digitalWrite(INIT, HIGH); // finish trigger
  delayMicroseconds(80);
  
  duration1 = pulseIn(ECHO1,HIGH);  // Read the signal feedback
  
  Serial.print("duration = ");
  Serial.print(duration1);
  Serial.println();
  
  delay(100);  

}

diagram.jpg

http://www.acroname.com/robotics/info/articles/sonar/sonar.html

"Interfacing to Microcontrollers

The interfacing of the 6500 module to a microcontroller is not too difficult. The simplest connection requires only two lines, one output for INIT, and one input to receive the ECHO. In this mode, BINH and BLNK are just tied to ground as they remain low through the entire measurement cycle. If you want to do your own blanking, you will also need to have output connections to the BLNK and BINH inputs bringing the total lines used to four.

The board can be wired directly from the 6500 board's cable connector to the pins of most micros including PIC, 68HC11, and BasicX. The only exception is the ECHO line which is an open collector This pin needs to have an external 4.7K Ohm pull-up resistor in order to work properly. "