Doorbell Buzzer Hack for Keyless Entry

There is a new version of this tutorial available. Check it out here!

I could carry my keys to unlock my building door, but I’d rather not. I could buzz up to my apartment and my girlfriend could buzz me in if she’s around, but that’s obnoxious. It would be best if I could buzz up a short-code to my apartment (a Morse message of sorts) and have it automatically buzz me in. Fortunately, that can be done with Arduino.

The Buzzer Situation

My apartment building is equipped with a Aiphone VC-K intercom and door release system. 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:

Aiphone wiring diagram

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.

Building the Circuit

An extremely basic solution could just connect the Buzzer terminal to the base of a transistor bridging terminal 4 and ground – pushing the buzzer for my apartment would connect terminal 4 to ground and release the door lock. It’s a serviceable solution but a) not very secure, and b) not very fun to make. The incorporation of an Arduino allows a more complex and customizable unlock button-press sequence which will open the door for a specific timed series of presses, and remained locked for single or any other sequence of presses.

For this project the new Arduino Micro is perfect – it provides all the I/O need in a tiny form factor that actually fit inside the handset’s wall-mounted enclosure. The Micros were released in November 2012, and are available on Amazon Prime for $26. I recommend the version with the male headers so the whole thing can sit right on a breadboard. If you do use the Micro for the first time, be sure your IDE and drivers are up to date even if you’ve used an Uno in the past.

An input pin (13) reads the state of the buzzer via an optocoupler which maintains separation between the Arduino’s power supply and the 12V buzzer. The circuit also connects an output pin (12) to the base of a transistor which connects terminal 4 and ground.

I chose to power the Arduino with a 9V battery. I was tempted to just plug into the 12v of the communications line (the Arduino Micro can optimally handle 7-12V), but I was worried about introducing static into the line that disrupt my neighbors’ use of it or draw attention to my modifications.

Circuit Diagram (Fritzing):

Buzzer diagram

Programming the Arduino

The program is fairly simple: when the Buzzer is pressed its 12V (converted to 5v by the regulator) can be read as pin 13 == HIGH. A do-while loop measures the time intervals between subsequent presses and stores them in an array. It them compares that array to the hard-coded unlock sequence, and if they match within a certain tolerance the door is unlocked by setting pin 12 to HIGH for two seconds.

/*
* buzzer.ino
*
* Copyright 2013, Mouse Extinction
* URL: http://www.mouseextinction.com
* version 1.0, 25 MAY 2013
*/

const int buzzIn = 13; // pin connected to terminal B via
                       // voltage regulator
const int unlockOut = 12; // pin connected to base of
                          // transistor bridging terminal
                          // 4 and terminal 3 (ground)

const int debounce = 100;
const int maxWait = 5000; // wait a maximum of 2.0 seconds
                          // for change in state

const int maxCount = 3;

int codeArray[maxCount] = {500,1000,500}; // the duration
                                          // between the given
                                          // knock and the next
int buzzIndex = 0;

int fuzzyMillis = 200; // entry buzzes may fall within 200
                       // millis of timing specified by code

int listenArray[maxCount]; // will hold received buzz timing
int listenState = 0;
boolean buttonState = false;

void setup(){
  pinMode(buzzIn,INPUT);
  pinMode(unlockOut,OUTPUT);
}

void loop() {

  listenState = digitalRead(buzzIn); // listen and move to
                                     // code-entry fcn on any press

  if(listenState == HIGH){
    listen();
  }
}

void listen(){
  buttonState = false;
  int x = 0;
  buzzIndex = 0;
  double start; // start timer
  double now;

  for(x=0;x<maxCount;x++){
    listenArray[x]=0; //reset all to 0
  }

  do {
    listenState = digitalRead(buzzIn); // listen for buzz release
    now = millis();

    if (!buttonState && listenState == HIGH){
      buttonState = true;
      start = millis();
      delay(debounce);
    }

    if (buttonState && listenState == LOW){
      buttonState = false;
      listenArray[buzzIndex] = now-start; // record total time at HIGH
      buzzIndex++;
      start=now;
      delay(debounce);
    }

  } while ((now-start < maxWait) && (buzzIndex < maxCount)); // continue until
                                                        // max input or time out

  confirmAndUnlock(); // check input against code
}

void confirmAndUnlock(){
  int x= 0;

  boolean unlockArray[3] = {false,false,false};

  for(x=0;x<(maxCount);x++){
    if(listenArray[x] >= (codeArray[x] - fuzzyMillis) &&
                listenArray[x] <= (codeArray[x] + fuzzyMillis)){
      unlockArray[x]=true;
    }
  }

  if(unlockArray[0] && unlockArray[1] && unlockArray[2]){
    digitalWrite(unlockOut,HIGH); // set pin 12 HIGH to ground terminal 4 and unlock door
    delay(1500);
    digitalWrite(unlockOut,LOW); // reset
  }
}

I tested the circuit by connecting a LED between the transistor’s emitter and ground, and then used the Buzzer terminal jumper wire to tap a signal directly from my 9v voltage source to simulate a buzzer-press. By linking through pin 13 I could see it was reading by the Arduino’s on-board LED, and upon successful unlock the LED connected to the transistor would light up – signifying a successful command to prompt the door to unlock.

Installation and Completion

By mounting the Arduino Micro on a small breadboard, I was able to fit the entire package inside the handset’s wall-mounted base. After a little live testing to confirm everything worked as intended without any detriment to regular functionality, I now have an easy way to open my door without a key.

Latest Comments
  1. Sam
    • Jamie
  2. Bejay
    • Jamie
      • Bejay
        • Jamie
          • Bejay
          • Jamie
  3. Bejay
  4. Jen
    • Andreas
      • Andreas
  5. Eddie
  6. Kevin

Leave a Reply

Your email address will not be published. Required fields are marked *