📜 ⬆️ ⬇️

Code lock on the Arduino in 20 minutes



Prehistory


It 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 permanently in the absence of inhabitants. Keys are often forgotten inside. In general, we decided that a combination lock is a great way out.

Having rummaged in the Chinese flea markets and ebay, I did not find anything cheap and more or less serious and decided to do it myself. I’ll make a reservation at once 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 should be located the keyboard on which the password is entered, on the inside is fixed the rest of the design. To control the complete closure of the door is used reed. Leaving the office, the person presses the “*” key on the keyboard and without waiting until the door closes, the door closer goes about his business, when the door is completely closed, the reed switch closes and the lock is closed. The door opens by entering a 4-digit password and pressing "#".
')

Accessories


Arduino UNO = $ 18
Arduino protoshield + breadboard = $ 6
L293D = $ 1
A bundle of wires 30pcs for brainboard = $ 4
2 RJ45 sockets = $ 4
2 RJ45 plugs = $ 0.5
central locking actuator = 250 rubles.
Reed switch = free from the old window.
Giant metal locks = free
Housing from the old D-LINK hub of 1.5 mm iron = free
Power supply from the same hub D-LINK at 12 and 5V = also free
A bunch of screws and gadget for mounting all this stuff to the body = 100rub.
Alarm control panel = free.

Total: $ 33.5 and 350 rub.

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 a pleasure. By the same construction can be much cheaper, if you use a bare MK without Arduino.

Preparation for assembly


I would like to say a few words about the purchase of the key element of the actuator design. In the local auto shop, I was offered two types of actuators: "with two wires and five." According to the saleswomen, they were absolutely 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. Limit switches are installed in the construction with five wires, which allows to control the movement of the lever. I realized that I had bought the wrong one only when I disassembled it and it was too late to change it. The lever stroke was too short to properly slide the latch, therefore, it was necessary to modify it a little, namely, to remove two rubber washers shortening the lever stroke of the actuator. For this, the body had to be cut along a regular hacksaw, because the second washer was inside. The blue electrical tape to us, as always, helped us in the future when assembling it back.
To control the actuator motor, the driver of the L293D motors was used, which can withstand a peak load of up to 1200 mA, and when the actuator motor stopped, the peak load increased to only 600 mA.
From the control panel of the security alarm were removed contacts from the keyboard, speaker and two LEDs. The console and the main device were supposed to be connected using twisted pair and RJ45 connectors

Programming.


So, as the experience of programming Arduino, I have not had until now. I used other people's work and articles from the site arduino.cc. Who cares, can look at this ugly code :)

Photo and video



Arduino and actuator


Power Supply


Keyboard


Espagnolette (connected to the actuator with a metal needle and which is wearing a heat shrinkage for beauty)

Video of the device operation process:


Used sources


www.youtube.com/watch?v=eJ46wRyT-ZA
arduino.cc

Afterword


Of course, about 20 minutes it was a joke, I personally made it a month (thanks to the mail of Russia), I was very tired of it, but I am glad that I brought it to the end.

Source: https://habr.com/ru/post/135981/


All Articles