loading

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

For this project we will need the following:

Electronics:

Parts:

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

Tools:

  • 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

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

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

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

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 (https://ttssh2.osdn.jp/index.html.en)

Step 7: 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

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

#include <Servo.h>

Servo myservo;

int pos = 0;

int state; int flag=0;

void setup()

{

myservo.attach(9);

Serial.begin(9600);

myservo.write(60);

delay(1000); }

void loop()

{

if(Serial.available() > 0)

{

state = Serial.read();

flag=0;

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

if (state == '0')

{

myservo.write(8);

delay(1000);

Serial.println("Door Locked");

}

else if (state == '1')

{

myservo.write(55);

delay(1000);

Serial.println("Door UnLocked");

}

}

Step 10: 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.

Cool ? instruct boss.<br>Story for the disrupts that talk talk talk and not contribute.<br>Privacy ? locks are just that, not for security. Have fun and mess with your friends. Great idea.
My Dad always said...<br>&quot;Locks are to keep honest people out.&quot;
how i m upload the code in the arduino (step 9).<br>and where i m get the arduino board
<p>sir! do you have a black diagram of this?</p>
<p>can you send me sir please !!!!!!! thank you:) macbalbes@gmail.com</p>
????
<p>!!!!</p>
<p>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. <br>It looks like a fun project! But for a real door, it would be cheaper and equivallent security to have no lock at all. </p>
<p>You can change the Adruino program to only open on a 4 digit passcode. Also alter HC06 default paring code making it harder to &quot;pick&quot; this lock.</p>
Rich, though I would not recommended this for any significant security need, I wood disagree that it provides zero security. <br>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<br>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.
<p>i did stress that in the video and tutorial </p>
<p>Have a look at this entertaining presentation: https://media.ccc.de/v/33c3-8019-lockpicking_in_the_iot to avoid of the pittfalls.</p>
<p>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...</p>
<p>Very cool. But put a battery in your project. Energy AC eletric can fault.</p>
<p>One could introduce a usb power bank in the middle </p>
<p>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</p>
<p>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. </p><p>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. </p>
<p>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. </p>
<p>So anyone could get in by shutting off the ac breaker (maybe not a toddler!)</p>
My breakers are all inside my home, so YMMV I suppose.
<p>Great idea!</p>
<p>Nice suggestion. I agree.</p>
<p>+1</p>
<p>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.</p>
<p>They already sell those commercially. Here's one, there are others. http://www.petsmart.com/dog/supplies-and-training/crates-gates-and-containment/dog-doors/petsafe-electronic-smartdoorandtrade-pet-door-6595.html?green=6071C140-DAE7-58B6-B001-981E3D8F863E&amp;src=recommended</p>
nice idea!
<p>Can you explain in the code what the variable &quot;flag&quot; is used for?</p>
<p>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.</p>
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. :)
I agree
<p>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</p>
<p>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</p>
<p>Hello!</p><p>And thank you very much, my friend, for this &quot;chip&quot;! I am responsible for the installation of glass doors in the offices. And now I can be interested in their customers! Sincerely, Serge!</p>
<p>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. </p>
I used a 12v door strike ti give remote release if my door. Its a much cleaner setup than this.
I also made something like this with the same setup (mostly) I can use iPhone with Bluetuino app.
<p>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 :) </p>
<p>An extension of this might allow a pet or robot to go through a locked door.</p>
Nice but your project has no fallback when AC voltage has no energy maybe use emergency battery to unlock when primary fall.
<p>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 &quot;connected&quot; lock sets in the US, starting at $200...</p><p>https://www.build.com/schlage-be469nx-cam/s828834</p><p>...</p>
Awesome

About This Instructable

70,688views

469favorites

License:

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:Emergency Keyring Phone Charger Salvaging Rechargeables for Projects  Portable Light Panel  
Add instructable to: