Automatic Cat Door

by Saeidaism in Circuits > Raspberry Pi

25 Views, 0 Favorites, 0 Comments

Automatic Cat Door

Marilyn036.JPG

Hello, we will be making an AI powered cat door that recognizes and opens for your cat only! We are creating this because I'd like my cat to stop clawing at the door whenever it wants to enter or leave. I however do not want unexpected guests visiting my home either. Therefor this project.

Supplies

BOM.png

All supplies and their information can be found in the attached file.

Cat Pictures

Marilyn047.JPG

Take a bunch of pictures of you cat, and also try to find as many pictures as you can of other cats. I found the pictures of other cats online.

Picture Annotation in Roboflow

Screenshot 2024-06-16 231711.png

Head over to roboflow. Make a new project and upload and annotate all your pictures! This can take a long while so consider using the auto label function. Make sure to choose the correct classes/labels when annotating your images.

Dataset Generation

Screensho.png

After everything is annotated you can add all your images to your dataset. i recommend using a 70/20/10 split for you train,test and validation folders. Then we go to the generate section and we generate the dataset files to download. You can choose what you want for the preprocessing and augmentation steps. Roboflow lets you know if you are going to crazy with your steps.

Model Training

We will train our model using CNN. we wont use SVM since it costs too much computationally to train. First we either ask the download link from Roboflow or we download it directly. we will request YOLOv8. From there we train our model. Here is an example file. edit it to your specific needs.

Downloads

Double Check

image.png

Check your data from the training model and make sure your model is up to standard and identifies everything correctly.

Hardware Setup

IMG_1876.jpg

We wanna wire all our hardware to the correct slots. Thankfully the board is labelled. Pay lots of attention to how and where you wire your cables. One mistake and you can fry your board. ground to ground and power to power!

Hardware-Software

Screenshotzzz.png

Once the hardware is setup, you plug in your raspi AND no smoke comes out of your board(whilst its on) you are set. We can start coding the logic into our hardware. You can find my github repository right here. Once again beware, dont blindly copy the code. Change the values to fit your case. make sure your raspberry IP address is correct and insert your own .pt file of your model. we will clone the repo on both our pc and our raspberry. We run the .py file in the RPI folder on our raspberry and the .py file in the AI folder on our notebook. These 2 will communicate over LAN. so plug that last cable in.

A Case Study

We will design our case. I designed mine in Illustrator. I wanted to use wood and made a laser cutting file for that sake. It took 2 thin sheets of processed wood. You can obviously hand craft your own case or do something very different!

Completion

Once we have our cutouts we can simply glue it all together and fit the sensors in the cutouts. We will also make the sliding door mechanism for our servo motor (Everything is inlucided in the .AI file).