GithubHelp home page GithubHelp logo

cat-bot's Introduction

cat-bot

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.

Getting started

Dependencies

  • Python 2.x
  • PIP
  • Virtualenv - manage Python environments
  • RPi.GPIO - to run on Raspberry Pi
$ mkvirtualenv cat_bot
//
$ workon cat_bot

Install dependencies via pip

$ pip install -r requirements.txt

Save installed dependencies to pip

$ pip freeze > requirements.txt

Configuration

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 of Feed 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.

Logging

Two logging configs suited for development and running on the Pi - logging-dev.yaml and logging-prod.yaml.

TODO: more logging info

Feed

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 format
  • minute - The minute of the day at which to feed
  • quantity - TODO The quantity of food to be served aka the servo rotation time in secs

Observers

An observer will get notified when the events below occur and can do something on either if required.

  • startup - When application starts
  • heartbeat - For each internal tick or heartbeat
  • feeding - 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.

Running

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

Contributors

rob-murray avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.