Skip to content

Smart Pet Bowl with Raspberry Pi

Build an automated pet feeding system with Raspberry Pi, a servo motor, and scheduled feeding times.

  • Raspberry Pi
  • Beginner
  • 60 minutes
  • 5 steps

Shop this project

Cart

Prices from vilros.com. Tax and shipping at checkout.

Before you start, you'll need

  • Raspberry Pi (any model with GPIO)
  • Servo motor
  • Pet food dispenser or container
  • Jumper wires
  • Cardboard or 3D-printed parts

Design the food dispenser

About 20 minutes

Create a mechanism to dispense food when the servo rotates.

  1. Use a plastic container with a hole at the bottom.
  2. Attach a servo-controlled gate or rotating platform to control food flow.
  3. When the servo rotates, food should fall into the bowl.
  4. Test manually by rotating the servo arm.

You should see

Rotating the servo arm releases a portion of pet food.

Connect the servo to Raspberry Pi

About 10 minutes

Wire the servo for GPIO control.

  1. Connect the servo's red wire to a 5V pin on the Raspberry Pi.
  2. Connect the servo's brown/black wire to a GND pin.
  3. Connect the servo's orange/yellow wire to GPIO 18.

You should see

The servo is connected and ready to be controlled.

Test servo control

About 10 minutes

Write a Python script to manually trigger feeding.

  1. Create a Python script that imports gpiozero.
  2. Use the Servo class to control GPIO 18.
  3. Test rotating the servo to dispense food.
python
from gpiozero import Servo
from time import sleep

servo = Servo(18)

# Dispense food
servo.max()
sleep(1)
servo.mid()
sleep(1)

Adjust servo.max() and servo.mid() to control the gate opening.

You should see

Running the script rotates the servo and dispenses food.

Schedule automatic feedings

About 15 minutes

Use cron to trigger feedings at set times.

  1. Save your Python feeding script (e.g., feed.py).
  2. Open crontab with 'crontab -e'.
  3. Add a cron job to run the script at your desired feeding times (e.g., 8 AM and 6 PM).
  4. Example: '0 8,18 * * * python3 /home/pi/feed.py'
  5. Save and exit crontab.

You should see

Cron is configured to run the feeding script automatically.

Test the automated feeder

About 5 minutes

Verify feedings happen on schedule.

  1. Wait for the next scheduled feeding time, or temporarily set a cron job for a few minutes from now.
  2. Watch the servo rotate and dispense food automatically.
  3. Check the cron logs if the feeding doesn't happen.

You should see

The system dispenses food at the scheduled times.

It didn't work
  • Cron job doesn't run.

    Check cron logs with 'grep CRON /var/log/syslog'. Ensure the Python script path is absolute. Test the script manually first.

What to do next

Stuck? Contact Vilros Support with your board model and what you see on screen.