The Squirrel Cafe - An Internet Connected Feeder
A project to validate the following assumption:
"The amount of nuts taken by squirrels from a squirrel feeder correlates with upcoming winter weather conditions significantly."
The IoT Squirrel Feeder's homepage: http://www.TheSquirrelCafe.com
Feeder Wiring:
Prerequisites
Currently, I'm using a Logitech C270 USB webcam to capture photos of the squirrels at the nut feeder. Therefore you need to install a USB Webcam package. I've opted for the 'fswebcam' package.
sudo apt-get install fswebcam
Useful shell commands
A 'live' view of a logfile:
tail -f /logs/feeder.log
Start a vncserver:
vncserver :1
Start feeder.py in the background:
python feeder.py &
List 'feeder' processes running on the system:
ps aux | grep feeder
Kill process by PID:
kill PID or kill KILL PID
Useful Weblinks
-
Tweepy - The python twitter lib used: http://www.tweepy.org
-
Raspberry Pi Cam Info: https://www.raspberrypi.org/blog/camera-board-available-for-sale/
-
USB Webcam Guide: http://elinux.org/RPi_USB_Webcams
-
Launch Python script on startup: http://www.instructables.com/id/Raspberry-Pi-Launch-Python-script-on-startup/
@reboot sudo sh /home/pi/peanut/launcher.sh >/home/pi/peanut/logs/cronlog.log 2>&1
You don't need this crontab entry, if you have implemented the restart launcher.sh script on exceptions as described below.
-
Using a standard USB Webcam: https://www.raspberrypi.org/documentation/usage/webcams/
-
Driver library for TM1637 7 Segment LED Display: https://github.com/timwaizenegger/raspberrypi-examples/tree/master/actor-led-7segment-4numbers
-
Restart launcher.sh script if exception kicks in using crontab: https://unix.stackexchange.com/questions/107939/how-to-restart-the-python-script-automatically-if-it-is-killed-or-dies
*/5 * * * * pgrep -f -u root feeder.py || /home/pi/peanut/launcher.sh >/home/pi/peanut/logs/cronlog.log 2>&1
