Skip to content

matevz/chickencoop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

36c51a0 · Feb 19, 2025

History

25 Commits
Jul 11, 2023
Feb 19, 2025
Jul 11, 2023
Jun 22, 2023
Feb 19, 2025

Repository files navigation

Chicken Coop

Chicken Coop python app running on Raspberry PI.

Supports:

  • capturing temperature using DHT22
  • controlling actuator relay for opening/closing door
  • streaming mjpg video using official camera module
  • streaming audio using USB sound card using external icecast+darkice services
  • controlling IR illuminator relay for night vision
  • reading input button, if you want to open/close door manually on-site without a smart phone
  • support for scheduled door opening and closing on sunrise and sunset
  • stores the current state into config file so the door remain in position in case of power shortage

The app is split in two parts:

  • the backend controls the GPIOs (relays, temperature readings, button)
  • the frontend serves a website and captures video from the camera

Scheme

Breadboard scheme

Mandatory screenshot

Screenshot

Installation

Backend

Install dependencies:

sudo apt install python3-libgpiod # also installs libgpiod2
pip install adafruit-circuitpython-dht astral

Run backend with

cd backend
python chickencoop_backend.py

Frontend

Run frontend with

cd backend
python chickencoop_frontend.py

Visit http://your-raspberry-address:8080.

Systemd services

You can register chickencoop to start when raspberry turns on. Put those in /etc/systemd/system/chickencoop_{frontend,backend} respectively.

[Unit]
Description=Chicken Coop Frontend
After=network.target

[Service]
ExecStart=/home/pi/chickencoop/frontend/chickencoop_frontend.py
WorkingDirectory=/home/pi/chickencoop/frontend
User=pi
Restart=always
Type=exec

[Install]
WantedBy=default.target
RequiredBy=network.target
[Unit]
Description=Chicken Coop Backend
After=network.target

[Service]
ExecStart=/home/pi/chickencoop/backend/chickencoop_backend.py
WorkingDirectory=/home/pi/chickencoop/backend
User=pi
Restart=always
Type=exec

[Install]
WantedBy=default.target
RequiredBy=network.target

Don't forget to enable them so that they are executed on startup:

sudo systemctl enable chickencoop_frontend
sudo systemctl enable chickencoop_backend

Check logs by:

sudo journalctl -u chickencoop_frontend
sudo journalctl -u chickencoop_backend

About

Automated chicken coop based on RPi

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published