0

I have implemented an HC-SR04 distance sensor using an Arduino. After power up, the sensor operates well when objects are within range of the sensor. However, if the distance to be measured exceeds the maximum (about 15 feet) distance, the sensor times out (which is what I expect). However, after a time-out and with the distance between the object and the sensor in range, the Echo pin fails to be set low after a trigger pulse is generated. The only way to fix this condition is to power down the sensor and power it back up again. (I have verified the state of the Echo pin by using an oscilloscope.)

  • 1
    Can you post your code? I might have one kicking around to try this with. I checked out a basic HC-SR04 hookup guide (dronebotworkshop.com/hc-sr04-ultrasonic-distance-sensor-arduino) and it didn't mention this failure mode. I'm wondering if the sensor is wonky. Can you try their code, and see if you get the same effect? – asylumax Mar 24 at 13:04
0

After many hours of research, I discovered that the problem is related to the fact that there is (apparently) a well-known bug in the HC-SR04 which is a Chinese clone of a Devantech SRF04. I replaced the HC-SR04 with an SRF04 and the problem was solved. Now, the ECHO pin always goes low after a trigger and after a time-out (i.e. the object is beyond the maximum measurement distance).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.