A Discord bot to ring a bell in the Glasgow Hackerspace when @doorbell is mentioned.
The code is written in Python and designed to run on a Raspberry Pi Zero 2W.
- A Waveshare 2.13" e-paper display is attached directly to the GPIO header on the pi, or as described in their documentation.
- An SG90 servo motor is wired to 5v, GND, and pin 7 (GPIO 4) on the Pi. If the e-paper display is attached to the front of the GPIO header, then these connections must be made on the rear.
- A push-button is wired between pin 5 (GPIO 3) and GND.
.stl files for a frame to mount the bell, and a stand to mount the servo are included under the 3d_files directory. Everything was mounted into an IKEA VÄSTANHED photo frame.
Deploying this project to a pi has been automated with Ansible. See deploy.md.
The bot requires a token to access the Discord API.
You need a Discord dev account to generate this token: https://discord.com/developers/
Once generated, these details should be entered into a .env file following the format of the .env.template file in this repo.
If you don't want to use Ansible the following steps should achieve the same thing.
# create a new user, add it to the required groups
useradd -m ding
usermod -a -G gpio,spi ding
# clone the code into the ding users home directory
su ding
cd /home/ding
git clone --recurse-submodules https://github.com/glasgowhackerspace/doorbell.git
# set up the python environemnt and dependencies
cd doorbell
python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txt
# configure the services
su <your normal username>
pigpiod
ln -s /home/ding/doorbell/doorbell_bot.service /etc/systemd/system/doorbell_bot.service
systemctl enable doorbell_bot
systemctl start doorbell_bot
# if you want the shutdown button to work
echo "dtoverlay=gpio-shutdown" | sudo tee -a /boot/firmware/config.txt
reboot