About distance accurate of HC-SR04 sensor

Hello, I have tested the HC-SR04 sensor with NewPing library and without it, but sometimes some distances are wrong.

I know that the sensor is cheap, but perhaps somebody could get it working OK.

I have tested that with NewPing library the distances are better than without it, but sometimes some distances are wrong.

Could anybody get perfect distances with this sensor ? How…?

Best regards, Ginza.

The readings depend on the distance, shape and surface of the object, and objects nearby. When your object doesn't reflect the wave directly back to the receiver, you can catch echoes and reflections from other objects.

Hello DrDiettrich, thanks for the reply.

I have read that if there is a capacitor of 100uf it can stabilize the voltage.

The HC-SR04 datasheet says that if the ultrasonic voltage is variable it can sometimes take wrong distances.

Have you test it ?

I want make my project with no expensive materials, I know that there are sensors of 50 and 100 dollars, but is a lot of money for me.

Best regards. Ginza.

A capacitor can help, indeed.

Don't expect too much from ultrasonic sensors.

Thanks DrDiettrich for your reply, I will test different options and upload the results.

If somebody read this and can share some testing results they will be welcome.

Best regards, Ginza.