HC-SR04 ultrasonic sensor - echo waveform 'high time'

Hi all!

Anybody tinkered with this sort of common ultrasonic sensor module before?

I'm just trying one out for the very first time today. Pretty good performance in general - after having downloaded some test code from the internet.

The test code that I downloaded uses 'PulseIn' function for measuring the 'high time' of the pulse on the 'echo' pin.

I now realise that the high-time of this pulse on the 'echo' pin is the "round-trip" time (between start of the transmitted ultrasonic pulse and the start of the received echo). I realise that the module conveniently does all the work for us.

But ------ I notice that when the ultrasonic sensor is pointed in a direction with no targets in its usual specified detection range, I get one of two possible results - either values around 16000 to 18000, or values of approximately 70000.

The values can just flick around between these two ranges. Or they may stabilise to 70000 if I move the sensor a tiny bit. Or may stablise towards the 16000 to 18000 range of values if I move the sensor a little bit more.

Some results are shown below for the case where the sensor wasn't being touched, and we get those particular values mentioned.

I also wrote new code (not based on the tutorial) which uses interrupt pins (pin 2 and pin 3) for timing the high-time of the 'echo' waveform. I saw the same results --- either in the 70000 region or in the 16000 region.

Has anybody else encountered the same thing? I even tried a second (same model) HC-SR04 module ..... just to make sure that it wasn't related to a single module.

I'm only just tinkering with this module. And interested to see if anyone has seen the same thing, and if that's expected - or unexpected behaviour? Thanks all!

time microsec: 17229
time microsec: 17061
time microsec: 17177
time microsec: 17051
time microsec: 17030
time microsec: 17246
time microsec: 17220
time microsec: 17044
time microsec: 17123
time microsec: 17087
time microsec: 18833
time microsec: 18802
time microsec: 18927
time microsec: 70040
time microsec: 70042
time microsec: 70047
time microsec: 70042
time microsec: 70052