Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

BLUETOOTH DOOR LOCK

Step 1: Parts list


For this project we will need the following:
Electronics:

 Arduino Nano
 Bluetooth Module
 90-100g Servo
 5v Wall Adapter

Parts:

 Slide Lock
 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.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

 The Red wire is positive and it gets connect


to 5v on the Arduino
 The Brown wire on the servo is ground and it gets connected
to ground 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

Step 4: The App


So to lock and unlock the door we need a device running either android or
windows with bluetooth builtin,. If you're installing on Android you will need to go
to the play store and download and app called Bluetooth Terminal next we
need to connect the hc-05 to our phone 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

Step 5: 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 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");}}

You might also like