USB powered ultrasonic cat repeller
Cats and geeks have a lot in common. We both love computers. However while we love to game and code, cats seem to prefer computers for other reasons. They are a good source of heat and the cables provide an endless source of amusement as they sharpen their claws and teeth on them. Whether it is your keyboard cable or your speaker wires, cats seem to love the taste of wire insulation as much as they love the taste of turkey. God damn it's annoying.
So... what is the best way to repel cats from your computer area? A USB powered ultrasonic cat repeller! 25kHz is well beyond the range of human hearing, but cats can hear it just fine. So if you can make an alarm powered by your computer that spits out a 25kHz screech, it should scare the kitties away. Stupid hippies may complain that this is inhumane, but I think it is a much better alternative than kitties chewing on a 110V power cable don't you? Here is how I made mine:
1 or more 25kHz ultrasonic transducers
8 pin chip socket
42TL031 600:100 Mini audio transformer
Any capacitor >1uF
Project source code and hex file
The first thing to do is take the USB cable, cut off the B connector, and strip the insulation. There will be four wires, but you are only interested in the red and the black wires. These are the +5V and GND wires respectively.
To start with, I soldered the chip socket to the board and connected the USB cable and filter capacitor. I plugged the cable into my PC and read 5V between pin 1 and pin 8 of the chip socket.
At this point, you should program the PIC with a PIC programmer. This is the one I use. Remember that pin 4 on a PIC12F675 is input only, so don't try to drive the transducer with it! Just ignore it like all the hot cheerleaders in highschool ignored you. The microcontroller will be programmed to provide a 25kHz signal that randomly turns on and off and lasts for random durations of time, for maximum kitty startling power.
According to the transducer datasheet, driving the transducer with a 5V signal from the PIC would result in a 102dB output. If we step up the voltage to 25V, we can get a 115dB output- 20 times louder! To do this I used a small audio transformer to step up the voltage. I bent the center wires upwards since they were never used.
Pay close attention when wiring the transformer - the P (primary) side is soldered to the transducers because we are using the transformer backwards to how it is normally used.
The amount of current each pin on a microcontroller can deliver is limited, so I paralleled pins as shown on the schematic. If you examine the source code of the project, you will see that while one set of pins are high, the other are low. Then a few microseconds later, the two sets invert. This kind of configuration is very effective in driving a transformer, and does a much better job than just switching one set of pins high and low. With the outputs of the PIC being configured as a half-bridge driving the transformer, the result was a signal that went from this to this:
For my gizmo, I opted for two transducers in parallel so that ultrasound could be emitted in all directions. Here are some pics of the final result!
Unfortunately... my 'ultrasonic' cat repeller isn't ultrasonic! It puts out a very faint audible beeping. I wasn't able to fix the problem. One possibility is that at 115dB, the sound is just so loud that normally unhearable sounds become noticeable. The other possibility I can think of is that the waveform going into the transducer isn't a perfect 25kHz sinusoid and the odd harmonics being fed in there are what I am hearing.
And yeah... there is one other problem. It doesn't repel cats. It startled my cat for a few seconds, but he quickly got used to it. Within a minute, he got curious and started playing with it!
Perhaps this project should just be re-christened the "USB powered sonic cat toy". Does anyone have any idea what might be different in my design compared to commercial solutions? Do the commercial solutions even work or is it all a big scam?