Operates a cat feeder made with a cereal dispenser, servo and Raspberry Pi3. Food is dispensed with a pushbutton on the feeder or a webpage. It uses a python app to control the servo since existing python libraries for GPIO support are pretty solid. (Sorry, Go would have been preferable but too many GPIO shenanigans).
Parts List:
- Cereal Dispenser
- SM-S4303R Continuous Rotation Servo
- Raspberry Pi 3
- TTL Console Cable
- USB power supply
Fritzing Diagram
All steps performed from OSX.
-
Download raspbian lite, do a fast xfer using unbuffered disk (rdisk) to copy it super fast:
sudo bash -c 'dd if=/Users/USERNAME/Downloads/2016-11-25-raspbian-jessie-lite.img | pv | dd of=/dev/rdisk# bs=1m'
-
Update SD card, add to bottom
/boot/config.txt
to disable bluetooth and allow use of debug TTL cable.dtoverlay=pi3-disable-bt systemctl disable hciuart
-
Login with screen (need TTL cable drivers)
sudo screen /dev/cu.usbserial 115200
The user / pass is
pi
/raspberry
-
Enable wifi
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Go to the bottom of the file and add the following:
network={ ssid="The_SSID" psk="Your_wifi_password" }
Then reboot the Pi.
-
Add mDNS Support
sudo apt-get install avahi-daemon echo "catfeeder" | sudo tee /etc/hostname
Then reboot the Pi.
Now the Pi should respond to catfeeder.local
On the Raspberry Pi, perform RPi.GPIO installation. Install packages:
sudo apt-get update
sudo apt-get -y install python-rpi.gpio python3-rpi.gpio python-dev
Make sure we have PIP..
curl https://bootstrap.pypa.io/get-pip.py | sudo python
Install python packages
sudo pip install RPi.GPIO
sudo pip install Flask
You will need to tune the number of ms in FEEDER_PORTION_TIME_MS
to reflect correct portion size for your needs.
Run the app, viewable on http://catfeeder.local
sudo python catfeeder.py
To run on startup, copy catfeeder
into /etc/init.d
, then run:
sudo update-rc.d catfeeder defaults
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.