Cat Deterrent for Fish Pond
by Rune Guillemyn in Circuits > Raspberry Pi
61 Views, 0 Favorites, 0 Comments
Cat Deterrent for Fish Pond
My project is a cat deterrent for fish ponds. I came up with the idea to help my grandparents because they have a little pond in their garden but a lot of their fish have gotten killed by local cats. This project will help them a lot because it is able to watch over the pond at all times, keeping the fish safe even when my grandparents aren't at home. A camera will watch over the pond and detect when cats are near, this will activate a high frequency sound that scares the cats away.
Supplies
- Raspberry Pi 5: https://shorturl.at/KER7Y (RaspberryStore.nl)
- Webcam: https://shorturl.at/LSclr (Bol.com)
- LCD Display: https://shorturl.at/gCT2U (Amazon.com)
- Passive Buzzer: https://shorturl.at/QGUZD (Amazon.com)
- Wooden planks: https://www.brico.be/nl/search?text=hout+plank
Downloads
Gathering and Preparing Data
- I gathered data by looking for datasets that contain images of cats, ponds and both of them together.
- Once I found a decent amount I made sure I had around the same quantity for each group, that way my dataset will be balanced.
- Then I annotated the data on Roboflow. I did this by drawing a box around a cat or a pond whenever this was seen in the picture.
- Once ready I divided my dataset in 70% train, 20% validation and 10% test data.
- Finally I added augmentation like blur, noise and brightness and that way I have more images to train on.
Train a YOLOv8 Model
- First import YOLO from ultralytics so you can use YOLO.
- Then select a model, in this case choose the YOLOv8 with size small.
- Train this model using your data.yaml file, with 50 epochs and images size 320.
- In your data.yaml file you first say where all your images are located, then how many classes there are and after that you say which model you are using.
- You can look at your confusion matrix to see how accurate your model is.
Make Sure Model Works
Make some code that uses the model to see if it works well and detects everything.
Downloads
Make Connection Between Laptop and Raspberry Pi
- I made a "connect.py" on my laptop that looks for the connection to my Raspberry Pi, it also has code that initialises the camera and sends the classes detected to the Raspberry Pi.
- After that I made a "server.py" on my Raspberry Pi that waits until the laptop connects to it, it also has code that takes the detections and uses them to display something on the LCD and makes a sound with a passive buzzer when a cat is near a pond.
Make the Case to Put Everything In
- Cut out 4 sides from the wooden planks. (15cm by 19cm)
- Make the holes needed for the camera, lcd, cables and buzzer.
- Stick the sides together with screws.
- Make the top and the bottom. (19cm by 19cm)
- Stick the bottom together with screws as well.
- Attach hinges to the top and to the backside to create a lid.
- Glue the camera, buzzer and lcd to the right holes.