Pi camera spots a waiting pet and sends a text alert

Oct 21, 2026 Last reply: 1 day ago 4 Replies
Jump to replies (4)

When this build is running, it keeps an eye on a glass patio door and works out when a pet is waiting to come in. The camera feed gets checked by a pre-trained MobileNet SSD model from TensorFlow, which can pick out cats and dogs among other things. Once a pet's centre point sits inside one of the two marked zones for ten frames in a row, the system sends an SMS through the Twilio API, so the maker knows it is time to open the door. On screen, the feed prints 'Pet wants inside' or 'Pet wants outside' depending on where the animal was spotted.



The hardware side is tidy: a Raspberry Pi with a Picamera sits in a white plastic case with a hinged mount for the camera module, hooked up to a monitor, keyboard and mouse. Everything runs from a Python script called Pet_detector.py, which the maker walks through in Python IDLE, and the full setup instructions live in a GitHub tutorial. Two clever touches stand out to me. The zones are labelled 'Inside box' and 'Outside box' directly on the feed, and a 30-frame pause counter stops the system from firing off repeat messages after each alert. Both seem like smart, simple answers to real problems.



The price is hard to argue with at roughly $50 all in, about $30 for the Pi and $20 for the camera. The trade-off is speed: the frame rate sits somewhere between 0.4 and 1.38 FPS, since the maker says the task pushes the Pi to its computational limits. Heatsinks are recommended as the processor runs a little hot. The detection accuracy on cats and dogs is also not great with the stock model, and the maker hopes to deploy a custom trained one instead. It is an honest, well documented build all round.



Project by Edje Electronics. Watch it on their YouTube channel:

formatting link


I am curious how the zone logic actually works in the code. Does it compare the pet's centre coordinates against both boxes on every frame, or only after a detection clears some score threshold? Ten consecutive frames before alerting sounds like a good filter against one-off misreads, so I would love to know whether that counter resets if the animal drifts between the two zones mid-wait.

The 30-frame pause counter is the choice I keep coming back to. Without it, a cat sitting at the door would presumably fire off a text every few seconds, and a flood of duplicate alerts would train anyone to ignore them. It trades a bit of responsiveness for messages you can actually trust, and given the low frame rate anyway, the delay is barely noticeable in practice. Cheap, simple and solves a real problem.

The maker already liked this idea, but it deserves repeating: swapping Twilio for a cell carrier's email-to-text gateway would cut the running cost to nothing. With the hardware already at about $50, dropping the one recurring expense makes the whole thing essentially free to operate. If that works out, it would make an already affordable build even easier to recommend to anyone on a budget.

On the hardware question, the maker has said the Pi Zero W lacks the processing power to run TensorFlow, so a Pi 3 class board is needed. Between the 3B and 3B+, the recommendation is the 3B+, which has a 1.4GHz processor versus the 3B's 1.2GHz, for a slightly better framerate. On the model question, the build does use a pre-trained MobileNet SSD, and the maker thinks more accurate pet-specific models probably exist but has not shared one.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required