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.