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

teckel:

xvjeko:
is it ok to use this:

HC-SR04 -------> > > > > blank space < < < < < - ------HC-SR04 sensor 2

is it ok if i limit the max reading range of both sensors to like 50 cm (and i need to read 50 cm), and i place sensors like 200 cm away from each other..
Would this work if each sensor had an independent microcontroller ???

delay(STEP_TIME);

unsigned int uS1 = SONAR_L.ping();
  per_l = uS1 / US_ROUNDTRIP_CM;




Is the blank space enough, or should i use a "sponge" to prevent interference between 2 of the sensors ?????
THX :grin:

The thing to remember is that setting the maximum distance doesn't change how strong the trigger ping is nor how far the sensor will actually sense a ping. All it does is just make anything beyond the set distance register as "clear" and the Arduino to stop monitoring that sensor. The strength of the ping and the ability for a sensor to read a ping up to 500cm away is still there.

There's still a benefit in setting this distance as short as possible for your project. Especially when using the standard ping() method. But, don't think of it as changing the way the actual sensor works.

What you always need to consider is that when a sensor does a ping, that ping can echo from around 29 to 35ms. It doesn't matter what you set the maximum distance to, this is how long a ping could be read by another sensor as a stray echo.

So in your example, it really depends on what the time is between pings. If the ping to ping time is 100ms, there would be no issue. If, however, you want to ping both sensors at the exact same time, you could have a problem.

Hope this helps.

Tim

Thanks for the anwser...
I will solve the problem by syncing them (only one sensor will work at a time, then a short delay, then the second will work etc...)