Introduction: Arduino Bluetooth Door Lock

Didn't think your house was safe enough or you wanted making to make you life a lot easier no not carry keys around, this is your solution. This project is very simple to do and does not take many parts. The hardest thing to was was to put this into a real model. I didn't put this into a real door but did show how it works from a scaled down version.

Step 1: Parts

For this project, we will need:

  1. Arduino Uno
  2. Breadboard
  3. A servo
  4. Bluetooth Module
  5. An Android Phone
  6. Wire
  7. Buzzer
  8. Red and Green LEDs
  9. Buzzer
  10. Wire Cutters
  11. Slide Lock and Screws
  12. Power Supply
  13. Drill

Step 2: Wiring and Testing

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 connect the Bluetooth module anywhere on the breadboard.

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

+5v on the bluetooth module connects the 5v on the Arduino

Ground goes to Ground

Step 3: 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(0);

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(0);

delay(1000);

Serial.println("Door Locked");

}

else if (state == '1')

{

myservo.write(150);

delay(1000);

Serial.println("Door UnLocked");

}

}

Step 4: The App

So this app is one of the most simplest apps you can get. The App Is called Bluetooth Terminal HC-05. Once you downloaded that app on you android device only, You will have to pair your bluetooth module with you bluetooth on your phone. If it asks for a password, try 0000 or 1234. Either will work. Once you have done that, You can open the app and it will come to a page with black square and text input box at the bottom. Once you are connected with the Bluetooth Module, you now may input a 0 or a 1 in the input text area in the bottom. 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". As you can see in the bottom of my screen, I have added buttons so i dont need to type 0 and 1 all the time. Once you have completed this step, You can start to put it into your door.

Microcontroller Contest 2017

Participated in the
Microcontroller Contest 2017