loading

Arduino & Android Based Bluetooth Controll Password Protected Smart Door Lock (Save Your Home)

by:DIgao     2020-06-29
Each of us cares about the safety of our home.
The world is getting smarter every day and we want to control and protect our things in a smarter way.
In this tutorial, I will explain how to make an arduino-based DIY smart lock that can be turned on and off using a password sent from an android smartphone using Bluetooth.
This smart lock is a safe, simple and easy to manage home lock.
The lock does not require a key, the lock is attached to the door and you can control it from the door.
The thief could not break into the door because it was locked in the door.
You can find some smartphone control locks that need to replace your entire lock system, but in my tutorial I will use your traditional old locks to make this thing.
This project is based on the android app, which sends the password via Bluetooth.
Opening and closing the lock requires an android app and I will explain the details of android app development later in the tutorial.
If the password matches your preset-
Lock the password, then the lock will be turned on and send feedback to your phone.
Arduino Uno: Arduino Uno is the most popular Development Board in the Arduino family.
Using arduino uno is not mandatory and you can use another member of the arduino family, such as arduino nano or arduino micro.
You can also use a separate atatmegap without using arduino baord.
Here is a good explanation tutorial for the independent atmega micro controller \"from Arduino to the micro controller on the breadboard \".
Bluetooth module (HC-05)
: Bluetooth is a wireless communication that uses radio waves to transmit voice and data at high speed.
It is widely used in mobile phone calls, headphones and data sharing.
This type of communication is a cheap and easy way to use arduino to remotely control things.
Communication with arduino using the Bluetooth module requires a connection to the arduino.
There are several models of the Bluetooth module.
I use HC here-
Very ordinary and cheap. HC-
The 05 module has 6 pins.
We have to connect 4 pins to arduino, they are: RXDTXDVCCGNDRXD will receive data from arduino;
TXD will send data to arduino;
VCC is the power supply (3. 3V to 6. 6V)
The ground is GND.
Click here for details.
Leaser motion attempt: I don\'t know the actual name of the part.
This is part of the CD/DVD player for moving the leaser LED used to read the CD.
This part contains two DC motors.
One for rotating the CD and the other for moving the laser diode.
We don\'t need the CD rotary motor, you can take it off.
You can also find this part from the old computer CD/dvd rom.
To remove this component from the CD drive, check the link: drive IC (L293D)
: L293D is double H-
Integrated Road and Bridge motor driver (IC).
Since the motor drivers feature low current amplifiers, they act as current amplifiers
Provides higher current control signalscurrent signal.
The current signal used to drive the motor is high.
L293D contains two built-in H-
Bridge drive circuit.
In its common operating mode, two DC motors can be driven at the same time, both forward and reverse.
The motor operation of the two motors can be controlled by the input logic of pins 2 & 7 and pins 10 & 15.
The corresponding motor will be stopped by entering logic 00 or 11.
Logic 01 and 10 will rotate clockwise and counter-clockwise, respectively.
Enable pins 1 and 9 (
Corresponding to two motors)
The motor must be very high to start running.
When the enabled input is high, the associated driver will be enabled.
As a result, the output becomes active and works in sync with the input.
Again, the driver is disabled when the input is low enabled, and their output is off and highImpedance state.
For more information about L293D, please check the attached data sheet or click here.
Voltage regulator (LM7805)
This is a 5 volt regulator.
The output of the AC adapter is to the input of the regulator.
The output of the IC is regulated by 5 V.
This output is given to the L293D and the micro controller.
Pins and data sheets with IC.
The circuit connection of our smart door lock is not complicated.
The Enable, IN1 and IN2 of the motor driver IC are connected to the arduino 9, 10 and 11 pins.
The Out1 and Out2 of the motor drive are connected to the DC motor of the leaser motion mechanism.
The L293D has two input voltages, one for the IC itself and the other for the motor voltage.
I have connected 5 v to two pins and our motor works fine under 5 v.
The drive has 4 ground pins, all of which are connected to the ground.
Radiator is not needed here.
5 v regulator IC (LM7805)
Used here, its input is connected to the output of the AC adapter. A 7.
The 5 v to 12 v AC to DC adapter works fine.
Since the arduino board has an internal voltage regulator, the output of the adapter is directly connected to the arduino VIN pin. TX pin of HC-
05 RX pin connected to arduino, HC-
05 connect to the arduino TX pin.
It may be a bit confusing, but the truth is, HC-
Received by arduino (HC-
05 TX to arduino RX)
, The data transmitted from arduino is received by HC-05 (
Arduino TX to HC-05 RX).
The circuit diagram, deformation source code, bread plate connection diagram, Fritzing sketch are uploaded here.
The code for Bluetooth to control the smart door lock is very simple.
I designed the android app so it sent a command with a password.
I actually set two commands, one is \"OPEN =\" and the other is \"CLOSE =\" and the password can contain any number, symbol or combination.
In the app, I used two buttons, one for opening the door and the other for closing the door.
When the password box and the open button are given a password, the app combines the open = command with the password and sends it to arduino.
I added the \"=\" Symbol and I will use this \"=\" to separate the command and password.
After receiving the strings from the phone arduino program, separate the commands and passwords from the receive strings and save them to two separate variables.
Then check the password first, if the password matches the saved password, then open the door of the open command and close the door of the close command.
\"=\" Helps separate commands from passwords.
A complete arduino sketch is given below.
Complete the Arduino code if the arduino receives the wrong password then it sends a message with the wrong password to the android phone.
The \"error\" string was actually sent by arduino.
The Android program then displays the wrong password message.
Set the laser moving mechanism and breadboard on your door using the hot glue gun shown above.
Be sure, two axes (
Lock and laser move)
Must be parallel.
Use the wall mounted adapter to power these settings up after they are in the correct position.
The LED of the Bluetooth module can flash continuously.
Run your android app (
Check steps 7 and 8)
If it has not been paired before, pair it with your phone with the pairing button.
For the first time, it will ask you to enter the code and use 1234 and OK.
Now connect it to your device with the connect button.
After the connection, enter the password set to the arduino program (
What I set up is \"arduPi\" and you can use it yourself
Go to the password box and click the close door button.
Close successfully.
Enter the password again and open the door. Door open?
If so, then congratulate!
You have successfully completed your project.
I will show you how to develop Bluetooth android App using MIT App Inventor.
I use App Inventor because it doesn\'t need any coding or software installation.
All you need is a Google account.
Go and you will ask to log in using a Google account.
Log in to App Inventor using gmail and follow these steps.
You are now in the designer, where you show the \"UI\" of your app \"(image 6).
The designer window is where you show the look and feel of the app and specify what features it should have.
You can select functions like buttons, images, labels, text boxes, and text for the UI-to-
Voice, Bluetooth, sensors and GPS.
Now, follow figure 7 and add a list selector to the viewer.
Rename it to connect to a Bluetooth device \"(image 8).
Add a label, a password text box, two buttons as shown in Figure 10.
Change the text properties of the component to \"enter password\", \"open door\", and \"close door\", respectively \".
The end user interface is shown in Figure 11.
Now add the Bluetooth client to the viewer.
It is an invisible component with no user interface. See Image 12.
It\'s time to switch to the block editor to tell your app what to do!
Click block to move to the block editor (image 13).
Think of designers and block buttons like tags-
You can use them to move back and forth between the two areas of App Inventor.
The block editor is the place to program the behavior of an application.
Have built-in
In blocks that deal with things like math, logic, and text.
Below are the blocks used with each component in the application.
In order for a block of a component to be displayed in the block editor, you must first add the component to the application through the designer.
Let\'s design blocks for list selector.
The list selector is a UI element that displays a list of the corresponding elements when clicked, and here is the paired Bluetooth device.
We have to add two block list selectors.
Front seat and list selector. AfterPicking (image 14).
Complete blocks are shown in figures 18 and 19.
Our design is complete and now we need to build apk file for our android phone.
Click the build menu and select the app (save .
Apk to my computer)\".
Wait a minute.
The Apk file will be downloaded to the default download folder.
Install and use it.
In the previous steps, I have shown you how to develop basic Bluetooth applications in app Inventor.
But this app is not user friendly.
It does not show you any messages, whether your door is open or closed or Bluetooth is not connected due to any errors.
I have attached a more advanced app for our project here.
When you run your app, this app checks if your Bluetooth radio is enabled and if it is not enabled, a Bluetooth enable dialog box will appear.
Click yes to turn on the Bluetooth radio.
Then pair the device using the pair device button.
Then click the connect button and if you successfully connect to any device, the app displays the MAC address and name of the connected device.
Enter the password in the password box, then click the open door button, if you enter the correct password, the goalkeeper will open and the app will show you a message indicating your door
Then enter the password again if you want to close.
If you give the wrong password, the app will display the wrong password information.
Complete the App Inventor source file (BTcontrol. aia)
Enclosed.
If you don\'t like to make your own app or modify it, just download BTcontrol.
Apk and install it on your android pone.
You can also download it from the Google Play Store using the link: modify the source click the Project menu and select import project (. aia)
As shown in Figure 24, browse BTcontrol from my computer.
Aia file on your computer
It can be easily modified after import.
Custom message
Chat Online 编辑模式下无法使用
Chat Online inputting...