Arduino combination lock in 20 minutes
![](https://habrastorage.org/storage2/8b3/c76/9f6/8b3c769f6c57d0aa7d771ee245afa40b.jpg)
Background
It just so happened that we decided at work to install a combination lock on our door, because as we constantly run in, we run out of the office, the door to which must be closed constantly in the absence of inhabitants. The keys are often forgotten inside. In general, we decided that the combination lock is an excellent solution.
Having rummaged at the Chinese flea markets and ebay I did not find anything cheap and more or less serious and decided to make it with my own hands. I will make a reservation right away that the Arduino platform was chosen for its simplicity, since there was no experience with microcontrollers at all.
Idea
On the door from the outside of the door there should be a keyboard on which the password is entered, the rest of the structure is fixed on the inside. To control the complete closure of the door, a reed switch is used. Leaving the office, a person presses the “*” on the keyboard and, without waiting for the door to be closed by the closer, he goes about his business, when the door is completely closed, the reed switch closes and the lock is closed. The door is opened by entering a 4-digit password and pressing "#".
Accessories
Arduino UNO = $ 18
Arduino protoshield + breadboard = $ 6
L293D = $ 1
Bundle of wires 30pcs for a delboard = $ 4
2 sockets RJ45 = $ 4
2 plugs RJ45 = $ 0.5
central locking actuator = 250 rubles.
Reed switch = torn free from the old window.
Espagnolette gigantic metal = free
Housing from an old D-LINK hub of 1.5 mm iron = free
Power supply from the same D-LINK hub for 12 and 5v = also free
A bunch of screws and nuts for attaching all this stuff to the case = 100 rubles.
Control panel from burglar alarm = free.
Total: $ 33.5 and 350 rubles.
Not so little, you say, and you will definitely be right, but you have to pay for the pleasure! And to collect something with your own hands is always nice. In addition, the design can be greatly reduced if you use a bare MK without an Arduino.
Assembly preparation
I would like to say a few words about the purchase of a key element of the design of the actuator. In the local auto store, they offered me two types of actuators: "with two wires and five." According to the saleswoman, they were exactly the same and the difference in the number of wires meant absolutely nothing. However, as it turned out later, this is not so! I chose a device with two wires, it was powered by 12v. In the design with five wires, limit switches are installed, which allows you to control the movement of the lever. I realized that I bought the wrong one only when I took it apart and it was too late to change it. The lever travel turned out to be too short to normally retract the latch, therefore, it was necessary to modify it a bit, namely to remove two rubber washers shortening the actuator lever travel. For this, the case had to be sawed along with an ordinary hacksaw, because that the second washer was inside. The blue electrical tape, as always, helped us in the future when assembling it back.
To control the actuator motor, the L293D motor driver was used, which can withstand a peak load of up to 1200 mA; when we stopped the actuator motor, the peak load grew to only 600 mA.
From the control panel from the burglar alarm, contacts from the keyboard, speaker and two LEDs were removed. The remote control and the main device were supposed to be connected using twisted pair and RJ45 connectors
Programming.
So, as of programming experience I have not had Arduino so far. I took advantage of other people's developments and articles from the site arduino.cc. Who cares, this ugly code can look :)
Photo and video
![](https://habrastorage.org/storage2/77c/5d0/8fa/77c5d08fa6e8738c32d84cde37a9d7b3.jpg)
Arduino and actuator
![](https://habrastorage.org/storage2/60a/1da/ea0/60a1daea05217215f3c374d8d59088d8.jpg)
Power supply
![](https://habrastorage.org/storage2/0e9/b1c/e5d/0e9b1ce5d19dcf554393afae07cc12f9.jpg)
Keyboard
![](https://habrastorage.org/storage2/dc8/e82/2d6/dc8e822d6cbee0b58e2fe51c79cc6c1f.jpg)
Espagnolette (connected to the actuator with a metal spoke and wearing heat shrink for beauty)
Video of the device operation process:
Used sources
www.youtube.com/watch?v=eJ46wRyT-ZA
arduino.cc
Afterword
About 20 minutes it was of course a joke, I personally made it a month (thanks to the mail of Russia), I was very tired of it, but I'm glad that I brought it to the end.