Instructables

Easy Bluetooth Enabled Door Lock With Arduino + Android

FeaturedContest Winner
Picture of Easy Bluetooth Enabled Door Lock With Arduino + Android
Thanks to everyone who supported this project and voted for it in the Arduino Challenge! I was awarded second prize and hope to participate in more Arduino contests in the near future.

This tutorial will explain a simple way to make a password protected bluetooth door lock using your Arduino, which can be unlocked by sending a four digit pin from your Android phone!  The hardware setup is quite simple,  and the programming side of it is a bit tricky, but should be no problem for any Arduino ameuture.

 
Remove these adsRemove these ads by Signing Up

Step 1: Parts Needed

Picture of Parts Needed
1. Arduino (I am using the Duemilanove)

2. Electric Door Strike

3. Bluetooth Module ($9.99)

4. Power Supply (Required voltage and amperage differs among different door strikes/locks)

5. TIP120 Transistor

6. 1N4001 Diode

7. Hookup Wire

8. Solderless Breadboard

9. An Android phone (optional, considering that there are lots of devices you could use to send serial data to our bluetooth modem including Iphones, computers, and other Bluetooth devices)

Step 2: About The Transistor

Picture of About The Transistor
We'll start by focusing on one of the main components of the circuit, the transistor. Our transistor will allow us to control a device that requires more current than our Arduino can supply, by sending the transistor different values. The type of transistor we are using (the TIP120) has a base, collector, and an emitter which are labeled here. We will send the signal from pin 9 on the Arduino to the base of the transistor, and depending on the value sent, current will increase or decrease.

Step 3: Assemble The Circuit

The diagram shows how the transistor is wired up in our circuit. As you can see, we have a diode pointed away from ground that is connected to the collector of the transistor as well as the ground of the lock itself. This diode will protect our electronics from any back voltage that might be created when our lock is turned off. At this point you could set pin 9 to high or low to control the lock.
1-40 of 99Next »
skalra213 days ago
instead of using direct power supply for lock, can i take it via Vin pin of arduino uno, my solenoid lock requires 12v dc and 0.6A for its operation.
oh_mali made it!1 month ago

Hi, here are some pictures and personal notes from my finished version of this project!

1) Make sure that you buy the CZ-HC-05 Bluetooth module as well. Some people will advertise the carrier board & the Bluetooth and sell only the carrier board (part label JY-MCU) without the actual Bluetooth module (CZ-HC-05) soldered onto it.

2) I also found a helpful link (HERE: http://www.instructables.com/id/Modify-The-HC-05-Bluetooth-Module-Defaults-Using-A/?ALLSTEPS) on how to reset mostly anything you need via AT Commands through the KEY pin on the Bluetooth.

3) Instead of an electric door strike, I used a door lock made active/inactive by a solenoid that works on 12V (because it was much cheaper at $20 rather than $100+!!)

4) I used the Arduino Uno board instead and it works just the same.

5) If the Bluetooth SPP app you're using counts the /r as another byte, you'll have to change the first for condition in the void looping section from 4 to 5. ( for(int i=0, i<5, i++) )

GOOD LUCK!

code.jpgdoorlock.jpgpw.jpg
oh_mali11 month ago

Can you post a parts list detailing your vendors and part #s?

Thanks!

randersen610 months ago
How do you open the door during a power outage ?

The lock he used in this example is unlocked without power. For a house door I would choose one that is locked without power and add a 12-volt battery backup system to operate the lock during power outages. A 12-volt car battery, or even a lawn mower battery, would provide a lot of backup and could power both the Arduino and lock for extended periods. An automatic battery charger would keep the battery ready to go.

maangas.ako1 month ago

is there any tutorial on how to use the Bluetooth SPP application

GuoxuanN1 month ago

hello. May I know the code of the electric door strike?

rhevierose2 months ago

Hello. What programming language did you use? or where did you encoded these code? It's cool. I hope you'll reply.Thank you :)

aand, what if i there's no transistor? really thank youu

ManuelL2 months ago

hey hello can i replace the electric door strike with a solenoid?

will it work as the same?

Collin Amedee (author)  ManuelL2 months ago
If it works off of 12 volts and a ground then yes, a solenoid would be interchangeable with the strike in this circuit!
Yes my solenoid works with 12v and gnd , thanks for the reply!
anyone has the idea on how to modify this project so that the door lock/ relay should be activated once the bluetooth connection is paired between the phone and the module. and when unpaired(out of range), the relay should deactivated.

the system should work without any commands need to be send(in the project above we must send 'ABCD' to activate the relay) from the phone.

hope you can help me by giving some solution. much appreciated your help..

I'd really like to know how to do this as well.

jackbell166 months ago

Hi,

