Cat Repellent

To start with, I do not hate cats but I love birds. In my garden we have some open cages where birds can enter and leave as they please. They can find food and water there. Unfortunately sometimes a cat from the neighborhood enters my garden and I do not want it to catch any birds.

I purchased a cat repellent some years ago but it did no longer work. When I purchased a new one, my daughter could hear the sound which was quite disturbing so I returned it. It seemed that it was operating at a frequency of around 20 kHz. I started looking for a version that worked on 40 kHz but then I had the idea to build one myself.

I was often surprised by the number of IC’s with external components that were used in these devices, also my previous version used two NE555 IC’s, one for the high frequency tone and one for blinking the LEDs on the device. I had no need for blinking LEDs, only the 40 kHz signal was sufficient for me.

My cat repellent is based on a PIC12F615 microcontroller that has on-board electronics to generate a Pulse Width Modulation (PWM) signal. Because of that hardware, hardly any external components are needed. Next to that I also used another feature of the PIC to enhance the functionality of my Cat repellent.

Step 1: The Cat Repellent Electronic Design

The schematic diagram shows the design of the cat repellent. It consists of one PIC12F615, two piezo buzzers and some capacitors. It is powered by three NiMH rechargeable batteries and it uses an external mini Passive Infrared (PIR) module to detect movement. Since my previous cat repellent had a solar panel, I reused it in this design as to recharge the batteries.

Initially I thought that I needed a driver IC like the HEF4049 to drive the piezo buzzers but that did not seem to be the case. The PIC was more than capable of driving the piezo buzzers directly. In the screenshots of my oscilloscope you see the signals of pin 2 and pin 3 of the PIC without and with the piezo buzzers connected to the PIC.

The PIC12F615 supports a PWM bridge mode which means that when one output goes high, the other output goes low. When connecting both outputs to a piezo buzzer, the voltage swing will be twice the battery voltage and so doubling the output signal of the piezo buzzers. I also included a screenshot of my oscilloscope of that signal.

The mini PIR module has all electronics integrated in the PIR detector and can operate on a supply voltage of 2.7 to 12 Volt. Its range is limited to about 3-5 meter which is sufficient for my purpose.

You need the following electronic components for this project:

  • 1 PIC microcontroller 12F615
  • 1 mini Passive Infrared Module (PIR)
  • 1 shottkey diode, e.g. 1N5819
  • 2 piezo buzzers, 40 kHz, e.g. Murata MA40S4S
  • 4 ceramic capacitors of 100 nF
  • 1 resistor of 1 kOhm
  • 1 high brightness LED
  • 1 battery holder for 3 AA batteries
  • 3 NiMH AA rechargeable batteries
  • 1 solar panel of 4.2 Volt, 100 mA. Could also be a panel with a higher voltage.

I did some measurements on the power consumption of the device. When in sleep mode the PIC hardly uses any power – at least I could not measure it – but the PIR is drawing a continuous current of 16 uA. When the PIC and buzzers are active, the average total current is about 4.4 mA. The power delivered by the solar panel should be sufficient to keep the batteries charged.

BTW. I only used 3 batteries because I had a solar panel laying around which was only capable of supplying around 4.2 Volt but you can also use 4 rechargeable batteries and a solar panel that can provide 6 Volt. If you do that the signal on the piezo buzzers will increase and so increasing the range of the cat repellent.

I used a breadboard to assemble the electronics. On the photo you can see the board during test.

Step 2: The Cat Repellent Housing

People that have a 3D printer could print the housing but since I do not have such a printer, I used white acrylic plastic with a thickness of 3 mm to create the housing. The pictures show the individual parts and the assembled version.

After gluing all the parts together – except for the bottom plate – I painted it with some gold spray paint that I had laying around.

Step 3: The Software

As mentioned earlier I used some additional on-board hardware of the PIC12F615 as to extend the feature set of the cat repellent.

The software performs the following main tasks:

  • When the PIR detects movement, it generates a pulse on its output which is connected to the external interrupt pin of the PIC. This event will wake-up the PIC from sleep and will reset a timer. The timer will be reset with each detection of movement by the PIR.
  • When the PIC is woken up and the timer is reset, a 40 kHz signal is generated for the piezo buzzers and the LED is turned on.
  • When no movement is detected by the PIR for 60 seconds, the 40 kHz signal is stopped, the LED is turned off and the PIC enters a sleep mode to reduce power consumption.
  • The extra feature is the following. The PIC has an Analog Digital Converter (ADC) on board which I used to measure the battery voltage. Two functions are implemented:
    • When the battery voltage drops below 3.0 Volt and the device is active, the LED will blink to indicate that the battery voltage is low.
    • When the battery voltage drops below 2.7 Volt and the device is active, the PIC will immediately go back to sleep after it was woken up. This feature is implemented to prevent that the batteries are fully drained which can harm the batteries.

As you may expect from all my PIC projects, the software is written in JAL, a Pascal-like high level programming language for PIC microcontrollers.

The JAL source file and the Intel Hex file for programming the PIC are attached.

If you are interested in using the PIC microcontroller with JAL visit the JAL website.

Attachments

Step 4: The Cat Repellent in Action

This very short video shows the Cat Repellent in action. I am imitating a bit Cat by passing by the device from 3 meters away. As you can see – but not hear – the device is turned on as soon as I pass it.

To my surprise the PIR is quite sensitive, even more sensitive than the Cat Repellent device I had purchased many years ago. I also noticed that it switches on when big birds pass by but the sound does not seem to bother them.

Have fun making this Instructable and looking forward to you reactions and results.

Source: Cat Repellent

About The Author

Muhammad Bilal

I am a highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.