Thursday, November 7, 2024

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages

Wireless Biometric Lock Using Arduino With The IoT

If you’re still using traditional keyed locks, then you must be always worrying about losing the key or somebody breaking into your house. With traditional locks, there is a higher risk of keys being misplaced or getting into the wrong hands. As a result, many people are now opting for modern biometric locks to enhance the security of their houses. Unlike the traditional lock, a modern biometric lock requires no key to lock or unlock the door. You no longer need to carry a bunch of keys wherever you go, as you just have to use your fingerprint to unlock/lock the door. But as these smart locks are made using biometric sensors, they come with heavy price tags.
Wireless Biometric Lock setup and app

This DIY project will help you to build a low-cost biometric lock. We all have biometric fingerprint sensors in our smartphones. Today, I’m going to use this sensor to make a prototype of the biometric lock at just Rs 850.

Before starting this project first gather these components: –

- Advertisement -

Bill of Material

Bill of Material for Wireless Biometric Lock

- Advertisement -

Wireless Biometric Lock – Coding

First of all, we will create a program in Arduino IDE and upload it on the Arduino development board. This Arduino program will help create communication between our smartphone and Arduino over Bluetooth. This will enable it to check commands coming from smartphones to perform tasks.

To develop the code, first we have to create a string variable that stores the unique device ID for lock, and then add the servo library. Next, we will set serial baud rate for Bluetooth communication. Here in this code, we have used the baud rate 9600 for Bluetooth communication. You can use different baud rate according to your Bluetooth HC 05. After setting baud rate of Bluetooth HC 05, set the pin for servo motor that we are going to use. (Refer fig 2).

Wireless Biometric Lock Arduino Code
Fig 2. Arduino Code Setting servo

After this, we will create a loop function to store the device ID sent by the Bluetooth in “reads” string. After that we have to create an ‘if condition’ for checking the device ID sent from the Bluetooth. If the fingerprint matches in android app then that app sends the device ID to Arduino. And if this ID matches with the one set in Arduino then the servo motor moves to unlock position.

If the Bluetooth reads the wrong fingerprint, then it automatically turns the servo to lock position. (Refer Fig .3)

Arduino Wireless Biometric Lock Code
Fig 3. Arduino Code Checking Device ID.

App Making

We can make the app in two different ways – one in Android Studio and other in Kodular. In this project, we are going to use Kodular, which basically have different code blocks. You can make an app by combining these blocks. It is easy and saves time in coding. But for the developers who love coding, they can use Android studio. You can ask me in the comment section if you want me to make an app using android studio as well.

Use any web browser and open Kodular website to start making app.

First, we add the following components in layout for app: –

  • Bluetooth Clint
  • Fingerprint
  • List view
  • Image Button

Code development for Wireless Biometric Lock Connection

After that join the code blocks as shown in the picture below. Then export the .apk to your PC and install that app in your phone.

Wireless Biometric Lock Code Blocks
Fig 5. Code Blocks.

Wireless Biometric Lock – Circuit Connection

As we have completed our app and uploaded the code to Arduino. Now let’s connect the components as illustrated below.

Arduino Components
Rx Bluetooth TX
Tx Bluetooth Rx
5V Bluetooth 5V
GND Bluetooth GND
GND Servo Motor GND
Pin 9
Servo Motor Signal Wire (Yellow coloured)
Wireless Biometric Lock Connection
Fig 6. Connection

Making Wireless Biometric Lock

Next, follow the steps given in pic to prepare the lock for the biometric locking system.

Step 1. Get any broken lock from the market or from any hardware shop.

Step 2. Now attach the servo motor moving shaft to the lever of the lock as shown in the pic below.

Step 3. Then close the cover of the lock and connect all electronic components as illustrated in the connection section.

Broken Lock
Fig 7. Broken Lock
Servo attached to the lever
Fig 8. Servo attached to the lever

Testing

Now, power the lock and servo with a 5-6 V battery and then open the app that we have created.

After that turn on the Bluetooth of your phone and then pair the Bluetooth HC 05 with your phone. After a successful connection with Bluetooth HC 05 with your app, the Bluetooth Icon changes into Lock Icon. (Refer to Fig 9)

Wireless Biometric Lock App Layout
Fig 9. App layout

After that touch the fingerprint icon. When you touch the fingerprint icon, you will get a message box asking you to unlock with fingerprint. Now touch the fingerprint sensor on your phone. If it matches with the fingerprint set in your phone, then it turns the lock to ‘on position’ and at the same time the lock icon changes into unlocked icon. (Fig 10).

After asking to touch Fingerprint
Fig 10. App after asking to touch Fingerprint

If you give the wrong fingerprint then the lock moves back to its locking position (Refer to Fig 11)

fingerprint doesn’t match
Fig 11. The fingerprint doesn’t match

You can download the code from the link below-

Download Source Code

Ashwini Sinha
Ashwini Sinha
A tech journalist at EFY, with hands-on expertise in electronics DIY. He has an extraordinary passion for AI, IoT, and electronics. Holder of two design records and two times winner of US-China Makers Award.

58 COMMENTS

  1. NEED urgent HELP!!
    I have used the app and connected to Bluetooth but the servo motor does not move and is stuck on same position ..ive tried multiple programs on the servo ,the motor is working..but I think the app is not working

    • Do some test steps.
      First check is the data send from the App to Bluetooth is receiving by Arduino. if not try to swipe the RX TX pin of Bluetooth.
      Next test the servo motor by trying the Servo Sweep example. If this example didn’t move your servo you need to change your servo motor.
      If still face any problem ask me and elaborate your problem what exactly happening with you device.

  2. I tried this project everything is good but the problem I face is, when the fingerprint is recognised the servo motor turns to some extent (80°) and returns to its original position immediately. Actually it must turn and stop there, when the fingerprint is again recognised it must come back.Help me to make this, t I think the the problem is with the code.

    • Connect Servo red wire to 5V +v terminal of the battery and black wire to the -ve terminal of the battery. Then connect the yellow wire to pin 9 of Arduino. Also, connect the black wire of the servo to the GND of Arduino if using a separate power for the servo and Arduino.

  3. What is the type of broken lock we ae supposed to use.. I am not understanding the type of Lock..
    COULD YOU PLEASE SHARE A PICTURE of the Broken Lock which has to be used in this project
    THANKYOU

  4. Hi Ashwini,

    I have a use case and thinking of creating a similar product. Wanted to check the feasibility and if we can create a final product suitable for end user.
    Let me know if you interested, we could have a discussion about the same. Please email me back if interested

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics