I’ve been wanting to dive deeper into Raspberry Pi development for a while but needed to make the time and find a project. Image classification using machine learning has been an interest so something using the motion sensor and camera sounded ideal.
As it turns out, my significant other’s cat provided an opportunity to put those to use. The cat tends to go places that are off-limits such as the kitchen counter tops. Products like this PetSafe SSSCAT Spray Deterrent exist but require expensive compressed air cartridges and go off with any motion – pet, human, or otherwise. Another option is the Echo Flex with the motion sensor – a time based automation routine can help in the kitchen or maybe a hallway outlet near a bedroom. Other options include fragrances or custom mats but they all leave something to be desired.
The goal for the project is simple:
- Detect motion with Infrared sensor
- Take pictures and/or video with a camera when motion is detected
- Classify footage and determine if it’s the cat
- Not any cat but a specific cat
- Using a previously trained machine learning model
- If it’s a match to the cat, perform relevant actions:
- Play a startling noise to discourage the cat from restricted areas
- Optionally send some form of notification
Conceptual Overview
Series Overview (In Progress)
Current and planned topics in this series are broken down into the following posts.
- Raspberry Pi Cat Motion Siren (Project Overview)
- Scripting Raspberry Pi Image Builds
- Automating Raspberry Pi Setup
- Deploying, Running, Debugging .NET Code on Raspberry Pi
- Deploying .NET Apps to Raspberry Pi with GitHub Actions and Docker
- Raspberry Pi Infrared Motion Sensor with .NET
- Capturing Images and Video with Raspberry Pi Cameras (Coming Soon)
- Performing Image Classification on Raspberry Pi
- Turning a Raspberry Pi into a Siren
Tentative Hardware
It’s worth noting that not all of the hardware listed below is strictly required for this project. Some of it was used just for evaluation or because I already had it handy and some planned items may not be used. Also some items listed individually can be bought cheaper as part of a bundle.









Software / Tools / Tech
- Visual Studio Code
- Raspbian Buster Lite
- ASP.NET Core 3.1 and C#
- Docker and Docker Hub
- Git, GitHub, and Github Actions
- Tensorflow .Net
- Mac, Linux, and Bash scripts
- MMALSharp for image capture
- System.Device.Gpio
Up Next
Scripting Raspberry Pi Image Builds – the next post in this series looks at automating the process of downloading Raspbian lite, extracting the image, formatting the SD card, copying the OS image, mounting / un-mounting / ejecting disks, configuring Wi-Fi and SSH, and more.