Introduction: Bluetooth Door Lock (Arduino)

Picture of Bluetooth Door Lock (Arduino)

Recently I rewatched the Amazing SpiderMan, in one scene Peter Parker locks and unlocks his door from his desk using a remote. When I saw this I instantly wanted my own for my door. After a bit of tinkering I got a working model. Heres how I made it

Step 1: Parts List

Picture of Parts List

For this project we will need the following:



  • Slide Lock (Get it here)
  • Six screws for the slide lock
  • Cardboard
  • Wire


  • Soldering Iron
  • Glue Gun
  • Drill
  • Drill Head
  • Drill Head for pilot hole
  • Box Cutter
  • Computer with arduino IDE

Step 2: How It Works

The idea is that I can easily lock and unlock my door without having to carry a key or even go near it :D but this is only a fraction of what we can do. From here we could add a sensor like a knock sensor so we can unlock our door with a special knock or even a voice recognition system!

The servo arm will be connected to the slider lock and will move to 0 degrees to lock the door and 60 degrees to unlock it using commands it gets from out Bluetooth device.

Step 3: Wiring Diagram

Picture of Wiring Diagram

Lets start by wiring the servo to the Arduino (I would like to note that even though i'm using the Arduino nano the Arduino uno will work just as well with the exact same pin layout)

  • The Brown wire on the servo is ground and it gets connected to ground on the Arduino
  • The Red wire is positive and it gets connect to 5v on the Arduino
  • The Orange wire is the servos source connection and it gets connected to pin 9 on the Arduino

Now I would recommend testing the servo before moving on, you can do this by going to examples in the Arduino IDE and selecting sweep. When we are sure that the servo works we can add the bluetooth module. We will connect the rx pin on the bluetooth module to the tx pin on the Arduino and the tx pin on the bluetooth module to the rx pin on the Arduino But don't do this yet! while these connections are made nothing can be uploaded to the Arduino so make sure you upload the code before soldering.
With this in mind this is how we wire the bluetooth module to the Arduino

  • Rx pin on the bluetooth module connects to the Tx pin on the Arduino
  • Tx pin on the bluetooth module connects to the Rx pin on the Arduino
  • Vcc (positive) on the bluetooth module connects the 3.3v on the Arduino
  • Ground goes to Ground

If any of this was confusing please follow the wires on the picture provided

Step 4: Testing

Picture of Testing

Now that we have all the parts together lets make sure the servo is strong enough to push and pull the locking mechanism without a problem before I started designing the final concept I built a mock up just to make sure my servo was strong enough, at first mine wasn't so I added a tiny bit of oil on the sliding mechanism which helped everything move smoothly. Its really crucial that everything moves smoothly or there is a chance you'll get locked on or out of your room! :D

Step 5: Electronics Casing

Picture of Electronics Casing

I decided to leave my servo "exposed" and to only build a small cardboard case to protect the arduino nano and Bluetooth module. We can build this by tracing the around the arduino nano onto a peice of cardboard and add about 1 cm (0,39 inch) of space onto each side now we have to cut out the other 5 sides of the rectangular cube. We also have to cut a hole on one of the faces for the power cord to connect to the arduino.

The measurements for the case are:

  • Bottom piece = 7.5cm by 4cm (2.95 by 1.57 inch)
  • Top piece = 7.5cm by 4cm (2.95 by 1.57 inch)
  • left piece = 7.5 cm by 4cm (2.95 by 1.57 inch)
  • Right piece = 7.5 cm by 4cm (2.95 by 1.57 inch)
  • Front face = 4cm by 4cm (1.57 by 1.57 inch) (cut power hole in this one)
  • Back face = 4cm by 4cm (1.57 by 1.57 inch)

Step 6: The App

Picture of The App

So to lock and unlock the door we need a device running either android or windows with bluetooth builtin, Mac users i wasnt able to get this working on an iphone or a macbook pro I think there might be some driver issues but im sure one of you can figure it out :D. If you're installing on Android you will need to go to the play store and download and app called Bluetooth Terminal and for windows its called TeraTerm next we need to connect the hc-05 to our phone it should be called linvor and the password will be either 0000 or 1234. Once its paired open the app we just installed, click on options and tap connect to device (insecure) now our phone is basically simulating the arduino serial monitor which means we can see and send information coming from the arduino.

If you type 0 and press enter you should see the door lock and see the message "door locked"

and when you type 1 and press enter you should see the door unlock and see the message "door unlocked"

The process is basically the exact same on windows except you need to download an application called Tera Term and you can find the download link here (

Step 7: Mounting the Lock

Picture of Mounting the Lock

First things first we need to mount the servo on the sliding lock we do this by cutting off the edge of the servo mounting holes so that when we lay the servo down it will be flush with the lock next we put the servo arm into the lock hole where the handle used to be and test that everything moves correctly if so glue it down.

Now we need to start drilling pilot holes in the door for the screws, place the sliding lock againts the door and use a pencil to trace where the holes are now drill the pilot holes where you made the traces drill them to the depth of about 2.5 cm now place the the lock againts the door and screw in the screws onces its secure make sure the system still works

Step 8: Power Supply

Picture of Power Supply

To make sure we can leave this we are going to need a power supply, the cable and usb mini plug to connect to the arduino.

Connect the ground connection on the power supply to the ground connection on the usb mini port and connect the red cable to the red cable on the usb mini port now lead the cable from the lock to one of the door hinges and from there lead it to a power outlet

Step 9: The Code

Picture of The Code

#include <Servo.h>

Servo myservo;

int pos = 0;

int state; int flag=0;

void setup()





delay(1000); }

void loop()


if(Serial.available() > 0)


state =;


} // if the state is '0' the DC motor will turn off

