Are Ultrasonic sensors just all really unreliable?

Hey chaps, I’ve been trying to get an ultrasonic sensor to work on my little robot project, the first one mostly returned 0 so i suspected hardware failure and purchased a new five pack.

I’m using SR-04’s and the newping library. They all work fine but I get erroneous readings constantly, only when it’s sat perfectly still do I get decent reliable readings and even then its not perfect.

I’ve checked the voltage and its fine, the unit is affixed well but I just don’t get anywhere with it.

Are they all just crap and do i need to look at different options for measuring distance?

You get what you pay for. The SR-04s have a history of problems. MaxBotix sensors are very reliable.

I thought that might be the case, Thankyou.

Are the sparkfun ones decent?

Think about the environment also. I was using one of these which didn't seem to give good numbers, but part of the return signal was coming from the element I aimed the sensor at, and part was coming from fixed objects behind the target object. The moral would be that you want as narrow a beamwidth as possible, and I don't think any of the cheap ones can achieve that.

I think that HC-SR04 Ultrasonic sensors are good for small projects. I do not think that it is the hardware issue. I am working on these sensors currently, I think they produce fairly accurate results. probably you can share with us your code and see how other people can help? :)

Advanced sonar techniques will give much more reliable results, but you pay much more money for that. Cheap units wait for the first strong echo without gain-tracking, so nearby objects off-axis can have a strong influence. Better units gain-track with distance (the sensitivity rises with time), but real sonar uses lots of signal processing to distinquish signal from noise.