How do I drive an ultrasonic transducer with an Arduino?

Since the Arduino pin won't be able to source enough current to drive the transducer very well, you can use a transistor with base connected to the Arduino pin to drive the transducer.

If we assume the transducer is a 40kHz (very common) one, then you would toggle the pin at 40kHz. Nice and simple.

Here are a couple of schematic options. The first one will probably work a bit better as it will develop a higher drive voltage (higher than the supply) due to the resonant circuit formed by the inductor and transducer capacitance.

Ultrasonic 1

The reciever part in the above picture is not necessary for the cat deterrent project, this was taken from an ultrasonic range finder schematic where the echo needs to be timed. Unless you want know how close the cat is of course :-)

Ultrasonic 2


Just looking at the ultrasonic transducer without having open one ever it looks like it ha similar functionality to a standard movement activated light. That means that in the top half of the transducer you see the lens which detects movement using a Passive infra red (PIR) sensor. When this detects any motion it switches a signal pin which triggers the ultrasonic burst. Of course you can take advantage of this and switch the signal pin using an arduino or any other microcontroller using your own cat detection method. Might be a good idea to put in a optocoupler between the arduino and the ultrasonic transducer to protect both circuits from each other.

here is some info about some optocoupler and I cant post the link about the pir since chiphacker dosnt trust me enough... But just go into arduino.cc and search for pir and you will find it