if (state == '0')




Serial.println("Door Locked");


else if (state == '1')




Serial.println("Door UnLocked");



Step 10: Finished!

Picture of Finished!

Enjoy your bluetooth controlled door lock, dont forget to mess with your friends by locking them out of your room!

Thanks for reading if you have any questions please feel free to pm me or leave the question in the comments.


SUKUMART (author)2017-11-06

my mail id

SUKUMART (author)2017-11-06

sir can you send me the pdf please.Thank you

nazmiazahari69 (author)2017-08-29

Im building my own apps. How can i connect to the board? Im using the button option instead not using the '1' and '0' option.

PastorJohn (author)2017-03-26

Cool ? instruct boss.
Story for the disrupts that talk talk talk and not contribute.
Privacy ? locks are just that, not for security. Have fun and mess with your friends. Great idea.

PastorJohn (author)PastorJohn2017-03-26

My Dad always said...
"Locks are to keep honest people out."

akhlak malik (author)2017-02-16

how i m upload the code in the arduino (step 9).
and where i m get the arduino board

MacB19 (author)2017-01-25

sir! do you have a black diagram of this?

MacB19 (author)MacB192017-01-25

can you send me sir please !!!!!!! thank you:)

mijael.romero (author)2017-01-18


rich.altmaier (author)2017-01-15

Please be aware there is no security in this solution, in that any random person can walk up, pair, and open the door. So you can consider this lock the equivalent of no lock at all.
It looks like a fun project! But for a real door, it would be cheaper and equivallent security to have no lock at all.

rjmah (author)rich.altmaier2017-01-18

You can change the Adruino program to only open on a 4 digit passcode. Also alter HC06 default paring code making it harder to "pick" this lock.

Rich, though I would not recommended this for any significant security need, I wood disagree that it provides zero security.
First, I will make the statement that the method of engaging and disengaging the lock is security by obscurity which is unreliable but you are evaluating this from the standpoint of someone who has seen the other side of the door and has entire knowledge of the project. Looking at it from the standpoint of someone who walks up to the door and finds it locked, it is a deterrent so much as they aren't willing to kick the door in. That person would also most likely not know how to overcome the automation in a stealthy manner. It
is probably great for siblings or minorly annoying roommates as it stands. However, it would, without a doubt, need a significant upgrade to manage external security.

i did stress that in the video and tutorial

wimton (author)2017-01-17

Have a look at this entertaining presentation: to avoid of the pittfalls.

KDMChiTown (author)2017-01-16

As noted below, the lock provides limited security for an external door, but I could see an application on a kitchen cabinet to keep your snacks/food secure from a hungry roommate...

batmat (author)2017-01-15

Very cool. But put a battery in your project. Energy AC eletric can fault.

Eliyahu IlyaL (author)batmat2017-01-15

One could introduce a usb power bank in the middle

i wouldn't add a power bank by itself because i would to afraid of it dying while the door is locked but adding one with a wall power supply is very smart for when the power goes down

Not sure I understand you here. Wall power is out when the power is out, but if you mean running the wall power through a power bank that then flows to the device, like a gerryrigged ups, it's gonna kill the battery, make it super hot, and lend itself to power browning.

