Wake Up! The Cat Came Back!

In order to get the most out of the batteries connected to your microcontroller, you’ll probably need to put it to sleep, the deeper the better. [Rgrokett] was curious about the nighttime habits of his cat, and came up with a nice little hack to get more battery life out of the ESP8266 that he was using.

[rgrokett]’s cat enters and leaves through a cat-door. He figured a PIR sensor would let him know when there was movement around the door. He could then tell if the cat was around. Leaving the PIR sensor and the ESP8266 microcontroller (an Adafruit Huzzah) on all the time drained the batteries pretty quickly, so [rgrokett] decided to try putting the Huzzah to sleep.

The trick in this build is that the PIR sensor is used to reset the Huzzah when it triggers. The Huzzah requires the reset switch to go from high to low, but the PIR trigger goes from low to high, so a transistor is used to invert the PIR sensor’s trigger signal. When the Huzzah wakes up, it connects to the WiFi network and sends [rgrokett] an email via IFTTT ([rgrokett]’s description goes over the steps to set up a secure connection to IFTTT.)

It’s a pretty simple hack, but it increases [rgrokett] system’s battery life from a couple of days to more than a month (he’s still waiting to see how long they’ll last) and all that was needed was the microcontroller, the sensor and a couple of parts. We have a couple of older hacks about putting the ESP modules into deep sleep, such as this one, and check out this tutorial on PIR sensors.

20 thoughts on “Wake Up! The Cat Came Back!

    1. If The idea was to detect when the door opened, a Reed switch mounted to the cat door frame and a magnet on the door would be the cleaner route than a toggle switch

      1. Yeah you don’t want cats to attack the poor venomous deadly wildlife.. or prevent the plagues of mice and other critters tormenting Australia.

        If it was an advisory to keep the cat safe it would make sense, but apart from that.. no.

    1. Agreed, they are sadistic killers that are very destructive to any environment they are introduced into and anyone who lets them roam about is incredibly selfish and irresponsible. If you don’t care about any of that there is also the fact that they can get diseases from other cats, such as Feline immunodeficiency virus. The moment you let your cat be feral it is no longer a pet, it is just an introduced pest that should be exterminated. Even in the Middle East where they originated from they should be caged so that they do not genetically contaminate the remaining wild cat populations.

        1. Speak for your self fool, the science is very clear, domestic animals harm wildlife in multiple ways, if their owners are irresponsible. Not just cats, but this time the subject was cats.

    2. Another reason to keep the cat indoors. Better chance to stay alive.
      I have a pair of hawks that have taken up residence in my area. Since
      they are a mated pair, and hunt in pairs. I have noticed a 90% reduction
      in squirrels last two years. It’s going to get worse, when the little chicks
      hatch and squirrels start getting harder to catch. Cats and small dogs
      become next target.

      1. Or.. they find themselves the victims of a unfortunate accident suspiciously close to a catowner.
        It sounds like your area has more of a hawk problem than a pet problem.
        Perhaps someone should make a call so they can move those hawks to a more remote area where they fit in better.

  1. “they are sadistic killers that are very destructive to any environment they are introduced into”, so, just like humans. Applying human behavioral values on an animal that is acting on instinct seems a bit of a stretch.
    http://news.nationalgeographic.com/news/2007/06/070628-cat-ancestor.html, Although a mass consumption puff piece, this article seems to indicate the origins of cats is more complicated and even distinguishing between wild and domestics is difficult

    1. They maybe sadistic killers. A study in UK, showed they hunt rats and birds.
      In a much larger quantity than realized. They also realized if it was not for
      cats. Country communities would be overrun by rats. New York city is a prime
      example of too few cats in the streets. Rats bites are a bigger problem than
      cockroaches. You can always get a iguana, to handle the roach problem.
      Too many renters can’t have pets.

  2. Just use a reed-switch with a magnet on the cat-door… and a reed-relais in parallel on the power (switched by a ESP-GPIO -switch the reed-relais on in the first lines of the setup-function and turn it of after sending the message is done) to keep the ESP-powered-up while connecting to Wifi and sending to IFTTT.. this way you don’t need deep-sleep at all because you switch of the ESP completely… 0.00 uAmps between door-usages ;-)
    The battery will last forever (depending on how often the cat uses the door it might last several years)

Leave a Reply to dopplerCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.