Distance Sensor HC-SR04: Incorrect measurement



  • I experimented with several HC-SR04 using a very simple scetch with Arduino 1.8.5, reading the measurements on the serial monitor. For a static setup I fastened the HC-SR04 in a vice and had it point against a white wall, inside a dust free room. No matter which distance between the wall and the sensor adjusted, the readings kept on being more or less constant BUT all of a sudden for a few readings the values decreased to almost zero and then continued with the expected measurement.
    Does anybody have an explaination for this phenomena?
    Thanks for your assistance in advance.



  • I have had similar issue and to bypass this, I did 3 last measurements needed to be equal, before the result was accepted.
    Off cause this requires that your moving target was not too quick, which mine wasn't



  • @sunnyboy69 Getting false readings can be anything as it depends if it is a serial read from the device or simple timing of the echo, unstable voltage, or even an object caught in the path of quite a wide cone, but without further details it is impossible to identify. I've been caught before with a serial reading device, took a while before I realised....
    An extension of what @bjacobse suggested is to repeat readings until you get two identical consecutive results which are <> known limits and not cuckoo results..


 

267
Online

8.5k
Users

9.3k
Topics

98.5k
Posts