Skip to content or main menu

Automated Apartment Buzzer with Twilio

Programming is a skill that can give great reward. Even a beginning programmer can write software that can save time and money. As a software developer, I am always looking for ways to save time and money using simple software.

I recently moved into a building in which the front door could be opened through a phone access system or RFID tag. Guests type in the suite number of the tenant they’d wish to contact. The system connects the guest to the tenant’s phone. The tenant then opens the front door by pressing the number ‘6’ on their phone.

Until now we had only one RFID tag, shared between two people. I realized that I could create a simple script to do the job. I chose PHP because it requires the least amount of work for people to setup. When I was researching this project I came across Danielle Morrill’s post about doing the exact same project.

Getting Started

  1. Get a Twilio Account
  2. Purchase a local or toll free phone number
  3. Tell your building manager to use the new number for your buzzer

The Flow

  1. Guest or roommate dials apartment number and is presented with a menu
    1. Enter extension to be forwarded to roommate’s cell phone
    2. Roomate can enter secret code to open the door

The Code

I have the full git repository on GitHub. It consists of the following two files. apt.php as the main menu script and then gather.php for the execution.

At the main menu when the user starts typing in numbers it sends a POST request to gather.php. gather.php figures out if the key combination satisfies any condition. If the secret code is entered, it plays the “6 tone”, which opens the door.

Getting It Setup

I’m assuming that you already have a place to host the PHP files. If so, upload them (or git clone) to your server. Find the public URL of the PHP file and go back to the Twilio account page. Click on your phone number and enter in the URL to the apt.php file.

Last Remarks

This was a very fun project to hack around on and even saved me quite a bit of money. Some things to keep in mind are the costs associated with Twilio. The phone number will cost $1 per months and each time somebody dials your suite number, you will be charged 1¢ per minute that they are on the line. In the scope of the things, it’s incredibly inexpensive.

You can also used a hosted solution like Buzzeromatic for only $1.95 per month.