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

teckel:
So, you may want to try the above sketch and a similar test before we try to filter false positives or false negatives that I can't even duplicate.

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.

Nothing I aimed the sensors at produced a consistent output of periods.

Example output from the SR04/Duemilanove test, with an unmoving object about 10cm away:

.00..00.00...00...00......00..00.....00....00.00.....00.....00.00....00.00..00.. 615
00..00.00....00..00.00.....00.00.00.00.00.00.00..........00.00..00......00.00.00 0
...00.00....00.....00..........00.00.00....00...00.....00.00...00.00.00.....00.. 611
.00...00..00.00...00...00.00.00...00...00...00.00.00..00.......00..00...00..00.0 0
0..00...00.....00....00.00.00.00.00.00.00......00....00.....00.00...00.....00.00 0
.00..00...00...00.......00.00....00.00.......00........00..00...00...........00. 607
........00......00.00.00..00............00.......00.00...00.00.............00... 611
00.......00.00.00.....00.00.00.00....00.00................00..............00.... 607
......00..........00.00..00.00....00......00.00.00..00....00.....00...00.00..... 583
........00...........00.00....00..00..00...00..00..00.00..00.......00...00.00.00 0
.......00..00.00..00..00.00.....00...00.......00.00.00.....00.00.00..00......00. 611
..00..00...00.00..00..00.00...00.......00...00....00..00........00...00....00.00 0
.00...00..........00....00..00....00..00....00..00.00..00..00.00....00.......00. 611

I haven't come across false positives so far, but they are rare in my experience and not my main concern. They're rare enough that my digital filter trusts in-range values if it gets only two of them in a row, but it's common enough that I need to handle it, or my automation could turn itself on when nobody is around.

EDIT: BTW, the object I tested was my flat extended palm. I didn't have to try anything with tricky geometry (like my head, or one of my spare human heads).

EDIT2: I am still on the 1.0 IDE. I can try building and testing from the 1.0.1 IDE to see if there's a difference.