{"id":16603292,"url":"https://github.com/dbrgn/chicken-coop","last_synced_at":"2025-10-11T20:50:17.253Z","repository":{"id":50225555,"uuid":"362950246","full_name":"dbrgn/chicken-coop","owner":"dbrgn","description":"Hardware and firmware for our chicken door automation","archived":false,"fork":false,"pushed_at":"2024-09-07T20:10:20.000Z","size":3429,"stargazers_count":7,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-28T16:44:10.984Z","etag":null,"topics":["chicken","chicken-coop","chicken-coop-automation","chicken-coop-door","embedded-rust","librepcb","rust"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dbrgn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-29T21:20:15.000Z","updated_at":"2024-09-07T20:10:23.000Z","dependencies_parsed_at":"2024-09-07T19:32:26.616Z","dependency_job_id":"598031d9-ca10-4d6d-957b-7aceee91fbf5","html_url":"https://github.com/dbrgn/chicken-coop","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dbrgn/chicken-coop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fchicken-coop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fchicken-coop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fchicken-coop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fchicken-coop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbrgn","download_url":"https://codeload.github.com/dbrgn/chicken-coop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbrgn%2Fchicken-coop/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279008637,"owners_count":26084480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chicken","chicken-coop","chicken-coop-automation","chicken-coop-door","embedded-rust","librepcb","rust"],"created_at":"2024-10-12T00:49:04.074Z","updated_at":"2025-10-11T20:50:17.220Z","avatar_url":"https://github.com/dbrgn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chicken Door / Chicken Cam\n\nAn automated door for our chicken coop, plus a Raspberry Pi that livestreams\ntwo cameras to the browser using WebRTC.\n\n## Block diagram\n\n![Block diagram](chicken-coop.png)\n\n## How it works\n\nThe main goal of this project is to automatically open the door in the morning\n(using a gear motor), and to close it at night.\n\nIn the controller, a combination of RTC and ambient light sensor is used:\n\n- In the morning, the door will open if the `OPENING_LUX_THRESHOLD` is passed,\n  but not before `EARLIEST_OPENING_TIME`.\n- If `LATEST_OPENING_TIME` is reached, the door will open even if the\n  `OPENING_LUX_THRESHOLD` has not yet been reached.\n- Once the door is open, it will not close again before `EARLIEST_CLOSING_TIME`\n  is reached.\n- After `EARLIEST_CLOSING_TIME`, the door will close once the ambient light\n  falls below the specified `CLOSING_LUX_THRESHOLD`.\n- If the `CLOSING_LUX_THRESHOLD` is not reached at `LATEST_CLOSING_TIME`, the\n  door will close anyways.\n\nTo detect an open or closed door, reed switches are used.\n\nThe controller is connected via USB / serial to a Raspberry Pi. This Raspberry\nPi is used for streaming two webcams to a website (an outdoor webcam and an\nindoor infrared night-sight webcam).\n\nAdditionally, the Raspberry Pi sends out Threema notifications whenever the\ndoor status changes (or if an error occurs). For this, the `observer-service`\nis used.\n\n### Firmware: State machine\n\n    ┌───────┐                         ┌─────┐\n    │Initial├────────────────────┐    │Error│\n    └───────┘                    │    └─────┘\n       │                         │\n       ▼                         │\n    ┌──────┐     ┌──────────┐    │\n    │Closed├────►│PreOpening│    │\n    └──────┘     └───────┬──┘    │\n       ▲                 │       │\n       │                 ▼       │\n    ┌──┴───────┐       ┌────┐    │\n    │PreClosing│◄──────┤Open│◄───┘\n    └──────────┘       └────┘\n\n- `Initial`: The state when turned on. The controller will transition to the\n  \"Open\" or \"Closed\" state depending on the sensor readings.\n- `Closed`: Waiting for `EARLIEST_OPENING_TIME`\n- `PreOpening`: Waiting for either `OPENING_LUX_THRESHOLD` or `LATEST_OPENING_TIME`\n- `Open`: Waiting for `EARLIEST_CLOSING_TIME`\n- `PreClosing`: Waiting for `CLOSING_LUX_THRESHOLD` or `LATEST_CLOSING_TIME`\n- `Error`: Reachable from any state when something goes wrong (e.g. reading a sensor)\n\nIf the firmware is in non-error state, the blue LED will toggle every second.\nIf it's in error state, the LED will remain on.\n\n## Firmware: Testing\n\nTo run unit tests:\n\n    cargo test --target x86_64-unknown-linux-gnu --tests\n\n## Firmware: Flashing\n\n    cd firmware\n    cargo flash --connect-under-reset --chip STM32F411CEUx --release\n\n## Firmware: Serial Terminal\n\nTo open a serial connection:\n\n    python -m serial.tools.miniterm /dev/ttyACM0 9600\n\nThen type `?` to see the help.\n\n## Chicken Cam\n\nIn addition, the `rpi-image` directory contains a buildroot based Linux and all\nconfiguration necessary to livestream two cameras (an USB webcam and a raspi\ncam) to the web browser using WebRTC (backed by Janus as streaming server).\n\nTo build the Raspberry Pi image:\n\n    cd rpi-image\n    ./build.sh\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbrgn%2Fchicken-coop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbrgn%2Fchicken-coop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbrgn%2Fchicken-coop/lists"}