With the help of Arduino, you can make a copy of the intercom key at home in 15 minutes, if, for example, the workshop is closed, and the key is needed urgently. Let's see how this is done.
It is necessary
- - Arduino;
- - a computer;
- - key for intercom type iButton or 1-wire;
- - dummy key to create a "clone" of the original key;
- - 1 resistor with a resistance of 2, 2 kOhm;
- - connecting wires.
Instructions
Step 1
Each key for the intercom has its own number - it is this number that serves as the key identifier. It is by the key number that the intercom decides - your own or someone else's. Therefore, the copying algorithm is as follows: first you need to find out the number of the "allowed" key, and then assign this number to another key - a clone. It makes no difference for the intercom whether the original key or its copy was attached. After checking the number with his authorized number database, he will open the door.
The keys for the intercom, which we will connect to the Arduino (sometimes called iButton or Touch Memory), are read and written over the 1-wire 1-wire interface. Therefore, the wiring diagram is very simple. We only need a pair of wires and a 2.2K pull-up resistor. The diagram is shown in the figure.
Step 2
To work with the 1-wire interface, there are ready-made libraries for Arduino. You can use, for example, this one: https://www.pjrc.com/teensy/arduino_libraries/OneWire.zip. Download the archive and unpack it into the "libraries" folder located in the Arduino IDE directory. Now we can very easily work with this protocol.
Load the sketch shown in the illustration into Arduino in the standard way.
Step 3
This sketch shows the key number for the intercom, which is connected to the circuit. This is what we need now - we need to find out the number of the key we want to make a copy of. Connect Arduino to your computer. Let's start the serial port monitor: Tools -> Serial port monitor (or the keyboard shortcut Ctrl + Shift + M).
Now let's connect the key to the circuit. The port monitor will show the key number. Let's remember this number.
Step 4
Now let's rewrite the sketch so that it can write data to the key memory. The code is shown in the illustration. Detailed comments are given in the code. Most importantly, do not forget to set the number of your original key in the key_to_write array, which you learned a little earlier.
Step 5
Upload this sketch to Arduino. Let's open the serial port monitor. Let's connect a key to the circuit, which will be a clone of the original key. The serial port monitor will display a message on the result of the programming.
Step 6
1) If, when compiling the sketch, an error occurs [WConstants.h: No such file or directory #include "WConstants.h"], then in the file "OneWire.cpp" replace the first block after the comments with the following:
#include "OneWire.h"
#include "Arduino.h"
extern "C" {
#include "avr / io.h"
#include "pins_arduino.h"
}
2) If during compilation the error "class OneWire has no member named read_bytes" or similar appears, then find another OneWire library, there are many of them on the Internet.