Raspberry Pi Python app for scheduled ๐ธ cat feeder ๐ธ
This is designed for Raspberry Pi with the hardware below available via its GPIO;
- Continuous rotation servo
- Piezo buzzer
- LED
- Button
The physical setup could be something like a food dispsenser releasing dry food through a funnel with rate of dispersal controlled by a paddle which is then connected to the servo. For example:
+ +
| |
| |
| |
| |
| |
| |
| |
X XX
XXX XX
XX XX
+
+---+
+ + +
| |
+----------------+
The continuous rotation servo rotates for a given length of time to deliver a determined amount of food into a bowl below.
It supports multiple feeds per day at specified times or at ad-hoc intevals via the attached button however, you cannot feed the cat more than the permitted number of times per day. When a feed is triggered a buzzer will be sounded to inform the cat and induce regular behaviour of associating the buzzer with feeding time.
- Python 2.x
- PIP
- Virtualenv - manage Python environments
- RPi.GPIO - to run on Raspberry Pi
$ mkvirtualenv cat_bot
//
$ workon cat_bot
$ pip install -r requirements.txt
$ pip freeze > requirements.txt
Configuration manifests are in config
directory. There are the following options available:
logging_config
- Path to the logging configuration (see below)io_adapter
- The classname of IO adapter. Supports {LoggingIO|RaspberryPi} - LoggingIO can be used for dev testing where there is no GPIO.feeds
- An array ofFeed
objects (see below)observers
- An array of objects to be configured as observers of cat_bot state change (See below)
The configuration file used can be set by the APP_ENV
Environment variable, this supports the following values {development|production}. The default is development
if not provided.
Two logging configs suited for development and running on the Pi - logging-dev.yaml
and logging-prod.yaml
.
TODO: more logging info
A Feed
is a meal for the cat. There can be many per day and given times, you cannot feed the cat more than the permitted number of feeds.
A Feed
can be configured with the following properites:
name
- The name of the feed, eg "morning"hour
- The hour of the day at which to feed in 24 hour formatminute
- The minute of the day at which to feedquantity
- TODO The quantity of food to be served aka the servo rotation time in secs
An observer will get notified when the events below occur and can do something on either if required.
startup
- When application startsheartbeat
- For each internal tick or heartbeatfeeding
- When a feed occurs
Each observer in configuration should specify what it needs to be instantiated (eg Api key), the configuration will build this. The observer class should just respond to the notify
method with the single argument of event
. This will method will be called when the event occurs in a non-main thread.
With a valid configuration both of connected GPIO devices and internal configuration the application can be run by executing the wrapper in the bin/
folder:
$ bin/cat_bot
# or
$ APP_ENV=production bin/cat_bot
cat-bot's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.