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
CartYou'll need
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.
- Use a plastic container with a hole at the bottom.
- Attach a servo-controlled gate or rotating platform to control food flow.
- When the servo rotates, food should fall into the bowl.
- 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.
- Connect the servo's red wire to a 5V pin on the Raspberry Pi.
- Connect the servo's brown/black wire to a GND pin.
- 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.
- Create a Python script that imports gpiozero.
- Use the Servo class to control GPIO 18.
- Test rotating the servo to dispense food.
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.
- Save your Python feeding script (e.g., feed.py).
- Open crontab with 'crontab -e'.
- Add a cron job to run the script at your desired feeding times (e.g., 8 AM and 6 PM).
- Example: '0 8,18 * * * python3 /home/pi/feed.py'
- 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.
- Wait for the next scheduled feeding time, or temporarily set a cron job for a few minutes from now.
- Watch the servo rotate and dispense food automatically.
- 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.