Introduction: Keyfob Deadbolt

Picture of Keyfob Deadbolt

The key to my apartment never worked quite right because it is a copy of a copy of a copy. I am fairly certain that the dead bolt is original to the building and the property manager seems to have lost the original key years ago. As a result unlocking the door was always a pain. Changing the lock wasn't an option, but eliminating the need to use a key was.

Arduino Uno
RF transmitter and receiver
2 Push Button Switches
Green LED
Various Resistors
piezoelectric speaker
Perf Board

Step 1: Mounting Parts

Picture of Mounting Parts

I used a couple of pieces of acrylic that I acquired in the dumpster of the plastic shop next to my place of work (they throw out alot of small pieces like this). Alternatively another material could be used if you don't have access to acrylic, but it is easy to work with and looks cool.

Using a piece of paper trace the mounting holes for your dead bolt and transfer them onto your acrylic sheet. Since most dead bolts are going to be slightly different I am not sharing the template I made out of a piece of paper (mainly because it isn't anything worth sharing).

Leave the paper covering on while working with the acrylic. The paper makes it easy to mark where to cut/drill as well as protects the material from scratches. Once all of your cuts are made and your holes are drilled you can start installing components such as LEDs and switches.

Step 2: Servo

Picture of Servo

I used an old parallax servo I had in my parts bin. This small servo is more than strong enough to turn the deadbolt. In order to attach the servo to the lock shaft I used epoxy putty. Epoxy putty is very easy to use and is extremely versatile. The wire you see sticking out of the putty will be used as the arm for the limit switch.

At some point the wires to my servo had been cut so I had to open the case and solder on new ones. I took that opportunity to solder on a second wire to the 5v line and connected it to the limit switch arm.

Step 3: Wiring

Picture of Wiring

Screws were countersunk from the back of the acrylic. A wire was attached to each screw and then to a digital pin on the Arduino. When the wiper with the 5v wire touches the screw it pulls the digital pin high on the Arduino. Please see the schematic for further details.

Step 4: Program

Disclaimer: I am not a programmer and therefore the below code may not be the most efficient. Feel free to improve the code for your own uses if you see any errors or problems. It works for me so I hope it works for you.

// turn CW to lock and CCW to unlock
//1700 CCW; 1500 Stop; 1300 CW
//written by Chris Rybitski
#include <Servo.h>

Servo deadbolt;  // create servo
const int CWLimit = 6;   // Limit Switch on 6 Unlock
const int CCWLimit = 7;   // Limit Switch on 7 Lock
const int Redbtn = 12; //red push button
const int Blackbtn = 8; //black push button
const int GreenLED = 10; // Green LED
const int RedLED = 11; //Red LED               
const int Ch1 = 5; //rf channel 1
const int Ch2 = 4; //rf channel 2
const int Buzz = 9; //buzzer
int Unlock = 0;
int Lock = 0;
int timer = 0;
boolean UnLcomplete = false;
boolean Lcomplete = false;

void setup()
  deadbolt.attach(3);  // attaches the servo
  pinMode(GreenLED, OUTPUT);
  pinMode(RedLED, OUTPUT);
  pinMode(CWLimit, INPUT);      
  pinMode(CCWLimit, INPUT);
  pinMode(Redbtn, INPUT);
  pinMode(Blackbtn, INPUT);
  pinMode(Ch1, INPUT);
  pinMode(Ch2, INPUT);
  //set LED's and Buzzer to be off by default
  digitalWrite(GreenLED, HIGH);
  digitalWrite(RedLED, HIGH);
  digitalWrite(Buzz, HIGH);

void loop()
  if (digitalRead(Ch1) == HIGH || digitalRead(Redbtn) == LOW){       //If remote or button is pressed
    if(UnLcomplete == false){          //dont run unlock if door is already unlocked 
    Unlock = 1;}}
  if (digitalRead(Ch2) == HIGH || digitalRead(Blackbtn) == LOW){     //If remote or button is pressed
    if(Lcomplete == false){       //dont run lock if door is already locked 
    Lock = 1;}}

  if (Unlock == 1){
    timer = 0;
      while (digitalRead(CWLimit) == LOW){
          if (timer > 1500){
          digitalWrite(Buzz, LOW);
          digitalWrite(Buzz, HIGH);  
  deadbolt.write(1500);  //servo stop
  digitalWrite(RedLED, LOW);
  digitalWrite(GreenLED, HIGH);
  UnLcomplete = true; //unlock complete
  Lcomplete = false; //reset Lock boolean
  digitalWrite(Buzz, LOW);
  digitalWrite(Buzz, HIGH);
  Unlock = 0; //reset

    if (Lock == 1){
      timer = 0;
          while (digitalRead(CCWLimit) == LOW){
              if (timer > 1500){
                  digitalWrite(Buzz, LOW);
                  digitalWrite(Buzz, HIGH);
  digitalWrite(GreenLED, LOW);
  digitalWrite(RedLED, HIGH);
  Lcomplete = true; //lock complete
  UnLcomplete = false; //reset Lock boolean
  digitalWrite(Buzz, LOW);
  digitalWrite(Buzz, HIGH);
  digitalWrite(Buzz, LOW);
  digitalWrite(Buzz, HIGH);
  Lock = 0; //reset

Step 5: FInal Thoughts

Picture of FInal Thoughts

Currently the unit is powered via the USB port using a cell phone charger. There are plans to wire a separate 5 volt supply that does not require the usb cable extending past the door. Although a key can still be used to unlock the door from the outside I am also planning on adding a battery back up in case of power failure.


Julian737 (author)2016-06-23

The link for the RF transmitter and receiver is broken... any chance you have the module specificaitons?

jaikesnake (author)2016-06-14

could you reply with some websites where you got all the parts to make this including the program you used to code the key fob? I know this might be a bit of a nuisance but I'm fairly new to this so it would be really appreciated. :)

simplistik (author)2012-12-31

Nice instructable! Any new update to this i.e. battery back up, new revisions etc.?

rybitski (author)simplistik2013-01-28

unfortunately there are no updates yet. I am currently working on a cruise ship and won't be home until june.

MarkAvenius (author)rybitski2015-09-04

You made a cruise ship with an Arduino? That sounds awesome ;-)

rybitski (author)simplistik2013-01-28

unfortunately there are no updates yet. I am currently working on a cruise ship and won't be home until june.

daflippymaster (author)2015-02-22

Is the servo directly attached to the deadbolt? If so, does this servo have any resistance to manually turning it (like when you use the key to open the door)?

I'm not very familiar with servos. Can you freely turn continuous rotation servos when they are off? I have a standard servo and it is resistant to turning when off.

ramgarden (author)2015-02-06

Do you still work near that plastics place? Can we pay you for shipping to get us some from the trash? Or can we contact them directly?

jester04 (author)2015-01-19

If anyone is looking for cheap components and parts,go on, shipping takes a while but it is worth it in the long run

rybitski (author)2014-11-26

The servo is a parallax continuous rotation servo. Amazon and adafruit both sell them

kevindiffily (author)2014-11-26

Can you provide the specifics of the servo? I'm trying to size one in terms of power and torque for my deadbolt knob.

Ero4820 (author)2014-05-13

Hello, Wich program you use for this project ? :)

nelo_007 (author)2013-04-16

hola amigo me puedes explicar como va conectado todo esque no entiendo hay cosas que no me salen, si pudieras explicarmelo paso a paso te lo agradeceria mucho saludos

nelo_007 (author)2013-04-12

hola amigo me puedes explicar mas a detalle como va conectado todo saludos espero tu respuesta

rybitski (author)2013-04-11

Yes, When the lock is turned manually the locked or unlocked limit will be triggered changing the state.

chillas (author)2013-04-10

This is exactly what I came here looking for.

Quick question - what happens if someone does unlock with a key? Does the system still know what state it is in, locked or unlocked?

jcksparr0w (author)2012-11-14

I'm not too well versed in circuitry but couldn't you use a 9v battery with a 5v regulator on it?

rybitski (author)jcksparr0w2012-11-14

certainly, that isn't the most efficient way to power it, but it would work. I would reserve something like that for a battery back up and power the device from an outlet when possible.

jcksparr0w (author)rybitski2013-03-19

Simply a thought for convienence

The arduino uno, used in this project, is built to run stable on 7-12v, it will run on as low as 5v but may not be able to output the full 5v on the output pins. I can also safely run on as high as 20v but runs the danger of over heating. The arduino has an internal 5v regulator. The reason his works without glitch is because his supply is a constant 5v, a battery can drop below 5v as it runs low and that is why 5v batteries aren't recommended

maniza2204 (author)2013-02-22

hi, can i use other type of RF transmitter and receiver ?

rybitski (author)maniza22042013-02-23

Of course. Depending on the output of the transmitter you may have to change the code or circuit, but any type of rf transmitter and receiver should work.

AT (author)2012-12-06

Nice! Now hook it up to the internet so you get a text every time it is unlocked. ;-)

Is there nothing that can't do with an Arduino! :-D

rybitski (author)AT2013-01-28

check out for a sweet arudino project

Yard Sale Dale (author)2012-12-03

Cool idea. Too bad your landlord won't hire a locksmith or replace the lock. Take it with you when you leave (the whole lock hahahah)

manishrkp (author)2012-11-30


poofrabbit (author)2012-11-27

Hey congratulations on being a finalist in the hack it contest! Good luck to you!

dokcal (author)2012-11-15

I'm assuming the Parallax servo was a "constant rotation" type, right? Otherwise, I don't think you would need the limit switch.

rybitski (author)dokcal2012-11-21

That is correct, I didn't have a standard servo.

dokcal (author)rybitski2012-11-21

Cool. Just wanted to make sure I wasn't missing something!

.A. (author)2012-11-20

This is an absolutely incredible instructable, must say! My arduino is coming in the mail tomorrow and this really inspired me.

rybitski (author).A.2012-11-21

Please post pictures. I am really excited to see how everyone's turns out.

.A. (author)rybitski2012-11-21

Thanks man! so far all I have made is a simple electronic dice... I might make an instructable due to the simplicity of it, but I am still a noob at using arduino :P

My first instructable got featured though! YAY!

KROKKENOSTER (author)2012-11-21

I think that this can be more "safe" than the wireless remotes for the car immobilizers that the Baddies jam with jamming devices to "empty" your vehicle

rybitski (author)KROKKENOSTER2012-11-21

As easy as it is to use a bump key to get into a door I don't think that I run anymore of a risk by having a wireless keyfob. In fact the chances of anyone trying to break into my apartment door the same way they break into a car are very slim. However, you are correct in saying that this isn't the most secure technology. I am just pointing out the fact that my old dead bolt wasn't that secure to begin with.

TJSonOfAnder (author)2012-11-16

This is a great DIY, how much (excluding time/labor of course) did it cost? Just wondering if the price difference between this and lockitron ($179) is worth the time it would take to make it. And the fob vs. app, but I'm sure there are a few simple ways of linking this device, so I could control it from my phone.

rybitski (author)TJSonOfAnder2012-11-16

The arduino is about $30 and the key fob was around $20. All of the other parts I had in stock. If you want to control it from your phone there is a Bluetooth shield that you can get for the arduino. This would involve some custom programming, but it is doable.

ixisuprflyixi (author)2012-11-15

This is great. I want to build one.

megaduty (author)2012-11-15

Like this a lot, voted for you.

agis68 (author)2012-11-15

pretty cool. I love it is excellent project and i will built it


rybitski (author)agis682012-11-15

please post pictures and good luck.

alcurb (author)2012-11-15

Nice project. It's seems simple to make. However, I'm curious how the epoxy piece links up to the deadbolt shaft. You took the knob off then figured out how to mold the piece? How did you make the epoxy form? You have pictures of that process?

rybitski (author)alcurb2012-11-15

I was not able to get any pictures of that process because it was kind of messy, but it is very simple. Epoxy putty is basically sticky playdough that dries in about 7 mins (i had the quickset kind). I formed the little blob of putty on the servo disc and depressed the shaft of the lock into the center of the putty. When it dries it is rock hard and holds its shape. I had to trim the dried putty blob because it was hitting the mouting screws. I used a dremel and a sanding drum to do this.

vanillaface (author)2012-11-12

This is awesome! I've been wanting to do something like this on my door for a long time, but I never thought of using a keyfob!

One suggestion, you might want to look into adding a magnetic door sensor. That way you can make sure the door is closed before you lock it and play an alarm if it isnt.

rybitski (author)vanillaface2012-11-14

good suggestion.

Toasty (author)2012-11-13

Please consider a (mechanical) emergency egress override in case of power or mechanism failure.

rybitski (author)Toasty2012-11-14

That is a concern that I need to address. Luckily there is a front and back door to my apartment tho. Ideally I would like to offset the servo and link it to the shaft via gears which would allow for the manual lever to remain attached.

hot-fresh-rider (author)2012-11-12

nice project. I used the "relay version" of that receiver to add remote start to my motorbike:

kbeharee (author)2012-11-12

Very nice project!

About This Instructable




More by rybitski:LED Light BatonTool Organizer ShelfSteel Rack and Cold Saw Station
Add instructable to: