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

snailshoe:
At the moment, I only have the two sensors. There seems to be something wrong with one sensor. It works fine by itself, but as soon as I apply power to the second sensor, the reading of the first sensor shows that something is 5cm away. If I take power away from the second, the first sensor then works fine. With the new library and example sketch, everything else seems to be working. I'll have to get some more of the HC-SR04s and try them out.

You're not sharing pins to both sensors are you? Or having the sensors face each other?

When you say as soon as you apply power to the second sensor, what exactly do you mean? Do you have a sketch that's connected to these two sensors? Could you share the sketch?

What it sounds to me like is that you're doing two things at once, or have two sensors connected together. So each work on their own, but as soon as you try to use both there's a failure. Seeing your sketch and how you have them wired up would help greatly.

For testing multiple sensors at once, I would suggest using the 15 sensors test sketch found here:

http://code.google.com/p/arduino-new-ping/wiki/15_Sensors_Example

For 2 sensors you would change SONAR_NUM to 2, and the "sonar" array would be changed to something like this:

NewPing sonar[SONAR_NUM] = {     // Sensor object array.
  NewPing(12, 11, MAX_DISTANCE), // Each sensor's trigger pin, echo pin, and max distance to ping.
  NewPing(10, 9, MAX_DISTANCE)
}

Obviously, the pins would need to be correctly entered or changed to match.

Tim