I was doing this project for a kid - an ultrasonic buzzer that alerts you when an object is within 1.7 meters in front of you. We are using an HC-SR04.

I set up a 555 in an astable multivibrator configuration that produces a 10Hz rectangular wave (T = 100ms.)

Now the way this ultrasonic transducer works is realtime generation of a asymmetric PWM, what I mean to say is it does not wait for the ultrasonic echo and then generate a PWM and send it to the ECHO pin. So if there is no object detected, it will send back a 38ms PWM.

For 1.7 meters, the PWM width is 10ms, anything above 10ms is empty space (until you reach there.)

Here is how the wave at TRIGGER AND ECHO look

PWM generated by ECHO

All I would want to achieve is let 15, 18, 5 ms pass through but the 38ms PWM should be blocked. What should be the approach I should take?

  • \$\begingroup\$ PWM is not the correct term. The information is in the delay. I’d suggest something like another 555 set up as a monostable set to the maximum delay (38ms). This is triggered by the start pulse. If you get a return pulse before the 38ms monostable has timed out, then that is a valid distance. \$\endgroup\$ – Kartman Dec 16 '20 at 6:52
  • \$\begingroup\$ To filter out a pulse when the decision can't be made until the pulse has already started will be more difficult than necessary. Some of your requirements are contradictory. Please clarify what behavior you want from your system, pure requirements, no implementation. \$\endgroup\$ – Mattman944 Dec 16 '20 at 16:19
  • \$\begingroup\$ big thanks to everyone This is a kid project, blind folded be able to navigate your height long obstacles. And accurately warn if there really is a obstacle. the echo of HCSR04 is real time in nature, as soon as it receives a trigger (almost in time), it turns ECHO high until an object is detected or a 38ms timeout happens trigger happens every 100ms. An acceptable result would be no signal when ECHO is > 10ms I noticed my current setup keeps beeping at approx. 50% duty even when nothing is in front of it. All I want it to do do is stay quiet during the 38ms timeout \$\endgroup\$ – Ady Dec 16 '20 at 18:50

Your Answer

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

Browse other questions tagged or ask your own question.