The sys admin's daily grind: Charly's doorbell Pi

Ring, Ring

Article from Issue 186/2016
Author(s):

When Charly puts on his headphones at home, he often fails to hear the doorbell. So, he dreamed up a solution with a Raspberry Pi Zero, a noise detector, and a power outlet with a LAN connection.

Sometimes I sit in my home office using a headset, listening to some good old electric guitar music or taking part in a teleconference – which is naturally slightly less invigorating. As a consequence of my acoustic escapism, I tend not to hear anyone who rings the doorbell.

To restore my social presence, I opted for the smallest version of the Raspberry Pi, the Zero. The Pi needs to detect the bell circuit closing and output a visual alert. In Germany, doorbells use 8 to 12V alternating current. You could convert this to DC and tune it down to a Pi-compatible voltage, but this would involve a mess of wire in the doorbell housing.

So, I went for a noise sensor. These things are very simply made, need a supply voltage of 5V, and send a signal via the output pin when they pick up a noise [1]. A blue rotary potentiometer lets me set the noise level. The sensor and the Raspberry Pi both fit into the doorbell housing (Figure 1).

Figure 1: Noise sensor (right) and Raspberry Pi (left) have plenty of space in the doorbell housing.

Because of its proximity to the acoustic event, I can set the sensor's switching threshold to a fairly high level – it will not be tripped by the kids shouting or the dog going mad in the hallway.

Lights and Tweets

The small Python program from Listing  1 evaluates the signal in an infinite loop. The GPIO Zero library [2], which I used here, might not support noise sensors, but its Button() function is all I need to evaluate the sensor's short voltage pulse. Luckily, it includes a debounce feature: bounce_time=2 summarizes all the signals the Raspberry detects within two seconds.

Listing 1

Doorbell Script

 

When the delivery man rings the bell now, the script bell.sh launches, which actuates a power outlet connected to my LAN, which switches on a lamp in my office. At the same time, the script sends a tweet on Twitter. I know you can buy wireless doorbells down at the hardware store, but the doorbell Pi is more my style.

Charly Kühnast

Charly Kühnast is a Unix operating system administrator at the Data Center in Moers, Germany. His tasks include firewall and DMZ security and availability. He divides his leisure time into hot, wet, and eastern sectors, where he enjoys cooking, freshwater aquariums, and learning Japanese, respectively.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • The sys admin's daily grind – Yowsup

    Sys admin Charly likes to keep up with the state of his domestic strawberry plants, so he has outsmarted WhatsApp to allow status messages to be sent through the service from a PC or Raspberry Pi.

  • Charly's Column: Weather Page

    To find out what the weather is like, sys admin columnist Charly Kühnast no longer needs to go outdoors get wet, blown away, frozen to death, or sunburned.

  • Charly’s Column: haveged

    Practical cryptography is often an encounter with many random numbers in just a few moments. Entropy is the raw material that gives birth to the random number, but it’s harder to come by than you might think.

  • Hue and Rasp Pi

    Since his Trådfri Smarthome article over a year ago, sys admin columnist Charly has been receiving messages from readers with two questions: "Can you do that with the Philips' Hue system?" and "Can this also be done with a normal brightness sensor?" Yes and yes!

  • Podcasting with Audacity

    Create your own podcasts with the free and easy Audacity sound editor.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News