This repository contains code in order to automatically open and close a chicken door based on sunset and sunrise at a given location.
The code is based on the following hardware:
Raspberry pi (tested on a RPi A, Rev 2)
Sainsmart 2 channel Relai
DS3231 RTC with this board
Simply download the repository and run:
cd ChickenDoorControl/ChickenDoorControl/
sudo ./Install.sh
If you want everything in one command, just pate the following into the command line:
sudo apt-get update && sudo apt-get install git -y && git clone https://github.com/NitramLegov/ChickenDoorControl.git && cd ChickenDoorControl/ChickenDoorControl && sudo ./Install.sh
Please put special notice on the following manual task:
In order to enable the RTC hardware, please do the following:
- reboot
- Edit the following file: /lib/udev/hwclock-set
comment out the following lines:
if [ -e /run/systemd/system ] ; then
exit 0
fi
- Any configuration is stored in ChickenDoorControl/ChickenDoorControl/ChickenDoorControl.conf
In here, you can edit the pins for opening and closing the door (BCM Layout)
you can also edit the time needed for opening & closing (in seconds)
the default config is:
[Doorcontrol] up_pin = 27 down_pin = 17 time = 30
- The sainsmart module should be powered with 5V
- Please note the system is designed to run headlesss. It uses the hardware watchdog to automatically reboot if the pi gets hung up.