Pages: [1]   Go Down
Author Topic: SensComp Sensor  (Read 578 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Code:

#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); 

}



* IMG_0420.JPG (1425.94 KB, 2048x1536 - viewed 17 times.)

* IMG_0421.JPG (1421.65 KB, 2048x1536 - viewed 19 times.)

* diagram.jpg (52.49 KB, 611x448 - viewed 16 times.)

* result.jpg (78.32 KB, 547x667 - viewed 13 times.)
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8975
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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. "
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1]   Go Up
Jump to: