Introduction: BT Pattern Door Lock - Android
Traditional Arduino Blue tooth key lock using Pin or password are boring. So its time to use the modern pattern lock for Doors. While this project I learn how to program in APP inventor to create Android Apps. Its very interesting to program for mobile.
Step 1: Materails Required
1) Android Uno - 1No
2) HC-05 Blue tooth module.
3) Tower Pro servo motor.
4) Regulated Power supply.
5) 12V DC Adapter.
6) Plain PCB.
7) Male and Female Header.
8) Manual Door Lock.
9) Screws and nut.
1) Soldering Ion
2) Hot Glue Gun
3) Screw Drivers.
Step 2: Making Shield
1) Making shield for Arduino is the first step.
2) Cut a Plain PCB to the size of the arduino.
3) Insert male Headers over the female headers of the Arduino.
4) Insert the other side of male header to the Plain PCB and Solder it.
5) In HC-05 we need 4 Pins Vcc,Gnd,Txd,Rxd
a) Connect Vcc to 5V of the arduino.
b) Connect Gnd to Gnd of the Arduino
c) Connect Txd to the D2 Pin of the Arduino.
d) Connect Rxd to the D3 Pin of the Arduino
D2 , D3 act as software serial to connect with blue tooth.
6) Connect Servo Data Pin to the D5 of the Arduino and give external Power Supply 5V from regulator power supply.
Step 3: Connecting Servo, HC05 BT and Power
1) With the shield its very easy to fit all the items together.
2) Connect the HC05 to the Female header.
3) Connect the Servo to the D5 Pin to male header (I also take D6 pin out for any other purpose)
4) Connect the 12V Adapter supply to the regulated power supply unit and Arduino supply is taken from regulated power supply Vin terminal. For Servo 5 V power supply also taken from Power supply board.
5) Now all the electronics arrangement are complete.
Step 4: Lock Arrangement
1) Servo is used to control the lock. (If you have electric door lock then simply add a relay to the D5 output pin and give supply to the door lock through relay).
2) Make a link between lock slider and servo as shown in the figure.
3) Now the lock is ready and Controller is ready.
Step 5: Create Android Program
1) Using MIT App Inventor2 we able to create new Android programs.
2) Its very interesting to program in Android.
3) App inventor 2 click the link and sign in using gmail User name and password
4) Create a new project name and design using block.
5) After complete the project create a apk file using Build menu.
6) Download the apk file to your PC. Lot of ways to test the program while designing in pc eluminator or in mobile.
1) In the program i use canvas to draw dots and when dragged over canvas i find the position and link the dots. While link the dots i also join the strings where it pass.
2) Then with the bluetooth i send the code to the arduino and arduino process the password and tell the result.
3) So the code saved in arduino.
4) Like wise at every action communication between arduino and android carried out and result display in message area.
Step 6: Android App
If you cant able to develop the program you simply download the apk file for android from here.
Step 7: Install Program on Arduino
1) Copy the downloaded apk file to the phone internal or SD card.
2) Click the icon pattern lock. It ask a screen do you want to install.
3) Click install and it take few seconds to install.
4) App installed message display on the screen.
5) You open the app from there of go to home screen and see the app there.
Step 8: Arduino Program
1) Here is the arduino program used to control the lock. Simply download the app and upload to arduino.
1) Use EEPROM to save the Password and status of the door.
2) Password must be more than 2 and less than 10.
3) Every message receive from android is start with '&' and end with '$'. Check this character to split the commands.
4) After process the command send the result to the arduino through Software serial port D2,D3.
5) When door open or close send the correspondence signal to servo through pin D5.
Step 9: Running in Android
Now all the circuits and servos are fitted. Want to test the program.
1) Switch on the Arduino board first using power supply.
2) In the Android phone open the Bluetooth.
3) If the arduino bluetooth is not paired, Pair it by give the default pass word 1234. (You can also configure HC-05 to chage name and pin)
4) Now open the Pattern Lock app in your mobile.
5) Click the Pick BT on the Top left corner of the app.
6) It listed the available Bluetooth's.
7) Click the HC-05 in your list. When it connected with the arduino, Arduino send back a Message "Welcome Home" and BT connection status "Connected".
8) But Open, Close, Change buttons Still not Visible.
9) Now draw the password pattern in the mobile.
If it correct then it shows "Correct password".
If it less than 3 or greater than 9 it shows "Invalid Password.
if it not equal to saved password in arduino it shows "Wrong password".
10) Once the correct Pattern draw, in the bottom of the screen 3 buttons visible
Open to open the Door
Close to close the Door
Change to change the pattern
11) After open or close use the mobile back button to close the program.
Step 10: Change Pattern
1) Once you enter with correct pattern and buttons show in the buttom of the screen.
2) Click the Change button to change pattern.
3) The message ask to draw old pattern. If the old pattern is correct it ags to draw new pattern.
4) Once the new pattern is draw it display Pattern change.
5) When old pattern draw is wrong, the display hidden the buttons and ask to login again using old pattern.
Step 11: Enclose the Circuit
1) All the Testings are ok and it works fine, So its time to Box it and fit on the door.
2) I got a box perfect for the board and Power supply.
3) I fitted the Arduino with shield on the buttom side of the box and fit the Power supply on the side of the box.
4) Close the box and let the wire of the servo and Adaptor go through the side of the box.
Step 12: Fix It in Door
Fix the lock on the door of my room and fix the box on the side of the lock and connect the 12V adaptor to the power supply. All are ready Now its time to use it.
Step 13: Working
Check it multiple times and change the pattern many times and found it works perfectly. Watch the video and if you satisfy encourage and if you have any doubt comment me.
Studying new things is really fun. In this project i study how to build app using App inventor.
Hearty thanks to all who view and encourage me and my followers.
We have a be nice policy.
Please be positive and constructive.