thank you for your project. It is a very cool one ! As I can understand, to open the door in the Arduino Code, you open and close a Relay. is it correct ?

imr37 months ago

QR code scan version of arduino door lock.

https://www.youtube.com/watch?v=gubRBe60_Go

leizo287 months ago

does anyone knows any app for iphone to do that? thank you

tiongson9 months ago

where is the connections of the electric door strike ???????

hi collin...its a great project..How did you code arduino? What program you used and what code, can you please help me with that? and Could you please upload a circuit diagram ? thank you.
varun1316811 months ago
How did you code arduino? What program you used and what code, can you please help me with that?
code for bluetooth module*
Great project. Could you please upload a circuit diagram so I can clearly see how to connect everything? Or a few close ups of how it's all connected to the breadboard.
bioana11 year ago
Hello. I tried to make this project but I have a problem with phone, he did't find the module of Bluetooth. My phone is samsung GT-S5610 and the module of Bluetooth is BT_BOARD V1.2pro. I dont know what is the problem. Please help me.Thank you.
Great project! Would you be able to upload a circuit diagram so that I can clearly see how its all connected?
Geniusdude2 years ago
What if you wanted to leave the door normally locked, then when you send the serial data unlock, and then stay that way until you send the data/passcode again at which point it would unlock? I cannot seem to figure out how the code would be modified for the life of me.
It does seem that this only unlocks it, and then leaves it unlocked forever until the Arduino is reset.

Add this line:
digitalWrite(lock, HIGH);
just before the line
Serial.println("Locked");

Then it should unlock for 5 seconds and then lock again.
omaryeye1 year ago
bro my project is door access system using Bluetooth and a biometric scanner do you know a way how can I connect this project to a biometric scanner
It should be pretty easy to attach a fingerprint scanner to this... something like https://www.sparkfun.com/products/11792. There should be plenty of pins left over on the Arduino.
JoshHawley1 year ago
shouldnt the diode be across the coil in reverse? like this:http://www.azatrax.com/image/CoilDiode.png

JoshHawley1 year ago
what brand/model of door strike is that? did you mount it in a wooden door?
hi collin! can i also have some clear copy of the wiring?
what module did you used?
Quantiera1 year ago
Hi,

I am using Arduino UNO, in this case is there any difference on the command line and I am using Arduino 1.5.2 to upload the command. Please give me more detail on this project.
danica171 year ago
what are those grounds? ground of power supply?
dmendoza121 year ago
What is the difference if you set PIN 9 to LOW or HIGH?
tolstoyan1 year ago
hi i started to build your project but i am having trouble with the wiring of the circuit, can you please send me a clear connection of the schematic diagram because i am confused on how you power the arduino and how the 12v is connected. when i tried to use the instruction above the electric door strike is keep on unlock. i am a beginner so i hope you can understand. my name is Louie from the Philippines. i hope you will respond. thank you
drmpf1 year ago
Nice Instructable Collin

Can I suggest my pfodApp ( www.pfod.com.au ) as an alternative Android App

Using pfodApp allows you to customize the mobile's display to present the user with a named button.

No Andriod programming is required, just a simple text message from the Arduino.

www.pfod.com.au has example code for a Garage Door opener which can be easily reused to drive the lock, by changing the "Garage Door" text in the Arduino code to "Front Door Lock"

Collin if you would like to contact me, we could talk about a non-english (UTF8) version of pfodApp.
stormdead2 years ago
I want to make this device but... i want a button activate the lock....

I'm using a 9v battery instead of a power supply


Is this ok?....:

int buttonPin = 2;
int ledPin = 13;
int lock = 9; //pin 9 on Arduino
int buttonState = 0;


void setup() {
pinMode(lock, OUTPUT);
pinMode(buttonPin, INPUT);
digitalWrite(lock, HIGH);
pinMode(ledPin, OUTPUT);
}

void loop(){
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
digitalWrite(ledPin, HIGH);
digitalWrite(lock, LOW);
delay(5000);
}
else {
digitalWrite(ledPin, LOW);
digitalWrite(lock, HIGH);
}
delay(500);
}
stormdead2 years ago
Hi!... Where is connected the GND of the Power SUpply?
rickharris2 years ago
As always with this type of project what happens when the power supply fails how do you get in/out e.g in the case of a fire?

The program should give an audible signal to show code received otherwise you get multiple presses as users have no feedback.

Likewise you could offer audible feedback that the lock is open.
What happens if the power fails whilst the lock is open, there isn't anyway to re-lock it unless the mechanism has a mechanical default of closed.


This is the type of door latch often used on apartment buildings - it defaults to locked, except when energized, and has an audible click when it opens. It also still allows use of the key / knob, as usual.
1-40 of 99Next »