Braverman_1H2A0914_web

Element14_125x125_bur2-1Next time you host a party, wouldn’t it be great if your guests could choose what kind of entrance to make? The Make-an-Entrance Party Doorbell lets them do just that. It’s a wireless doorbell that has four buttons. Your guests can select between themes you choose, say, royal fanfare, heavy metal, Star Wars, or cheering sports fans. When they push the appropriate button, a regular doorbell sound is heard inside. But when the door is opened, a sound effect is played to match their selection.

EnOceanPiKit

At the core of the project is a Raspberry Pi equipped with the EnOcean Sensor Kit. This kit is neat because it allows you to use wireless sensors and buttons that don’t require batteries. For example, the kinetic energy exerted to press the doorbell button will be used to send a wireless signal to the Raspberry Pi to select the doorbell sound effect. And a solar-powered contact sensor attached to the door will signal the Pi that the door has been opened, prompting the Pi play the appropriate sound.

YouTube player

And of course, this project is customizable — choose your own sound effects to match your friends’ tastes or your party’s theme.

Project Steps

Set up EnOcean Pi and FHEM

Connect the EnOcean Pi transceiver module to your Raspberry Pi Model B or B+ as shown. That little red wire is the antenna.

NOTE: Connect a keyboard, mouse, and HDMI monitor with sound capabilities to your Raspberry Pi when you’re setting this project up. At the end of the project, you can remove those peripherals and connect the Pi’s analog audio output to computer speakers or a sound system.

Boot your Raspberry Pi with the latest version of Raspbian and log in. Update the software and firmware with the following commands (you’ll need an internet connection for this):

sudo apt-get update

sudo apt-get upgrade

sudo rpi-update

By default, the serial pins on the Pi are used to connect to the console. In order to use the EnOcean Pi, this feature will have to be disabled. The easiest way to do this is to install a utility by Andrew Scheller called rpi-serial-console:

sudo wget https://raw.github.com/lurch/rpi-serial-console/master/rpi-serial- console -O /usr/bin/rpi-serial-console

sudo chmod +x /usr/bin/rpi-serial-console

Use the utility to disable the serial console:

sudo rpi-serial-console disable

Install the dependencies for FHEM, an open-source home automation server:

sudo apt-get install perl libdevice-serialport-perl libio-socket-ssl-perl libwww-perl

Install FHEM:

wget http://fhem.de/fhem-5.5.deb

sudo dpkg –i fhem-5.5.deb

This will install and launch FHEM. It will also set up your Raspberry Pi to launch FHEM when the Pi boots.

Test FHEM

Get your Raspberry Pi’s IP address with:

ifconfig

In the eth0 section for an Ethernet connection or wlan0 section for Wi-Fi, the IP address comes after inet addr:

From a computer that’s connected to the same network, open your web browser to http://[RPi-IP-Address]:8083/fhem

NOTE: You can also launch the Raspberry Pi desktop environment, and open http://localhost:8083/fhem/ in the Midori web browser.

You should now be connected to FHEM’s web server running on your Raspberry Pi.

Try pressing the rocker switch on the EnOcean PTM-210 Pushbutton Kinetic Harvesting Transmitter Switch Module a few times, and then refresh the FHEM web page.

If everything is working correctly, you should see “EnOcean” in the left-most column of the web page. If you’d like, you can explore the web server to discover the kind of wireless data that’s transmitted by your EnOcean sensors.

Make sure that FHEM is recognizing the EnOcean Magnet Contact Transmitter Module as well. There’s a nice magnet in the kit. Move it toward the reed switch and away from it. You should see that the state of the sensor labeled “Contact” will change between open and closed.

Download project code and sound files

Create a new directory for your project and change to it:

mkdir ~/party-doorbell

cd ~/party-doorbell

Download the project’s Python source code:

wget https://raw.githubusercontent.com/mrichardson23/party-doorbell/master/party-doorbell.py

This code will connect to FHEM via telnet and process all the actions that FHEM detects from the EnOcean Pi.

This is where you get creative. Find WAV files online and download them to the same directory. Give them the filenames doorbell.wav for the sound that plays immediately when the doorbell is pressed, and 1.wav, 2.wav, 3.wav, and 4.wav for the different entrance options. Freesound.org is a great resource.

NOTE: You may need to use the Midori web browser within the Raspberry Pi’s desktop environment to download the files, rename them, and move them into the same folder as party-dorbell.py. You can also use an SFTP client on your computer to transfer the files to the Raspberry Pi.

Start the script from the command line:

python party-doorbell.py

Try pushing one of the buttons on the EnOcean PTM-210 Pushbutton Kinetic Harvesting Transmitter Switch Module. You should hear doorbell.wav played and see feedback printed on screen.

Bring the magnet near the EnOcean Magnet Contact Transmitter Module and away again. (This simulates an opening door.) You should hear one of the four WAV files played.

Install the sensors

Snap the spare rocker plate onto the EnOcean Kinetic Switch.

Attach the EnOcean Kinetic Switch to the dry-erase board with mounting tape and decorate according to your themes. Feel free to use other materials like wood, acrylic, or cardboard for the sign.

Mount the sign outside your door.

Using mounting putty, attach the contact switch to the doorframe, ensuring the solar cell is facing outward and the glass reed switch is close to the door.

Attach the magnet to the door with mounting putty, as close as possible to the reed switch.

TIP: A small LED on the sensor lights quickly when the state of the reed switch changes. Be sure that opening and closing the door will cause the LED to blink.

Finishing touches

To get the script to launch at boot, you’ll add a line to your crontab. To open it for editing, execute this on the command line:

crontab -e

At the end of the file, add the following line:

@reboot (sleep 10;cd /home/pi/party-doorbell;python party-doorbell.py)

This tells the Pi to wait 10 seconds (so that FHEM can open the telnet port first), then change to the directory where the script is stored, and run the script.

Type Ctrl+X and then Y to save the file. Then reboot your Raspberry Pi:

sudo reboot

Your Make-an-Entrance Doorbell is ready to party! If you want to use your Raspberry Pi’s analog audio output, simply boot the Pi without the HDMI monitor connected. If you’d like to use both the HDMI monitor and the analog audio output, switch the audio output settings in raspi-config.

Conclusion

Changing the entrance themes is as easy as changing the numbered WAV files and updating the dry erase board. Your friends will always look forward to seeing how they can make an entrance at your next party.