Smartphone-based Keyless Entry for Door Buzzers

Almost three years I published an article detailing how to remotely buzz yourself into an apartment building. In the time since, new technologies have made it even easier to interact with your home remotely. Below, I detail an updated remote door buzzer that works with mobile phones and even Apple Watches. Furthermore, the basic setup is extensible to lighting systems and any other action that can be controlled by a shell script.

Overview

The ultimate workflow is simple and is as follows:

On your smartphone or Apple Watch, send a Yo to a custom-created recipient

Your door buzzer will be activated

To achieve this, we’ll be using a custom-made circuit that electronically switches the door buzzer. To control the circuit remotely, we’ll be using a Raspberry Pi home server that will receive casually authenticated signals over the internet sent via the Yo app (https://dashboard.justyo.co/).

Required Gear

The following items will be used to create your phone-controlled door buzzer:

Raspberry Pi — Any Raspberry Pi model should work, but I’m using the Raspberry Pi Model B+. You’ll also need an SD card (micro SD in the case of the B+ model) with at least a few gigs of space, and all gear necessary to set it up like an HDMI cable, keyboard, monitor, etc.

Pi Cobbler Plus — This will allow you to attach the Raspberry Pi to a breadboard. Optionally you can plug your circuit board directly into the Raspberry Pi, but this is a good accessory to have around anyway.

Small perf board — You may be able to build your circuit on your breadboard, but I’ve found that the optoisolator pins don’t generally fit in breadboard slots, and building a permanent circuit will be handy in the long-run

Once you’ve installed Raspbian to the SD card, you can put it in your Pi, connect the Pi to a monitor and keyboard, and then power it up to boot it for the first time. As your first act, I suggest updating the password for the `pi` user by using the `passwd` command. Next, I suggest updating the keyboard settings to reflect a US keyboard layout. Follow the instructions at https://raspberrypi.stackexchange.com/questions/1042/why-is-my-symbol-not-working to do so.

We’ll be controlling an Aiphone VC-K model. The entire system runs on 12V DC power with low current, so it’s much safer to interact with than any devices attached to a wall outlet. A quick web search for the model yielded a wiring diagram, a screwdriver provided quick access to the terminals in the handset unit, and a multimeter allowed me to understand how it works:

I have access to the VC-K unit in my apartment; the VC-M is at the front door. Terminals 1 and 2 provide communication with the front door. Terminal 3 is ground. Terminal 4 carries 12V and when connected to ground will unlock the door. By maintaing voltage in the locked state it is failsafe – a broken connection will keep the door locked and openable only by key. Terminal B drives the buzzer in the handset – its inactive state is 0v, but will send 12V when someone is pressing the buzzer for my unit at the front door.

Even though my current buzzer and my buzzer three years ago are the same, I’ve since been in other apartments with other systems in the intervening years, and their circuitry is very similar. Connecting one of the terminals to ground should unlock the door — you may just have to test with a small length of wire.

Circuit Board Design

We will now build the circuitry that will interact with the door buzzer. The GPIO controls will give us toggle-able voltage that we’ll use to drive an optoisolator. To the other side of the optoisolator we’ll connect terminals 3 and 4, such that terminal 4 will be connected to ground and unlock the door when the GPIO pin is powered.

If you’re not using the Pi Cobbler, refer to this page for pin layout.

The LED will light up when the door buzzer is toggled on, which will help us debug this down the line.

Control Script

Now, we will create a bash script to control the GPIO pins. The following script will toggle power on pin 17; name it buzz.sh.

#!/bin/bash
gpio mode 0 out
gpio write 0 1
sleep 2
gpio write 0 0

Running the Script Through the Internet

Now it’s time to allow you to run this script through the internet. To do so, we’ll setup a web server on your Pi, and create a PHP script that will run the shell script any time you request the page while passing correct URL variables.

Next, we’ll expose your Raspberry Pi to the internet. In most home setups, you’ll just have to update your router configuration to forward port 80 to the Pi. Get the IP address of your Raspberry Pi on the local network with sudo hostname -I. Review your router’s documentation to learn how to forward port 80 to the Pi.

To test your configuration, find your network’s public IP address (e.g., from your router’s admin page or a browser on another computer) and then go to that IP address on the internet, e.g., http://123.123.123.123. You should see the default Apache page.

Connecting your Buzz Script with the Internet

Now that your Pi is on the internet, we just need to create a means to run buzz.sh via the web. First, put put buzz.sh in /var/www/html/scripts folder and make it executable — sudo chmod +x buzz.sh

Next, make a PHP page in /var/www/html/scripts/ folder called buzz.php:

Now that the page is in place, the buzzer should enable when you access this page on the internet. Go to http://<your-ip-address>/buzz.php and watch the LED… it should light up for a few seconds if all is going well.

Finally, we’ll create a way to quickly access this page with the push of a button on your phone. To do so, we’ll use the Yo app. It’s a silly service, but one nice feature is that it allows you to create new Yo accounts that will perform some action when they receive Yos.

Go to https://dashboard.justyo.co/ and create a new account if you don’t already have one. From the dashboard, hit “+ Add Account”. Give your new secondary account a username. In the configuration, under “Callback”, specify the URL of your PHP script (i.e., http://<your-ip-address>/buzz.php).

Now, download the Yo app to your phone and log-in as your main account. When you send a Yo to the secondary account you created, it will send a request to the Callback URL you specified, and unlock your door.

Now that you have Yo setup, you can increase the security of your system by specifying that the Yo must come from only certain Yo accounts to be authorized to open the door. For instance:

It’s worth noting that Yo has an Apple Watch app that allows you to open your door from your watch.

Extending by Wifi

Finally, if for some reason your Pi web server is not near your door, you can place a second Wifi-enabled Pi nearer to the door that holds the buzz.sh script, and run that script across your intranet. For instance, the script below will use certificate authentication to run the script on the second Pi over SSH.

If all went well, you now have a smartphone-enabled remote door buzzer. Furthermore, this same setup can be used to run any script you may choose on the Raspberry Pi. Check back soon for ideas on lighting, and other modes of control.

Hi Jamie, thanks for the great guide. I have software engineering experience so setting up the Pi and web server was fairly trivial for me. I’m using this as a project to learn more about electricity and circuits however unfortunately this seems to be assumed knowledge in this article. I was hoping you could perhaps elaborate a bit more on the electronic side?

Some questions I have are:
1. What voltage and current did you detect with your multi-meter? I got 16V on terminal 4 and 300mA when connecting to ground. I think these are important for selecting the optoisolator you would need to use.
2. The optoisolator you linked (according to the datasheet) has a typical input voltage of 1.4V and can take 100mA (page 9). The Pi GPIO pins output 3.3V at a max of 16mA so I think you would need a resistor on your Pi based circuit. Is this correct or was left off the circuit diagram due to assumed electrical knowledge?
3. As for the intercom side of the optoisolator, the collector-emitter max voltage is 35V, well under our 12-16V which is great. However collector current states 80mA max (page 8). This confuses me because I recorded 300mA. I hope I’m reading the datasheet wrong. It would be great if you could clarify

Hey Jamie,
am in the proccess of finishing up your older project i have in my house the AIphone GH series is similar to yours but i wanted to know the sequence, knock and hang up wait half sec and knock again wait a sec hang up and knock again or just let it ring and do it 3 times?

am new to making commands on the arduino am good with electrocnics but the arduino is fairly new to me please get back to me when you can

About

digital ( control || interface || integration )

Mouse Extinction explores products, maker projects, and emerging technologies in the areas of human-computer interaction, remote control, automation, wearable or integrated computing, and the growing Internet of Things which are hastening us toward a post-mouse world. Its author is a tech enthusiast, maker, and designer.