{"id":15290598,"url":"https://github.com/stuartleeks/pi-bell","last_synced_at":"2025-05-07T05:01:26.509Z","repository":{"id":76969041,"uuid":"248590902","full_name":"stuartleeks/pi-bell","owner":"stuartleeks","description":"A Raspberry Pi based home doorbell project","archived":false,"fork":false,"pushed_at":"2024-01-09T11:36:35.000Z","size":109,"stargazers_count":5,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-31T06:32:08.113Z","etag":null,"topics":["go","golang","raspberry-pi"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stuartleeks.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":"2020-03-19T19:45:48.000Z","updated_at":"2023-07-21T18:52:01.000Z","dependencies_parsed_at":"2024-06-20T11:14:36.882Z","dependency_job_id":"f4cc347d-42b4-4942-8531-81037adee13f","html_url":"https://github.com/stuartleeks/pi-bell","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuartleeks%2Fpi-bell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuartleeks%2Fpi-bell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuartleeks%2Fpi-bell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuartleeks%2Fpi-bell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stuartleeks","download_url":"https://codeload.github.com/stuartleeks/pi-bell/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252816937,"owners_count":21808704,"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","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":["go","golang","raspberry-pi"],"created_at":"2024-09-30T16:08:44.349Z","updated_at":"2025-05-07T05:01:26.449Z","avatar_url":"https://github.com/stuartleeks.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pi-Bell - A Raspberry Pi Doorbell Project\n\nThe goal of this project is ostensibly to build a doorbell and chime that are connected over our home network. The _real_ goal of this project is for me to get some hands-on time with a Raspberry Pi :-). There are commercially available systems that offer this functionality, but where is the fun in that?\n\n## Overview\n\nThe general idea is to use a Raspberry Pi to detect when the doorbell is pressed and to have other Raspberry Pis connected be notified so that they can trigger the chimes they are attached to:\n\n```asciiart\n+----------+    +-------------+               +-------------+    +------------+\n|          |    |             | Home Network  |             |    |            |\n| Doorbell +----+ RaspberryPi +------+--------+ RaspberryPi +----+ Bell chime |\n|          |    |             |      |        |             |    |            |\n+----------+    +-------------+      |        +-------------+    +------------+\n                                     |\n                                     |        +-------------+    +------------+\n                                     |        |             |    |            |\n                                     +--------+ RaspberryPi +----+ Bell chime |\n                                              |             |    |            |\n                                              +-------------+    +------------+\n```\n\nNote - this repo is still currently optimised for my usage. For example the `Makefile` has commands for syncing to my Raspberry Pis :-)\n\n## Installing binaries\n\nThere is an install.sh in the scripts folder that you can download and run (requires sudo), or if you trust random scripts on the internet you can run\n\n```bash\nwget -q -O - https://raw.githubusercontent.com/stuartleeks/pi-bell/main/scripts/install.sh | sudo bash\n```\n\nThis installs the `bellpush` and `chime` binaries to `/usr/local/bin/pi-bell`\n\n## Running as services\n\n### bellpush\n\nTo run the bellpush as a service, run the following commands.\n\n```bash\nsudo cp /usr/local/bin/pi-bell/pibell-bellpush.service /etc/systemd/system/pibell-bellpush.service\nsudo systemctl daemon-reload\nsudo systemctl enable pibell-bellpush.service\n```\n\nAt this point the pibell-bellpush service is installed and will start when you restart your pi.\n\n### chime\n\nBefore continuing, edit the `/usr/local/bin/pi-bell/chime.env` to set the address of the bellpush the chime should connect to. In the example below the chime will attempt to connect to port `8080` on the `pibell-1`.\n\n```env\nBELLPUSH=pibell-1:8080\n```\n\nTo run the chime as a service, run the following commands.\n\n```bash\nsudo cp /usr/local/bin/pi-bell/pibell-chime.service /etc/systemd/system/pibell-chime.service\nsudo systemctl daemon-reload\nsudo systemctl enable pibell-chime.service\n```\n\nAt this point the pibell-chime service is installed and will start when you restart your pi.\n\n### Troubleshooting\n\nThe commands below can be useful when troubleshooting the services.\n\n```bash\ncat /var/log/daemon.log\n# or\ntail -f /var/log/daemon.log\n\n# Get logs for chime\nsudo journalctl | grep chime\n# Get logs for bellpush\nsudo journalctl | grep bellpush\n# Follow the journalctl log\nsudo journalctl -fe\n```\n\nTo list video devices, \n\n```bash\nsudo apt-get install v4l-utils\n\nv4l2-ctl --list-devices\n\nv4l2-ctl --info -d /dev/video0\n```\n\n## Running interactively\n\nTo run the bellpush binary, run:\n\n```bash\n# skip qualified path if you've added /usr/local/bin/pi-bell to your PATH\n/usr/local/bin/pi-bell/bellpush\n```\n\nThen, assuming you ran the bellpush on `my-pi-1`, run the chime using\n\n```bash\n/user/local/bin/pi-bell/chime --addr=my-pi-1:8080\n```\n\n## Running from code\n\nTo run the doorbell from code, run the following command:\n\n```bash\nmake run-bellpush\n```\n\nTo run the chime run the following command (note that the `DOORBELL` value needs to be set to the name of the bellpush to connect to):\n\n```bash\nDOORBELL=bellpush-pi make run-chime\n```\n\n## Design\n\n### Bellpush\n\nThe bell push (doorbell button) part is a bell push from a standard wired doorbell connected to `+5V` and `GPIO6`.\n\n```asciiart\n                               +----------------------------------------+\n                               |  Raspberry Pi                          |\n                               |                                        |\n                    +-------+  |           +--------------------------+ |\n                  +-+ 10kΩ  +----+GND      | Web Server               | |\n                  | +-------+  |           |                          | |\n+---------------+ |            |           | /doorbell                | |\n|               +-+--------------+GPIO 6   |    (web socket endpoint) | |\n| Doorbell      |              |           |                          | |\n|               +----------------+5V       |                          | |\n+---------------+              |           +--------------------------+ |\n                               |                                        |\n                               +----------------------------------------+\n\n```\n\nThere is a web server in the `bellpush` with a `/doorbell` endpoint for a websocker connection. When the bell push is pressed the server sends JSON event payloads to all connected clients.\n\nButton pressed event:\n\n```json\n{\n    \"type\": 0\n}\n```\n\nButton released event:\n\n```json\n{\n    \"type\": 1\n}\n```\n\n### Chime\n\nThe chime part of the project controls the door chime. The chime is connected as to a transformer as per the instructions with the doorbell kit but with a relay in place of the bell push. The relay is connected to ground (`GND`), `+5V` and `GPIO 18`.\n\nIn addition to the chime circuit there is a status LED to indicate whether the chime is connected to the bell push. When connected the status LED blinks every 10 seconds, when not connected it blinks rapidly.\n\nThe chime app connects to the bell push and turns on the relay when it receives a button pressed event and turns it off for button released events.\n\n```asciiart\n       +--------------+    To mains power\n       |              +-------------+\n+------+ Transformer  |\n|      |              |\n|  +---+              |                           +----------------------------------------+\n|  |   +--------------+                           |  Raspberry Pi                          |\n|  |                                              |                                        |\n|  |  +---------------+      +------------+       |           +--------------------------+ |\n|  |  |               |      |            +---------+GND      | Chime app                | |\n|  |  |  Door chime   |      |  Relay     |       |           |                          | |\n|  |  |               |      |            +---------+GPIO 18  | Connects to web server   | |\n|  +---+T1        T3+---------+N/O        |       |           | on bell push             | |\n|     |               |      |            +---------+5V       |                          | |\n+------+T2        T4+---------+COMMON     |       |           |                          | |\n      |               |      |            |       |           +--------------------------+ |\n      +---------------+      +------------+       |                                        |\n                                                  |                                        |\n              +-------------------------------------+GND                                   |\n              |                                   |                                        |\n              |   +-----------+     +-------+     |                                        |\n              +---+ Resistor  +-----+  LED  +-------+GPIO 17                               |\n                  | (330 ohms)|     |       |     |                                        |\n                  +-----------+     +-------+     +----------------------------------------+\n```\n\n## Changelog\n\n### 0.2.0\n\n* Add systemd unit files for running bellpush and chime as a service\n* Fix bug in status LED when attempting to connect\n\n### 0.1.1\n\n* Add install script\n\n### 0.1.0\n\nInitial release#@\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstuartleeks%2Fpi-bell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstuartleeks%2Fpi-bell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstuartleeks%2Fpi-bell/lists"}