Sunday, July 24, 2016

Filled Under: , , , , , , , , ,

Android Based Bluetooth Controll Password Protected Smart Door Lock

App Inventor Arduino UNO R3 bluetooth bluetooth module door lock Hard hc-05 L239D motor driver project




We everybody are concerned about the security of our home. World becoming smarter and smarter everyday and we want to control and secured our thing in smarter way. In this tutorial I will explain how to made a arduino based DIY smart lock which can be open and closed using password sent from android smartphone by using Bluetooth.

This smart Lock is the secure, simple, and easy to manage your home’s lock. This lock needs no keys and the lock is attached inside the door and you can control it from outside the door. As the lock is inside the door there is no way to break the door by thief.

You can find some smartphone control lock which required to replace you entire lock system but in my tutorial I will made the thing using your traditional old lock.

This project is based on the android application, android application send password through Bluetooth. An android application is required to open and close the lock and I will explain the details of android app development in the later part of the tutorial. If password is matched to your preset-lock password then lock will be open and sent a feedback to your phone.



Step 1: What You Need?

1 x Laser Movementing Tray From Old  CD / DVD ROM
1 x Motor Driver IC (L293D) 
1 x Electrolytic Capacitor (0.33uF)
1 x Door Lock 
1 x Android Phone 
1 x Power Supply


Optional
6 x Screws 
1 x L293D DC Motor Driver Shield
1 x Screw Driver
Soldering Iron & Solder (if you want to use PCB instead of Breadboard)
Hot Glue Gun


Don't have components? Don't worry. Just click the component's name. 








Step 2: Build Your Circuit.



Circuit connection for our smart door lock is not so complex. Enable, IN1 and IN2 of motor driver IC is connected to the arduino 9, 10 and 11 pin. Out1 and Out2 of motor driver is connected to the DC motor of leaser movement mechanism. L293D has two input voltage, one for IC itself and another for motor voltage. I have connected 5V to both pin, our motor will run well in 5V. This driver has 4 ground pin, and all are connected to ground. Heat sink is not required here. A 5V regulator IC (LM7805) is used here and its input is connected to the output of an AC adapter. A 7.5V to 12V AC to DC adapter will work fine. The output of the adapter is directly connected to arduino VIN pin because arduino board has an internal voltage regulator.

TX pin of HC-05 is connected to arduino RX pin, and RX pin of HC-05 is connected to arduino TX pin. This may be a bit confusing but the fact is that, the data transmitted by HC-05 is received by arduino ( HC-05 TX to arduino RX), and the data transmitted from arduino is received by HC-05 (arduino TX to HC-05 RX).





Step 3: Upload Code To Board.

The code for bluetooth control smart door lock is very simple. I have designed android application in such that it sent a command with the password. Actually I set two command, one is "OPEN=" and another is "CLOSE=" and password may contain any digit, later or symbol or combination of them as you like. In the app I used two buttons one for open the door and another for closing the door. When password is given to password box and open button is clicked than app joint the "OPEN=" command with the password and sent it to arduino. I add '=' sign with command for that I will separate command and password by using this '=' . After receiving the string from phone arduino program separates command and password from the receive string and save them into two separate variables. Then check the password first, if password matched with saved password then open the door for "OPEN" command, and close the door for "CLOSE" command. "=" helps to separate command and password.Complete arduino sketch is given below.

If arduino received wrong password then it sent a message to the android phone that the password is wrong. Actually arduino sent " WRONG" string. Android program then shows wrong password message.


Step 4: Setup & Working of Bluetooth Control Smart Password Protected Door Lock 



Set laser movement mechanism and breadboard to your door using hot glue gun shown above figure. Be sure, two shaft (lock and laser movement) must be in parallel. After setting these in correct position power up using wall mount adapter. LED of bluetooth module should continuously blinking. Run your android app (check step 7 & 8) and pair this with you phone using pair button if not paired previously. For the first time it will ask you for a code, use 1234 and than OK. Now connect it with your device with connect button. After connecting, enter password set to your arduino program (I set "arduPi", you can use your own) to the password box and click close the door button. Door will be closed successfully. Again enter password and open the door. Door open? If yes, than congratulation! you have successfully complete your project.

Step 5: Android App Development For Password Protected Door Lock 

I will show you how to develop an Bluetooth android application using MIT App Inventor. I am using App Inventor because it does't required any coding and no software installation. You only need a google account. Go tohttp://ai2.appinventor.mit.edu/, you will ask to log in using google account.

Log in to App Inventor using gmail and follow the steps below.

iAccept terms & conditionsimage 1
iiClick 'take survey later' and then 'continue' to dismiss the splash screenimage 2, 3
iiiStart a new project (no spaces!)image 4
ivName the project "BluetoothControlDoorLock" (no spaces!)image 5

 

