Introduction: SmartPET - Smart Pet Feeder

About: Student MCT at Howest (Kortrijk Belgium)

Hey!

I'm Maxime Vermeeren, a 18 years old MCT (Multimedia and communication technology) student at Howest.

I've choosen to create a smart pet feeder as my project.

Why did I make this?

My cat has has some weight-issues, so I decided to make a machine to control how much she eats.

What does it do?

- Automatic feed, if there is less than 25g in the bowl.

- Bowl detection

- The LED turns on in the dark

What makes this pet feeder so special?

With SmartPET, it registers how much your pet ate in the last couple of days, weeks or even months. It calculates whether your pet got the right amount of healthy food.

Skills for this project?

You don't need a lot of programming skills for this project. Make sure that you have some basic prototype skills to test your circuit.

In this instructable i'm gonna lead you through all the steps to make your own smart pet feeder. Clone my github repository for all files. https://github.com/vermeerenmaxime/smartpet

Let's start creating!

Step 1: Things What You Need

Components

- Servo motor

- Weight sensor (5KG): TAL220

- Lightsensor LDR: 10K – 20k ohm

- MCP3008

- Ultrasonic sensor: HY-SRF05

- Load module: HX771

- Display: 16x2

- Potentiometer

- RGB

- Raspberry Pi

- Power supply

- Resistors

- - 1x 10k Ohm

- - 1x 1k Ohm

- - 4x 220 Ohm

Materials

- Wooden planks

- Cornflakes dispenser

- Screws

- - 16 long screws

- - 4 short screws

- Hinge

- - 6 skrews to attach te hinge

Tools

- Soldering iron

- Super glue

- Saw

- Drill

The total cost of this project is around 150€ - 200€. Depending on where you buy the components. I've made a bom of materials where u can find a link to all web stores. It's in the /bom folder.

Step 2: Putting the Hardware Together

I have build my circuit by following my Fritzing scheme that I made, I uploaded the scheme below.

The circuit has 3 sensors (LDR, Ultrasonic and weightsensor) and 3 actuators (servo motor, RGB led and LCD display) that work together as one.

If you follow the scheme, it's much easier to build it on a breadboard for testing and you can put in the case later on.

I've build my prototype on multiple breadboards.

Step 3: Building the Case

I bought a cornflakes dispenser and some wooden planks for my project, but you can put it in whatever material that you want, as long as it's steady!

The case

- I sawed some wooden planks a special shape, so that the cornflakes dispenser can be placed on it.

- I've attached my servo motor to my dispenser with some iron wires. The iron wires are pulling on the steering wheel of the dispenser to rotate it, as you can see in the pictures.

- Make sure that the iron wires are strong but also thin enough to put them through the hole of the servo motor.

- I added some wood in my case, I placed my servo motor in between, to make him more stable.

- I cutted some holes in the case, to implement the LCD display, Ultrasonic sensor, LDR and RGB.

- On the back, I've added a little hinge so that you can still open it and connect your power supply into the wall outlet.

Safety

If you're new with drills, saws, .. Make sure to have someone extremely handy nearby like your dad or grandpa. The last thing you want is to hurt yourself, so put on those safety glasses like I did.

Step 4: Installing & Configuring the Raspberry Pi

For this project you'll need a cable connection to your raspberry pi first.

Once you're connected, you have to open a terminal (mac) or windows power shell (windows) to get your pi ready.

Connect your pi to the internet and wait to get an IPv4 address. From now on you can connect to the address over the internet without a cable.

Step 5: Creating & Configuring the Database

Open the config.py file and configure it correctly with your database.
You can import my database with some dummy data to get the project working.

You can find the database in the /data folder, "database.sql".

The database is made in a way that you can upgrade the SmartPET project with more sensors and actuators.

Step 6: Coding the Project

I coded my project in Python,Flask, SocketIO and Javascript.

I started with making the first wireframes of my website in Adobe XD, which is a free software by Adobe.

Then I made my design into HTML and CSS and added some basic Javascript to make my design work properly.

I've used routes in Flask to get most of my data on my website. The Sockets are for smaller things and mostly back-to-front actions such as live weight.

Step 7: Create a Service and Plug It In!

Create a service so that the raspberry pi automatically runs the code (app.py) at startup.

You can find a tutorial for how to create a service in your raspberry pi here.

I have included my smartpet.service in the /service folder to get you started.

You can now plug your raspberry pi and external power supply in the wall and run the project!

I hope you learned something from this instructable. Let me know in the comments if everything was clear enough!

First Time Author Contest

Participated in the
First Time Author Contest