NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.7

Human:
Preliminary results, tested against NewPing v1.4

Uno R3, pins 12&13 : SRF05 sensor. Other hardware (LEDs, servos, 1 5V-triggered relay) attached but not activated/powered. Tons of false negatives (0 appearing when something is in range). I tried increasing the delay to 50, and while it did help a little, it didn't resolve the false negatives.
Duemilanove, pins 12&11 : SR04 sensor. No other hardware attached. Tons of false negatives (0 appearing when something is in range). Same behavior as above with the delay change.

When I do the same test, I get nothing but periods. Maybe try it while disconnecting the other hardware to see if it's a possible noise issue. I would still not use pin 13 for input, even on the Uno. Not that it's causing the problem, it's just probably not a good idea. If you're out of pins, it would be better to swap pins 12 and 13 and use 13 for the trigger and 12 for the echo.

Also, it's possible that it's giving the zeros because the ping never initiated. While the sensor specs say it only needs a 10uS high notch to trigger a pin, maybe some sensors need a little more. I haven't seen this, but I'm thinking it's very possible. Try changing the delayMicroseconds in line 46 and 48 of NewPing.cpp to 1000 each. That should give it plenty of time to initiate the ping.

Are all these zeros the same thing you get when you use a different sensor library? As other libraries may not return zero for a failed ping, you'd probably need to do an additional command to make the out of range a zero and in range a period.

Even if the false negatives are going to happen for you in any case; If you only want to know the distance, why not just filter out the zeros and just deal with the successful pings? If you only want to know a distance, just ping frequently and ignore all the zeros.

Finally, I've been thinking of some type of averaging method in NewPing. My thought was to do an odd number of pings like 3, 5 or 7, throw out the high and low value, and average the rest. Obviously, taking into consideration zero results as well. Then, it would give that average as the result. It would be a poor man's standard deviation, creating smaller and faster code but yielding basically the same result. This would also fix your false negative results. I'd rather locate the source of your problem instead, as that's a LOT of false negatives considering I get none.

Tim