As an alternative for the concern of being locked out during a power outage, you could use some tension on the lock hardware so that the unpowered state is always unlocked.

kbouchard1 (author)Lashway2017-01-16

Would not work to put a spring on the lock to unlock when off. Reason the servo is designed to stay in position, gears inside would not permit it to move. So it needs to actually move to unlock and move to lock. Battery backup, will work fine, use 3 1.5v batteries will be a bit low 4.6 volts, but then put a 1A diode from the battery pack, to block adaptor ability to charge the batteries, thus prevent them to explode. When on AC it will never drain them. However it still does not unlock the door. My other concern with the entire project, is if the door ever shifted due to hot/cold and the lock got stuck, then well. So how about using a spdt relay in place of the servo, that operates a solenoid to lock and unlock the door. Also I have to conclude that the cost of the arduino and bluetooth module factor in may outweigh the cost of the whole project.

allmonc (author)Lashway2017-01-15

So anyone could get in by shutting off the ac breaker (maybe not a toddler!)

Lashway (author)allmonc2017-01-16

My breakers are all inside my home, so YMMV I suppose.

Great idea!

ShantnuA (author)batmat2017-01-15

Nice suggestion. I agree.

Yonatan24 (author)batmat2017-01-15


EricP5 (author)2017-01-15

There's an idea! An RFID tag on a pet collar that unlocks a pet door keeping out racoons and other uninvited wildlife. I always wanted a pet door but not encounters with hissing angry mammals in my kitchen.

JohnH542 (author)EricP52017-01-16

They already sell those commercially. Here's one, there are others.

nice idea!

RichardT161 (author)2017-01-16

Can you explain in the code what the variable "flag" is used for?

JimI8 (author)2017-01-15

This is very instructive and much can be learned from this project. BUT, I hope no one thinks this lock is of any value. This lock would not stop a determined toddler. To make this project more useful, a much better lock needs to be used.

instructible01 (author)JimI82017-01-15

I would disagree. This is fine for a toddler so long as its placed out of reach. The brass lock and standard screws are fine. :)

KevinM183 (author)JimI82017-01-15

I agree

I agree but the project was only to keep people out of my room when im away it isnt supposted to be any sort of secruity lock

manniesm (author)JimI82017-01-15

Reverse the setup by mounting the lock on the jamb with long screws. Then attach a plate with matching hole for the bolt (some slide bolts come with a transverse plate) on the edge of the door, The intruder would have to shear the screws in the door

Serg3000 (author)2017-01-15


And thank you very much, my friend, for this "chip"! I am responsible for the installation of glass doors in the offices. And now I can be interested in their customers! Sincerely, Serge!

Lashway (author)Serg30002017-01-15

So not use this in an enterprise environment. The author explicitly makes a point that this lacks any resemblance to security, it's just an interesting experiment.

JohnL78 (author)2017-01-15

I used a 12v door strike ti give remote release if my door. Its a much cleaner setup than this.

RyanP197 (author)2017-01-15

I also made something like this with the same setup (mostly) I can use iPhone with Bluetuino app.

ed.darby (author)2017-01-15

Nicely done :) and I in no way mean to criticise but after years of soldering terribly myself, I found an instructable on how to do through hole soldering (I see you have a decent soldering iron in the video!! ;) ) it makes all the difference to one's projects :)

SherpaDoug (author)2017-01-15

An extension of this might allow a pet or robot to go through a locked door.

KevinM183 (author)2017-01-15

Nice but your project has no fallback when AC voltage has no energy maybe use emergency battery to unlock when primary fall.

farna (author)2017-01-15

There are problems with this, one being if power fails you can't get in. Batteries die also. There are several makes of push-button combination door locks that run on batteries. A really cool idea would be to attach the Arduino controller to one of those. Even if you had to by-pass the keyboard (use bluetooth smart phone to get in) it would be a neat project. Should be able to simply bypass the keyboard lock and activate the bolt remotely though, at least on the dead-bolt versions. These locks have a keyed entry option also, so you're never locked out (or in without taking the lock apart). Of course Schlage and Kwikset both make bluetooth accessible "connected" lock sets in the US, starting at $200...


Shahid Khattak (author)2017-01-10


About This Instructable




Bio: I'm a 18-year-old high school student, I love engineering, film production, design and everything in between.
More by electronics for everyone:Voice Activated Arduino BlindsRaspberry Pi and Arduino LaptopArduino Controlled USB Trackpad
Add instructable to: