Diy Iot Smart Padlock Controlled Via Smartphone

by CrazyScience in Circuits > Arduino

906 Views, 7 Favorites, 0 Comments

Diy Iot Smart Padlock Controlled Via Smartphone

keylock.JPG
padlock.gif
lockedd.JPG
unlocked.JPG

Hello Readers, In this instructables i will show you an excellent project! Yeah, I call this as excellent because indeed it is worth calling so.

This project is all about building a smart padlock from scratch and no matter if you are a beginner to hobby projects or an occasional project builder you can build this from my detailed instructions given on this instructables.

To begin with, let me give you an overview of this project and why you should consider building one.

We all have used padlocks in one or the other instance in our lifetime, Most commonly it is used to lock doors and secure them so that no outsiders can enter to steal our precious things stored inside.

The most common mistake we make is either forgetting the keys to that padlock or losing it somewhere, Cloning the keys will cost you a fortune and also it is a waste of time, Also the metal parts inside wear overtime and if your climate conditions are not good it will lead to the formation of rust.

I have been thinking about this for a while and came up with a solution that is practical, Replace all the metal parts with no corrosive materials and something with the keys.

I made use of PLA filament to print the body of this padlock and instead of the physical key I will use phone control and no matter where we go we always carry the phone in our hand.

These ideas led to making this padlock and in the below steps I will explain you in detail about building this project from idea to reality, One more thing I want to tell you is to consider building such practical projects you will have a chance to learn a lot of things.

Make sure to check the video given in the end, I have included STL files for this project, All the files, circuit and codes are available to my community at no cost so everyone can take advantage of this project.

Supplies

1e.png
3e.png
2e.png

Here is the list of components that you need to build this smart padlock, i have included links for purchase so that you don't need to spend your time searching elsewhere

Wemos D1 Mini from Amazon

Micro Servo

OLED module

3d printer that i use

PLA filament

Soldering iron

Wire trimmer

Phone with Wi-Fi connectivity

USB cable

Power bank or any other USB-powered device

Arduino IDE

Birth of This Padlock

slice.jpg
lock.jpg
16e.png
14e.png
15e.png

Before i made a design for this padlock on Tinkercad i took measurements of all the electronic components that i will be using here, Made a rough sketch on paper and later designed the same on Tinkercad application

Here is my Tinkercad design file if you are willing to customize this model further, I will be using 3 simple parts with slots to hold the mechanism.

Later i sliced the model using Cura and you can follow the setting that i used, No rafts or supports are necessary, Use PLA filaments to print the parts also no post processing is required.

If you have any overhangs make sure to clean it after you get the printed parts.

Lock Parts

17e.png
18e.png
19e.png

It will not take much time to get the 3d printed parts.

Here we will end up with 3 parts i named it as the base plate(that holds all the electronics), Lock ring and the front face plate that hold the OLED screen.

There are slots on the sides and on the top part of the base plate, The choice of color is yours.

If you want additional security you can increase the thickness of the parts, But as of my requirement this will do pretty well.

Webbing might occur if your filament had been exposed to moisture and you can see this while you print the lock ring, You can simply use emery paper to remove this or if you don't have it use any hobby cutter to remove those webbing structures.

After we have this we have dummy padlock ready, Now let us add life to it using the electronics.

Circuit and Codes

keypad lock program.jpg
circuit for lock.jpg
flexxible pcbs.png
rigid flex pcb.png
rigid flex pcbs.png
rigid pcb.jpg

The circuit is very simple because we are using only 2 parts here.

The servo and the OLED screen, i will explain the circuit one after the other, Here we are not using jumper cable for connections instead directly soldering, You can test the circuit first and later solder the wires.

Servo Moto connections are as follows

Signal wire is connected to D4 on the Wemos. This wire sends control signals from the Wemos to the servo.

Power is Connected to the 5V pin on the Wemos and Ground is connected to the ground (GND) pin on the Wemos, completing the servo circuit.

OLED Display

The OLED screen displays status messages, like “Lock” or “Unlock,” depending on the servo’s movement. The connections are:

SCL connected to D1 on the Wemos, SDA is Connected to D2 on the Wemos

VCC and GND are Connected to 5V and GND on the Wemos board

After the circuit is complete open arduino ide and paste the below code to your board, make sure you replace the ssid and password of mine with yours

Once the code is uploaded you should see the connection screen on OLED board and now you are good to go, Open your phone web browser and enter your IP and you can see the lock and unlock panel, if you are still struck check the video given in the end of this project

You also can simplify this circuit with a Simple small PCBComplete your electronic projects in the best way from PCBWay

Why them? They have provided me with the best PCB and The quality is just amazing compared to other providers in the market, They also have Color PCB printing Try it out.

Don't have a 3d printer? You can get the best 3d printing service here

Check Here for Rigid-flex Pcbs with this your circuit becomes flexible! I have added the images to this step kindly check.

A revolutionary solution that combines the best of both rigid and flexible circuitry to elevate your electronic projects to new heights.

With their expertise in advanced manufacturing techniques, they offer a seamless integration of rigid and flexible components, ensuring enhanced reliability, durability, and space-saving benefits.

Downloads

Trimming the Circuit

4e.png
6e.png
7e.png
8e.png
10e.png
25e.png
26e.png

You cant use the wires as it is for the circuit this is because we are shrinking this circuit to fit inside a small box and those additional wires will cause the circuit to look messy and chances of not working are more.

I have trimmed the wires of servo and OLED board, i also removed the pins of wemos board so we can solder the wires directly and eliminate the use of extra space occupied by the pins.

Solder the joints well and leave no overhangs because it will cause problems later, It will not take much time to solder since we have only 7 solder points here.

Slighly pull the soldered areas to double check the joints, There is no need of using any insulated materials additionally.

Now insert the electronics inside the 3d printed case and use hot glue to secure the parts to the base.

Some minor adjustments need to be done in the lock mechanism part and i will tell you how you can do that too in simple way.

Refine the Movements

keylock.gif
27e.png
28e.png
30e.png
31e.png
33e.png
32e.png
34e.png

The servo horn that I used had a long tip which caused the mechanism to struck in some point to i wanted to give that a permanent fix, so I cut the tip part and later finished the edges by exposing it to flame from a lighter.

Make sure not to expose much, we are just smoothening the edges, Now for the securing of the lock ring there is a small technique that will add more strength to the entire lock system.

The lock ring is slightly smaller than the hole on the base body, this was done intentionally to enable lock to move freely, If more force is applied then there is a chance for keyring to come out, i fixed this issue by adding a small piece of filament to the end.

Use lighter to melt the filament piece and glue it like shown in the steps, allow to dry and trim off the excess part.

This ensures that the lock work smoothly after it is cased, After this you can cover the top part using superglue.



How to Use

41e.png
console.JPG
42e.png
keylock.JPG

Using this is not a big deal, Its like using any USB plug and play device.

Connect the USB to power bank or any other power source and the other end to this padlock(wemos d1 mini board)

The OLED will show message, By default the padlock will be locked and now you can open any browser on your phone, make sure your phone wifi is on, This board automatically connects to the network.

If you are not able to find your IP, go to wifi settings and click on connected devices, Now you should be able to see your wemos board IP

Type or paste this IP on your browser and click on enter and now a panel will appear that shows lock and unlock button.

When you press on unlock button it immediately open the lock and to lock you have to manually place the lock ring inside the hole and later press on the lock button on phone.

Now you may think if the power is lost will my keypad lock remains unlocked?

No the padlock only opens when you press unlock button on your phone and by default it remains lock even when the power supply is off.

Hope you liked this idea, if yes kindly share this project to your loved ones whom you think needs to learn/build this, Thanks and happy building.

Video Tutorial

Diy Iot Smart Padlock Controlled via Smartphone

Feeling like you are missing something? Yeah you are!

Watch this detailed step by step video tutorial of this project where i showed the working of this project, Dont miss to check the lock mechanism part it looks soo interesting.

If you still have any questions ask in the comments lets have a discussion, Thanks and let me know how this project made you feel.