Ping sensor help

HI all,

So im new to arduino, and as a beginner project I decided to try building a very simple walker robot, consisting of two servos and a ping sensor and arduino uno rev 3 microcontroller. So as of now I am trying to figure out how to connect the 4 pin ping sensor to the arduino board. The 4 connections are labeled, vcc, trig, echo, gnd. However, I am not quite sure how and where to connect them. Also how would i begin programming it? Any help would be apprectiated

#define Trig_Pin 13
#define Echo_Pin 10

void setup() {
  pinMode(Trig_Pin, OUTPUT);
  pinMode(Echo_Pin, INPUT);
}

void loop() {
  unsigned long Time;
  digitalWrite(Trig_Pin,HIGH); delayMicroseconds(1000); digitalWrite(Trig_Pin,LOW);
  Time = pulseIn(Echo_Pin, HIGH);

   // The shorter the time, the closer the object.

  delay(100);
}

You can also look at http://arduino.cc/playground/Code/NewPing

I thought the Ping sensors use the same pin for trigger and echo?

Caveat: I have never seen a Ping sensor, only going on what gets posted here.

Tim has written a nice pibg lib here - http://arduino.cc/forum/index.php/topic,106043.0.html -

AWOL: I thought the Ping sensors use the same pin for trigger and echo?

I've seen, though not used, sensors with 3, 4 and 5 pins. So I would assume that a 3 pin sensor would use the same pin for trigger and echo. The 4 pin I have played with (with limited success) uses 4 pin, separate trigger and echo. I'm not sure how 5 pin module would be configured.

AWOL, you are right. The Parallax Ping brand ultrasonic sensors only has three pins with a single trigger/echo pin that is labelled "SIG." The other two pins are "5V" and "GND."

Batchi, could you give us a link to the data sheet or at least tell us what brand and model ultrasonic sensor that you are asking about?

P.S. Can a moderator move this to the sensor section of the forum? Batchi might get more replies.

Hi guys,

Thanks for all the help. A little more info.

I got it from Amazon: http://www.amazon.com/Ultrasonic-Distance-Rangefinder-Obstacle-Detection/dp/B0066X9V5K/ref=sr_1_1?ie=UTF8&qid=1338253454&sr=8-1 With this model name: HC-SR04

How would i connect it to the arduino board?

Again, im a complete novice at this and am trying to figure this out

Thanks

I've never used the HC-SR04, but here's a good link. Most of the following links have step by step instructions. http://letsmakerobots.com/node/30209

Instructables.com is an excellent resource. Here is a selection of tutorials for your sensor: http://www.instructables.com/pages/search/search.jsp?cx=partner-pub-1783560022203827%3Anpr2q7v5m6t&cof=FORID%3A11&ie=ISO-8859-1&q=hcsr04

and another: https://www.google.com/#hl=en&safe=off&sclient=psy-ab&q=hc+sr04+arduino&oq=hc+sr04&aq=1&aqi=g4&aql=&gs_l=hp.1.1.0l4.1634.5420.0.7450.9.7.1.1.1.0.161.889.0j7.7.0...0.0.1kRV4LC8Vt4&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&fp=5b390b1cf5252b20&biw=1047&bih=490

Here is one for a fraction of the price. http://www.ebay.com/itm/1pcs-Ultrasonic-Module-HC-SR04-Distance-Measuring-Transducer-Sensor-Arduino-/261009210866?_trksid=p4340.m185&_trkparms=algo%3DSIC.NPJS%26its%3DI%26itu%3DUA%26otn%3D5%26pmod%3D330736915407%26ps%3D63%26clkid%3D8748945221003098309#ht_3301wt_1390 There are others as well.