Home        Store        Learn        Blog

Problem on accuracy and stabillity distance with ping sonar

Hi,
I am working with 4 ping sonars on stm32L476 and i have problems.
Sometimes sonars return absurd distances (of the order of 30m when we are 90cm from the edge) with a confidence index of about 100%. Sonars are in an enclosed space with just enough room to stick their heads out.
The use of sonars consists in setting the auto mode (set_mode_auto: ID1003) and then asking, every second or so, the distance (distance_simple: ID1211).

Thanks,
Evann

Sonars use sound waves, which can bounce, and can also interfere with each other. If you’re using 4 of the same active sensor at the same time in an enclosed space then it’s not too surprising if you transmit a pulse from one quite soon after another, and then detect the second pulse with the first sensor as a ‘far off reflection’. That would also explain the high confidence, since sound is expected to spread over distance, so if it gets a really strong signal (from right next to it) at the appropriate time for a 30m bounce then it likely considers it as a very solid reflection, so has high confidence that there’s something at that location.

Unfortunately the transmit frequency of the ping sonar can’t be changed, so you’ll either have to shield them from each other, or coordinate when they’re active/enabled in software so that they can’t interfere with each other. If you’re in a space that’s enclosed in multiple directions then shielding is likely not possible because you don’t want to block off the valid signal direction for the sonars.

3 Likes

Thanks for responding,

We will try in bigger place then and add distance between sonars.
All sonars are pointing in the same direction but add a shield is a good idea, we will try this solution.

thank you !

The use of sonars consists in setting the auto mode (set_mode_auto: ID1003) and then asking, every second or so, the distance (distance_simple: ID1211).

For your application, it might be better to set the sonar in manual mode, then you can constrain the possible solutions for the distance reading to a defined interval (ie, only scan for targets in the 50cm~150cm range). You can also reduce the gain and the ping rate manually in order to reduce interference between different units.