I am busy with a robotic arduino project. I have a 40kHz ultrasonic transducer and receiver. What would be the best way to generate the 40kHz signal to drive the transducer.

I have found two ways to do this:

  1. 555 timer
  2. Arduino PWM

I have the following schematic for the 555 timer:


My concerns are related to which of these two will generate the best waveform. I am also concerned that having to switch the Arduino PWM on and off might impact on timing accuracy. Am I missing something or is there a much simpler way to drive the transducer?

  • \$\begingroup\$ What about the harmonics of the square wave? Will these cause problems or does the ultrasonic transducer already attenuate some of these? Isn't a sin wave more desirable? Would adding a notch filter help? \$\endgroup\$ Dec 19, 2011 at 4:44

1 Answer 1


If you have an available timer channel, and are running at a fairly fast clock rate either off a crystal or with the calibrated internal oscillator, I'd argue you should at least give using that a solid try before resorting to external circuitry - which you are unlikely to get 1% accuracy out of anyway given that it has a capacitor in it.

You can likely time the return of an internally generated signal as accurately as an externally generated one - at worst, if you are willing to loop the signal back into a different pin and thus directly reach a hardware timer with no interrupt latency in the way.

In terms of other methods, I believe it is possible to drive the transducer using a resonant circuit, which could arguably be the most "simple", however getting an accurate frequency and clean start transition may prove challenging. And if there's an unused timer channel and pin available to drive it anyway, then the argument could be made that an external generator, no matter how "simple" is more complicated to fabricate.

Depending on the properties of your transducer you may still need a transistor or other drive amplifier at lest to get maximum output.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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