/pi-bell-slapper

The King of Ding. Internet-connected Raspberry Pi-based notification bell.

Primary LanguageOpenSCADMIT LicenseMIT

Raspberry Pi Bell Slapper

a.k.a. "The King of Ding", harbinger of the Internet of Dings

CI

Clarence 2.0 - Raspberry Pi Bell Slapper

Why? I need a Raspberry Pi to slap a bell in response to a particular trigger.

In my case, it's for a radiothon. When a nonprofit community radio station gets a phone call, you can hear the phone in the background. When they get an online donation, you hear nothing.

Something is better than nothing, so I made this project, which slaps a bell upon a triggering condition.

Is there a video of the build process?

Why, yes! How did you know?

Watch these videos for more on the build:

How is the bell slapped?

I thought you'd never ask!

The bell is hit by a solenoid, specifically the uxcell 4.5V mini Push-Pull Solenoid I bought from Amazon.

Clarence 2.0 - Raspberry Pi Bell Slapper Solenoid Ding

The Pi tells the solenoid to trigger, and a little circuit I built as a hacked-together Pi HAT fires off a short pulse of energy to hit the side of the bell directly.

In 2020, the original "Mark I" version of the bell was slapped quite differently, using a servo. Read the Mark I README for more information about that version of the bell.

What kind of bell does it slap?

I'm currently slapping a boring old call bell. This call bell. But any bell you could mount to be slapped would work.

How do I slap a bell?

I'm glad you asked! You'll need to gather some parts and solder together a little control circuit, since the Pi can't drive a 1A solenoid directly through a GPIO pin.

Parts Needed

Tools Needed

These are the tools I used to put everything together (though you can use any suitable substitute):

Assembly

Check out this circuit diagram on Circuito.io:

Raspberry Pi GPIO 4 Solenoid control circuit

You could just stick everything into a breadboard like it's laid out in that diagram, but I decided to take a small protoboard and solder everything more permanently into a makeshift HAT that attaches to the top of the Pi Zero directly.

TODO: Add more detailed directions for wiring everything together—maybe also build a custom PCB?

How do I contain this bell-slapping awesomeness?

I'm glad you asked. Over in the enclosure directory, there are STL files for a case and lid. Print those on a 3D printer, mount everything inside, and you'll be good to go!

For the current design, I use friction and gravity to hold the Pi Zero and custom HAT in place, and superglue to hold in the solenoid.

The case design is derived from @tenderlove's Analog Terminal Bell case, and is modeled in OpenSCAD. The source files are also in the enclosure directory, should you like them.

How do I tie email notifications to the bell slapper?

Well, now we're getting to the meat of it.

It's easy enough to slap a bell with your hand; there's no point in making a Raspberry Pi do it if you just want to slap the bell once or twice.

I built this project to monitor an email inbox. So I wrote a Python script, email-check.py. That python script does all the magic of translating "new email arrives" into "the bell has been resoundingly slapped".

To make this script work, you need to do two things on the Pi:

  1. Copy the config.example.yml file to a file named config.yml, and modify it with the email credentials for the account to be monitored.
  2. Make sure Pip is installed: sudo apt install -y python3-pip
  3. Run python3 -m pip install imapclient pyyaml to install required dependencies.

Then run ./email_check.py, and prepare to be amazed! Or not, especially if it doesn't work.

You might also need to install Pip, if you get an error on the python3 -m pip command. To do that, run sudo apt install -y python3-pip.

How do I continuously check the email inbox?

Well now we're really getting somewhere useful!

For now, I'm just using cron. Fire up the ol' crontab editor (crontab -l) and add the following line:

* * * * * /home/pi/pi-bell-slapper/email_check.py

Then every minute the script will run!

Note: If you have any errors, cron will email them to localhost (make sure you have something like postfix and mailutils installed to catch and read those emails). Other cron output goes into the syslog (check /var/log/syslog).

If you're using a Pi like the model A+, which doesn't have built-in WiFi, and you're using a cheap USB WiFi dongle to connect to the Internet, there's a chance it will go into a sleep mode after a minute or so—follow these directions to stop the thing from sleeping.

Were you inspired by anyone?

Of course I was inspired. You don't think I came up with all this on my own, did you? Alex Meub's Office Bell Ringer was my inspiration. Go read that post if you want to discover how I was inspired.

The enclosure design was inspired by Aaron Patterson's Analog Terminal Bell.

Why are you so interested in my inspiration? Go find your own.

Who are you?

I'm Jeff Geerling, and I approve of this repository.