Create a single-chip control "optical code electronic lock"

Create a single-chip control "optical code electronic lock"

Edith 2018-10-25

Create a single-chip control "optical code electronic lock"

A few days ago, I watched TV and saw an optical code electronic lock, so I came up with the idea of changing the current ordinary key lock. I made a simple photoresistor identification unlock. [The safety factor is small, but even if the frequency of the unlocking end light is deciphered, it cannot be unlocked, because the resistance of the photosensitive resistor is not the same, and the brightness of the unlocking LED changes after each unlocking. Only the unlocking LED is synchronized]

You can change the password and change the password: you can change the number of interval flashes and interval time of the light in the code. Here I set this to:

   Bright → 0.5 seconds → off → 1 second → bright → 1.1 seconds → off ← cycle

In order to improve security, you can also make a one-time password, which is randomly changed and synchronized after the clock is timed.

This time I used the development board, which contains STC89C52, (the material is ready to be a minimum system)

First we take out the photoresistor

Connect LED1 to P1.0 on the development board as a key

We write a program to let the LED

Bright → 0.5 seconds → off → 1 second → bright → 1.1 seconds → bright ← cycle

The 0.5 second and so on here are not rigorous, but the time interval is determined by the photosensitive resistor sensing the program [identification procedure].

 Align the LEDs with the two protrusions on the photoresistor to achieve the same brightness

The code has been written.

Need a power supply, connect the output power end of the microcontroller, even if it recognizes a sudden power failure, it will continue to trigger. If you are triggering a stepper motor, you need more points, don't forget to add salt.

Take out a box and move the unlocked section all in

In the later stage, if you want to use it in real time, you can make a minimum system to unlock the end. When you can actually reduce the volume, you can change the chip. You only need a simple code and a port to drive the unlocking end. .

PS: Place the power supply outside the box.

It has already been said at the beginning, this security is small, but it is not easy to unlock. The resistance of the feeling is not the same, but if you find both, you can change this to something like "one password". Encrypt the code. After the first user unlocks the lock, the lock is synchronized to the unlocking terminal to randomly synchronize the Y valid passwords. At the time, all the information is displayed to the user, which can be easily displayed with 1602, and the next time the lock is opened by the manual Enter the information Y as a few. If you do not know this information, the password will be invalid. Only wait for a certain time to synchronize again. If the user forgets the information, you can directly enter the password to unlock. Some people may ask if it is better to be an electronic lock that directly enters the password. In fact, the meaning of the optical code lock is not much safer than the electronic lock, but it is faster to unlock the lock under the electronic basis. Of course, I do The "key" is too big.

Follow Me