You are now in the Designer, where you lay out the "user interface" of your app (image 6). The Designer Window is where you lay out look and feel of your app, and specify what functionalities it should have. You choose things for the user interface things like Buttons, Image, Label, Text boxes, and functionalities like Text-to-Speech, Bluetooth, Sensors, and GPS.


Now, follow the figure 7 and add a List Picker to the viewer. 


Rename it to "Connect to Bluetooth Device" (image 8). 


Add one Label, one Password Text Box, and two buttons. Change the text properties of the components as "Enter Password", "Open Door", and "Close Door" respectively. Final User Interface should look like. Now add a Bluetooth Client to the viewer. It is an invisible component and it has no UI. 

Switch over to the Blocks Editor


It's time to tell your app what to do! Click "Blocks" to move over to the Blocks Editor (image 13). Think of the Designer and Blocks buttons like tabs- you use them to move back and forth between the two areas of App Inventor. The Blocks Editor is where you program the behavior of your app. There are Built-in block that handle things like math, logic, and text. Below that are the blocks that go with each of the components in your app. In order to get the blocks for a certain component to show up in the Blocks Editor, you first have to add that component to your app through the Designer.



Let us, design blocks for List Picker. List Picker is a UI element when clicked it shows a list of corresponding elements here is the paired Bluetooth device. We have to add two blocks ListPicker. BeforePicking and ListPicker. AfterPicking. Complete Blocks are shown in figure 18 & 19.



Make apk file


Our design is complete, now we need to build the apk file for our android phone. Click to build menu and select "App(save .apk to my computer)". Wait for a minute. An apk file will download to your default download folder. Install and use it.



Step 6: A More Feature Rich Android App 

In previous step I have showed you how to develop a basic bluetooth app in App Inventor. But that app is not so user friendly. It will not show you any message either your door is open or closed or bluetooth can not connected for any error. I have attached here a more advanced app for our project.

When you run you app this app check either your bluetooth radio is enable or not, if not enable a bluetooth enabling dialog will appear. Click yes to turn on your bluetooth radio. Then pair the device using pair device button. Then click to connect button, if successfully connected to any device the application shows the connected device's MAC address and name. Enter password to the password box then click the open door button, if you entered correct password door will be open and application will show you a message that your door is now open. Then enter password again if you want to close the door. If you give the wrong password, then app will show wrong password message.



Complete App Inventor source file (BTcontrol.aia) is attached herewith. If you did not like to make your own app or modify it, just download the BTcontrol.apk and install it to your android pone.




You can also download it from Google Play Store using the link:

https://play.google.com/store/apps/details?id=appinventor.ai_khairul_uapstu.BTcontrol&hl=en

For modifying the source click the "Projects" menu and select "Import project (.aia) from my computer" shown in figure 24 and browse the BTcontrol.aia file from your computer. After importing you can modify it easily.

Unknown

Author & Editor

My Robot Education Sdn. Bhd. (Robotedu.my) was founded in 2015 as the first robotics education centre in Malaysia to provide Arduino-based robotics courses for youths. Our vision is to be able to provide robotics education to every youth in Malaysia.

5 comments:

  1. Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. Schlage Connect vs Sense

    ReplyDelete
  2. This is important in a security purpose. Thanks a lot for sharing this with us. One must have a proper knowledge about system before implementing any such controllers. Locksmith Kings Langley team is one of the top emergency locksmith services provider.

    ReplyDelete
  3. I was surfing the Internet for information and came across your blog. I am impressed by the information you have on this blog. It shows how well you understand this subject. schlüsselnotdienst München

    ReplyDelete
  4. RF wireless mice generally cost less than $50 and there are even some which are available for $25. Wireless mice are light and so they are portable. This also allows users to be able to stay far away from the PC, laptop or notebooks and still work with his mouse. This is a great help for people who do presentations. Rechargeable mouse

    ReplyDelete
  5. Wenn jemand in eine Aussperrungssituation gerät, beispielsweise wenn er seinen Schlüssel verlegt oder ihn versehentlich in einem Auto oder einer Immobilie einschließt, kann der Schlüsselnotdienst München für schnelle Hilfe kontaktiert werden. Ihre ausgebildeten Schlosser verfügen über die notwendigen Werkzeuge und Fachkenntnisse für den Umgang mit verschiedenen Arten von Schlössern und Sicherheitssystemen. klicken Sie hier https://keypoyntmoosach.de/

    ReplyDelete

 

  • Copyright © Arduino Tutorial ™ is a registered trademark.
    Designed by Templateism. Hosted on Blogger Templates.