This repository contains the necessary Raspberry Pi configuration and embedded software files to run the Automatic Pet Feeder Project.
The project uses a Raspberry Pi 4b to control a motor for dispensing food, recording and managing video feeds, and securely streaming live video. Configuration files for system services, cron jobs, and rc.local are included in the ExampleSystemFiles folder and should be implemented in the appropriate locations on the user's Raspberry Pi.
Before setting up the project, ensure the following dependencies are configured:
-
Rclone for Google Drive Integration
Follow the instructions here to set up Rclone with a Google Drive folder. -
Cloudflare Tunnel for Secure Streaming
Set up the Cloudflare tunnel using thecloudflaredbinary by following the directions here.
The software is divided into the following components:
- File:
webMotorControl.py - Function: Retrieves user preferences and controls motor movement.
- Startup Configuration: Add this script to
rc.localto run it on startup.
- File:
liveStreamVideoRecordVideo.py - Function:
- Provides a live camera feed.
- Detects motion and records videos.
- Converts and uploads recorded videos to Google Drive.
- Startup Configuration: Add this script to
rc.localto run it on startup.
- Function:
- Uses Cloudflare to create a secure tunnel to a custom subdomain (e.g.,
https://stream.jarvisfeeders1234.win/). - Enables token-based security for live streaming access.
- Uses Cloudflare to create a secure tunnel to a custom subdomain (e.g.,
- Startup Configuration:
- Configure the tunnel as a system service (
cloudflared.service) to connect automatically on startup.
- Configure the tunnel as a system service (
- Function:
- Mounts a Google Drive folder using Rclone for storage.
- Startup Configuration:
- Set up the connection as a system service (
rclone@GoogleDrive.service) to mount the folder on startup.
- Set up the connection as a system service (
- File:
manageDriveFiles.py - Function:
- Deletes old recorded motion events from Google Drive (keeps the last 4 days of footage).
- Schedule Configuration:
- A cron job is set up to run this script daily at 12:01 AM. Configuration details are in the
CronJobFiles.mdfile.
- A cron job is set up to run this script daily at 12:01 AM. Configuration details are in the
ExampleSystemFiles/: Contains example configuration files for system services, cron jobs, andrc.local.FlaskMotorControl/: Contains the motor control and web server files.streamVideoServer/: Contains camera feed and google drive management files.
- Clone the repository to your Raspberry Pi.
- Set up each component following the instructions in the respective sections above.
- Test the system to ensure all services and scripts function as expected.
For additional details or troubleshooting, visit the project overview.