Last Updated: 27/09/2021

Project 4 - Cat Washer

Projects >> Project 4 - Cat Washer

Arduino Cat Washer (Car Deterrent)

My wife asked me to come up with a solution for dealing with local cats leaving a mess on the back lawn. I'd seen various ultrasonic systems but the cats just seem to laugh at them so decided to look for something that would give the cat a shock without inflicting more harm than a bruised ego, so the cat washer project was born.

A PIR movement sensor was the obvious way to detect the cats, then it was just a case of squirting some water at them driven by a car washer pump. The Temp sensor was fitted in case the temperature went below Zero as putting power into a pump that couldn't turn because of ice would probably destroy the pump.

Version 1: The first version got a bit too high tech and tried targeting the cat with a servo system and multiple PIR sensors. However by the time the servo was even pointing in the right direction the cat had gone...FAIL!

Version 2: Did away with multiple sensors and just decoded to move the servo backwards and forwards while the water squirted. IT worked to a degree, but it was difficult keeping the water pipe attached to the servo so it shook itself apart after a very short time...FAIL!

Version 3: Got rid of the servo and used 2 washer nozzles from a car, each giving 2 jets of water. This have 4 overlapping jets of water. It worked very well but would sometimes get triggered by clouds and various other distractions. I had some problems with the nozzles acting as a syphon on the reservoir a few times but on the whole it worked so well that within 6 weeks the garden was cat free...SUCCESS

The cats stayed away for nearly a year, so long that I disconnected the cat washer...however they returned.

Version 4: Same hardware as Version 3, but the pump set low and the nozzles set higher to prevent the syphon issue. Simplified code with anew gap after firing the first jet of water. PIR sensor is fitted inside a short pipe to narrow the targeting area. This means the cat is within the boundaries of the outer jets before it fires meaning the cat usually gets hit by 3 jets of water before leaving...SUCCESS!.

Everything is mounted in an old case, as you can see I even have insutlation tape blocking some of the old holes in the case. It doesn't seem to leak and I have a couple of holes in the bottom just in case and for the same reason no components are mounted on the bottom of the case.

As you can see it has discouloured a bit but this is after being outside for over a year.

CatWasherv4

CatWasherv4

Circuit Diagram

Components:

Arduino Nano
Battery or power supply (Use us an old 12v power supply).
LM2596 buck convertor to give 7v to the Nano
Relay Module
PIR movement sensor HC-SR501
TMP36 temperature sensor
12v Car Washer Pump
2 x Car washer nozzles.
Some wsher hose.
Water container (Ised a watering can).
Project case to keep everything dry
Piece of old PVC pipe to reduce the angle of view of the PIR sensor.

Circuit as shown below

Circuit Diagram

Example 1: catWasherV4.ino


Click to Download code:catWasherV4.ino

The code in this sketch uses items from the following lessons.

Lesson 3: Using "if else" to control code

Lesson 6: Basic Numeric variables, boolean, byte, int, unsigned int, long, unsigned long

Lesson 7: delay() v's millis(), controlling timing of programs

Lesson 10: Using Global and Local variables

Functions 1 : digitalWrite() Using digital pins to turn things on and off

Functions 2 : digitalRead() Reading a digital pin and pullup resistors

Functions 3 : analoglRead() Reading an Analog pin, converting to Voltage

 
/* 24/09/2021
   catWasherV4
   
   Arduino Nano, pir sensor, temp sensor, relay module
   
   Senses movement and closes relay that starts water pump
   temp sensor to prevent pump running if frozen

   pins used
   A2 tempPin
   8  pir sensor
   9  pump relay
   13 led

*/
const  int tempPin = A2;//analog pin

const int pirPin = 8;     //movement sensor
const int relayPin = 9;   //Pump Relay
const int ledPin = 13;    //Built in LED

unsigned long squirtTimer;
int squirtState; //0 = off 1= someones getting wet

unsigned long tempTimer;
float tempCelc;

void setup() {
  Serial.begin(9600);
  Serial.println("catWasherV4");
  pinMode(pirPin, INPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(relayPin, OUTPUT);

}

void loop() {
  int tempReading;
  //check the temperature
  if (millis() > tempTimer) {
    //tempTimer = millis() + 1000;//1 sec for testing
    tempTimer = millis() + 600000;//10 minutes
    tempReading = analogRead(tempPin);
    tempCelc = (tempReading / 1024.0) * 500;
    Serial.println(tempCelc);

  }
  //if the temp is above 4.0C (allows time for frozen system to de ice) 
  if (tempCelc > 4.00) {//don't fire if temp lower than 4C...colder outside case
    //check if it's time to do something
    if (millis() > squirtTimer) { //either time to check pir or turn water off
      //Already squirting water so turn it off and wait 25 seconds
      if (squirtState > 0) {
        digitalWrite(relayPin, LOW); //water spraying so time to turn it off
        digitalWrite(ledPin, LOW);//led off
        squirtState = 0;
        squirtTimer = millis() + 25000;//stop everything for 25 secs
      } else {
        //Check the momement sensor for movement
        squirtState = digitalRead(pirPin);
        //Serial.println(squirtState);

        //If it spots movement...turn the relay/pump on
        if (squirtState > 0) {
          digitalWrite(relayPin, HIGH); //turn the pump on :-)
          digitalWrite(ledPin, HIGH);//led on
          //squirt for 5 seconds...cat will be up the road by now
          squirtTimer = millis() + 5000;//5 seconds is enough
        } else {
          //no movement check again in 0.3 seconds
          squirtTimer = millis() + 300; //check again in 0.3 seconds
        }
      }
    }
  }
}

Additional Resource Links

Comments


This site has been designed to be child friendly, this means that comments cannot be added to videos or directly to the site.
To add a comment or ask a question please email the address in this image: and use Project 4 - Cat Washer as a reference.