Go Down

Topic: Ultrasonic distance sensor sometimes reports wrong distance (Read 963 times) previous topic - next topic


Hi all,

I have a question regarding an ultrasonic distance sensor. I have it working fine, however sometimes it reports a shorter distance than what is expected. This only happens occasionally. I suspect some electrical noise to trigger the input pin, but I am not sure. At the moment I have connected the ultrasonic sensor directly to the Arduino using +5VDC (powered directly from the Arduino board), 0V (directly from the Arduino board) and the signal wire (IN/OUT) directly to the Arduino board. I have no other electronical components installed (no capacitors or resistors).

Note that I use an ultrasonic sensor from seedstudio (SEN136B5B). This sensor use the same wire for both input and output signal. I am switching my pin in the Arduino accordingly, and as mentioned most of the time I'm getting a correct distance - occasionally the returned distance reports a value too low (input pin is triggered too early).

Should I use any other electronical components to avoid getting signal noise on the input pin? If so, what to do?

Thank you very much for any tips.


Sometimes you can get unexpectedly short ranges if you "ping" too frequently and don't allow returns from distant objects to die away.


False reports can occur if there is ultrasonic noise in the environment, and you won't hear it.

Ultrasonic sensors are not particularly reliable and you may have to reject some measurements, for example if they disagree substantially with other recent measurements. Try taking the best two out of three, similar to a moving average.


Great feedback! Thank you very much, will take a closer look at my code (according to both posts).

Go Up