Only few days ago I mentioned that I started to reintroduce sonar support to INAV. When DigitalEntity told me that popular HC-SR04 is crap I did not belived him. I expected that "official" 4m range on a noise-machine aka quadcopter is unrealistic, but data I recorded today clearly shows: HC-SR04 is crap and is absolutely not suited for quadcopters and probably other UAVs. Why? Because it goes nuts and starts to pick background noise instead of surface.

Let's take a look here:

Bottom trace shows pseudo Signal-to-Noise-Ratio (SNR) while top one shows raw HC-SR04 altitude and INAV position estimator altitude (GPS, barometer and accelerometer combined). As you can see, it's not that bad. There is a correlation between both of altitudes and SNR is pretty low.

Same thing is happening here. Quadcopter descended to land, both altitudes went down to finally meet at zero. SNR is low too. Nice.

But, very bad things starts to happen as soon as altitude crosses 1.5m. Not only SNR goes up, but HC-SR04 starts to report completely unreliable data! If it was reporting out-of-range state, it would be fine. But no, it keeps reporting something between 1 and 2 meters while real altitude is much higher. Total crap.

Conclusion is simple: HC-SR04 can be used on multirotors but only on very low altitudes. Something like 0.75m over concrete. Or 0.5m above short grass. Or even less over long grass. Definitely not good enough for terrain following flight mode.

Next week I will test US-100 ultrasonic rangefinder. It is supposed to give much better results. I hope so...