Ping Sensor Range Issue (Bad Sensor?)

Question: Do I have a faulty Ping Sensor?

I am using the Parallax Ping sensor for collision avoidance. The problem I am having is that the sensor is only accurate out to about 5inches. Anything beyond 5 inches and the readings do not increase at all. The serial output maxes out at about 1000-1200ms. I have mounted the sensor multiple ways and it makes no difference. I have tried using both the ping library and the Arduino ping sample sketch and get the same result.

I want to use the sensor to map it's surroundings and 5 inches isn't going to cut it. The sensor is rated for up to 3m but I am not getting anywhere close to that.

What do you think? Is it faulty?

I'd suggest posting pictures of how you have it wired up and directly copy/pasting your code using the [#] insert code tags. It's hard for people who have never seen your setup to know that everything's hooked up 100% correctly, we all make mistakes. Get those up and I'm sure you'll get help fixing it or finding out if you have a bad Ping.

I'm confident it is wired up correctly. Ground to ground on Uno, 5v pin connected to the regulated 5v connector on the uno and the Sig connector is hooked up to pin 5.

Output from serial display when I put my hand in front of sensor:

5in, 13cm
4in, 11cm
3in, 8cm
2in, 6cm
2in, 6cm
2in, 6cm
2in, 7cm
2in, 6cm
2in, 7cm
4in, 10cm
5in, 13cm
5in, 14cm
5in, 13cm
5in, 13cm
5in, 13cm
5in, 14cm
5in, 13cm
5in, 14cm
5in, 13cm
5in, 14cm
5in, 13cm
5in, 13cm
5in, 13cm
5in, 13cm

Using this sample sketch:

/* Ping))) Sensor
  
   This sketch reads a PING))) ultrasonic rangefinder and returns the
   distance to the closest object in range. To do this, it sends a pulse
   to the sensor to initiate a reading, then listens for a pulse 
   to return.  The length of the returning pulse is proportional to 
   the distance of the object from the sensor.
     
   The circuit:
    * +V connection of the PING))) attached to +5V
    * GND connection of the PING))) attached to ground
    * SIG connection of the PING))) attached to digital pin 7

   http://www.arduino.cc/en/Tutorial/Ping
   
   created 3 Nov 2008
   by David A. Mellis
   modified 30 Jun 2009
   by Tom Igoe
 
   This example code is in the public domain.

 */

// this constant won't change.  It's the pin number
// of the sensor's output:
const int pingPin = 5;

void setup() {
  // initialize serial communication:
  Serial.begin(9600);
}

void loop()
{
  // establish variables for duration of the ping, 
  // and the distance result in inches and centimeters:
  long duration, inches, cm;

  // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
  // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);

  // The same pin is used to read the signal from the PING))): a HIGH
  // pulse whose duration is the time (in microseconds) from the sending
  // of the ping to the reception of its echo off of an object.
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);

  // convert the time into a distance
  inches = microsecondsToInches(duration);
  cm = microsecondsToCentimeters(duration);
  
  Serial.print(inches);
  Serial.print("in, ");
  Serial.print(cm);
  Serial.print("cm");
  Serial.println();
  
  delay(100);
}

long microsecondsToInches(long microseconds)
{
  // According to Parallax's datasheet for the PING))), there are
  // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
  // second).  This gives the distance travelled by the ping, outbound
  // and return, so we divide by 2 to get the distance of the obstacle.
  // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
  return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds)
{
  // The speed of sound is 340 m/s or 29 microseconds per centimeter.
  // The ping travels out and back, so to find the distance of the
  // object we take half of the distance travelled.
  return microseconds / 29 / 2;
}

Bought the sensor at Radio Shack, so I was able to go down and exchange it. It was a bad sensor. Now gives readings as advertised.

9in, 25cm
7in, 19cm
6in, 17cm
12in, 32cm
12in, 32cm
90in, 231cm
90in, 232cm
90in, 231cm
88in, 224cm
88in, 224cm
87in, 224cm
87in, 224cm

Also watch out for cross talk between the 5V and your signal lines if they're pretty close by.