a
Ultrasonic transducers don't work that way. That is... You don't just
apply continuous power like you would a lightbulb and they suddenly start
broadcasting away at the desired 40kHz or whatever the design frequency is.
From an electrical standpoint the ultrasonic transducer behaves much like a
relatively small capacitor. From the datasheet you linked to the actual
capacitance is around or somewhat larger than 2000pF. If you apply DC (or
even if you turned that power on and off at 40kHz it would still not work)
power like you are suggesting you will be disappointed to find that the
transducer makes no ultrasonic noise at all.
You need to drive it with a full AC signal at as close to 40kHz as possible
(assuming a 40kHz transducer). Additionally transducers usually do not like
having DC voltages across them (in addition to the rated peak to peak AC
voltage).
Since you are using a microcontroller it should be no problem to configure
it to output a 50% duty cycle 40kHz square wave on one of your I/O pins. Do
this.
Once you have that go and buy some device such as the TC1428 MOSFET gate
driver IC. You aren't driving MOSFETs here, but these ICs are fairly
versatile and will provide the desired functionality very well. Datasheet
here:
http://ww1.microchip.com/downloads/en/DeviceDoc/21393b.pdf
This device is made by Microchip and should be available from your favorite
distributors. The TC4428 will also work, and is vaguely superior to the
TC1428 while usually not costing anymore from your distributor, so perhaps
it is an even better choice.
http://ww1.microchip.com/downloads/en/DeviceDoc/21422b.pdf
Once you have one of these devices tie pins 2 and 4 together (the two
inputs) and hook this to your ~50% duty cycle 40kHz squarewave from your
microcontroller. Pin 6 (Vdd) goes to your +9V supply, and of course gnd
(pin 3) goes to ground. Pins 7 and 5 are your outputs of what amounts to a
miniature integrated H-bridge. These pins go to your ultrasonic transducer.
One goes to one side, the other to the other side. Polarity is not
important.
The novelty of the TC4428 device is that it performs the level shifting
function (from a 0-5V logic signal) to the 0-9V (or whatever Vdd is up to
18V) as well as providing two complementary outputs that work very nicely to
produce a full AC signal which can be applied directly to the ultrasonic
transducer just as an H-bridge constructed of discrete components would.
The average DC current the transducer itself will likely take is around
1-2mA or thereabouts. This assumes one of the ~2000pF flavor 40kHz
transducers driven with 9V peak-peak. This is calculated from C=Q/V and the
definition of current being I=Q/t. Thus the power consumed by the
transducer itself will likely be much smaller than that consumed by other
parts of the circuit (such as the TC4428 or TC1428 device).
Once you get this all working you will probably want to increase the
broadcast range of the system. 9V peak to peak is rather wimpy for an
ultrasonic transducer rated for say 20V peak-peak. You will probably want
to run it close to it's maximum rated voltage (with some derating), so
perhaps something around 16V peak-peak is desirable. If you use the above
mentioned MOSFET gate driver IC all you have to do is increase Vdd to 16V.
However, the real improvements possible in terms of signal range lie not in
the transmitter design but in the receiver amplifier. Design your receiver
amplifier very well. I'll leave that as an exercise for the student, but
you will need a gain of at least 1000 at 40kHz (assuming 40kHz transducers)
to get any kind of range at all. Filter out or otherwise keep noise out of
your amplifier at all costs.