Pet Automation…..Pawtomation?

Ok, the title’s a little misleading.  I have 2 cats, so they’re pretty much already autonomous and there’s not much left to be done.  Although they are both inside cats and we have 2 kitty litter houses for them that both require emptying on a regular basis.  While cleaning up after my feline overlords I found myself wondering things like, “How did they create such a smell in such a short time?” and “Do they have a favourite toilet, like a favourite cubicle?” and “OMG THIS WEAPONISED SMELL CAME FROM ONE OF THESE TINY DEMONS!?”

It’s a rainy Sunday afternoon and the house has just been cleaned.  Time to mess it up a little again.  So, along the same lines of the tweeting washing machine from my days in a multi-story house, I have created the @PooperPoster!

It’s just thrown together real quick from spare parts and as little coding as possible, but the idea here is that every time the cats use the kitty litter it tweets the event.  From these I can build statistics on their favourite cubicle etc. but more useful is the total count for each kitty litter.  I can set a reminder based on the count to let me know it’s time to clean when it reaches a certain value.

I’ve set up a Webhooks trigger in “If This Then That” which uses the webhooks trigger to then tweet out through my PoopPoster1 twitter account.  Whenever the kitty litter door is opened and triggers the optical switch, the tweet is sent and it then waits a few minutes to give the cat time to finish up before resetting.  It seems to have worked fine, so if anyone wants to build one for themselves, here’s what you need…

  • ESP8266 or Wemos mini module.
  • USB battery
  • Usb mini cable
  • Optical switch

The switch is soldered into the 5volt and Ground of the ESP8266 with the output lead connected to D2.

Arduino code:


#include <ESP8266HTTPClient.h>
#include <ESP8266WiFi.h>

int ruptPin = 4;
int LEDPin = 2; // output
int val = 0;

void setup() {

Serial.begin(115200); //Serial connection
pinMode(LEDPin, OUTPUT); //output sense for limitswitch
pinMode(ruptPin, INPUT);
WiFi.begin(“ItHurtsWhenIP”, “Xenomorph1!”); //WiFi connection

while (WiFi.status() != WL_CONNECTED) { //Wait for the WiFI connection completion

Serial.println(“Waiting for connection”);



void loop() {
val = analogRead(ruptPin); // read the value from the sensor
//Serial.println(val); // print the sensor value to the serial monitor
if (val > 500 )
digitalWrite(LEDPin, HIGH);
else if (val < 501 )
digitalWrite(LEDPin, LOW);
if(WiFi.status()== WL_CONNECTED){ //Check WiFi connection status

HTTPClient http; //Declare object of class HTTPClient

http.begin(“”); //Specify request destination
http.addHeader(“Content-Type”, “text/plain”); //Specify content-type header

int httpCode = http.GET(); //Send the request
String payload = http.getString(); //Get the response payload

Serial.println(httpCode); //Print HTTP return code
Serial.println(payload); //Print request response payload

http.end(); //Close connection


Serial.println(“Error in WiFi connection”);


delay(60000); //Send a request every 60 seconds


0 comments on “Pet Automation…..Pawtomation?Add yours →

Leave a Reply

Your email address will not be published. Required fields are marked *