The electronic lock is also based on the 51 series microcontroller
(AT89051) as the core, equipped with corresponding hardware circuits, to
complete the functions of password setting, storage, recognition and
display, driving electromagnetic actuators and detecting their driving
current value, receiving alarm signals from sensors, and sending data.
The
microcontroller receives the input code and compares it with the
password stored in EEPROM. If the password is correct, it drives the
electromagnetic actuator to unlock; If the password is incorrect, the
operator is allowed to re-enter the password up to three times; If it is
not correct three times, the microcontroller will alarm the intelligent
monitor through the communication line. The microcontroller sends each
unlocking operation and the driving current value of the electromagnetic
actuator as status information to the intelligent monitor. At the same
time, it also receives alarm information from the sensor interface and
sends it to the intelligent monitor as the basis for intelligent
analysis.
1. Basic principles and hardware composition
The
intelligent password lock system consists of an intelligent monitor and
electronic locks. The two are placed in different locations, and the
intelligent monitor supplies the power required for the electronic lock
and receives the alarm and status information it sends. The line reuse
technology is adopted here, which shares a two core cable for power
supply and information transmission, improving the reliability and
safety of the system.
1.1 Basic principle and composition diagram of intelligent monitor
The
composition diagram of an intelligent monitor consists of a
microcontroller, clock, keyboard, LCD display, memory, demodulator, line
multiplexing and monitoring, A/D conversion, buzzer, and other units.
Mainly responsible for communication with electronic locks, intelligent
analysis, and safety monitoring of communication lines.
The
intelligent monitor is always in a receiving state, receiving alarm and
status information from electronic locks in a fixed format. For alarm
information, sound and light alarms will be immediately emitted through
the LCD display and buzzer; For the status information, it is stored in
memory and compared with the historical state of the electronic lock
before this time, to obtain the trend of change, predict future state
changes, and provide corresponding information to the on duty personnel
through the LCD display for decision-making purposes. While establishing
communication with electronic locks, the intelligent monitor monitors
the real-time changes in the power supply current flowing through the
communication line through an A/D converter, effectively preventing
damage caused by human factors and ensuring smooth communication lines.
1.2 Basic Principles and Composition Block Diagram of Electronic Locks
The
composition diagram of an electronic lock is also based on the 51
series microcontroller (AT89051) as the core, equipped with
corresponding hardware circuits, to complete the functions of password
setting, storage, recognition and display, driving electromagnetic
actuators and detecting their driving current value, receiving alarm
signals from sensors, and transmitting data.
The microcontroller
receives the input code and compares it with the password stored in
EEPROM. If the password is correct, it drives the electromagnetic
actuator to unlock; If the password is incorrect, the operator is
allowed to re-enter the password up to three times; If it is not correct
three times, the microcontroller will alarm the intelligent monitor
through the communication line. The microcontroller sends each unlocking
operation and the driving current value of the electromagnetic actuator
as status information to the intelligent monitor. At the same time, it
also receives alarm information from the sensor interface and sends it
to the intelligent monitor as the basis for intelligent analysis.
2. Key Technologies
In
order to improve the security and reliability of intelligent password
locks, this article not only takes measures in device selection (such as
using low-power, wide temperature range devices), but also adopts some
key technologies in the design.
2.1 Line multiplexing technology
The
intelligent monitor and electronic lock are placed in different
locations. The intelligent monitor supplies the power required for the
electronic lock and receives alarm and status information sent by it. If
communication lines and power supply lines are separated, it is
inevitable to increase the number of cable cores and increase safety
hazards. This article adopts line multiplexing technology, using only
one two core cable to achieve power supply and information transmission.
The schematic diagram is shown in Figure 3.
At the sending end,
the electronic lock boosts the modulated data signal through a pulse
transformer T and sends it out; At the receiving end, the pulse
transformer T reduces the voltage of the received data signal and sends
it to the demodulator to reduce the loss of the carrier signal during
transmission. In order to reduce mutual interference between
communication and power supply, the selection of choke L and coupling
capacitor C should be comprehensively considered.
Assuming the
carrier frequency fo=400kHz, in order to ensure that the majority of
signal energy is transmitted to the receiving end, L=33.7 μ H and
C1=0.047 μ F.
2.2 Current monitoring technology
In order
to prevent human damage to communication lines and the electromagnetic
actuator from burning out the coil due to excessive current flowing
through the electromagnetic coil for some reason, this article adopts
current monitoring technology in the design of intelligent password
locks. The current monitor adopts the MAX471 current/voltage conversion
chip produced by MAXIM company. This chip can convert the measured
current I into an output voltage U to ground, and has the
characteristics of a large measurement range, high accuracy, and a
proportional output voltage U to the measured current I. The output
voltage of the current monitor is sent to the A/D converter, and the
microcontroller reads the A/D conversion results to obtain the changes
in current in the circuit. Through analysis, abnormalities are detected
in a timely manner and an alarm signal is issued. The principle circuit
is shown in Figure 4.
2.3 Data communication and preprocessing technology
The
intelligent monitor receives status information from the lock
(including opening, closing, first password error, second password
error, third password error, etc.), the current value flowing through
the electromagnetic actuator coil, and reads the power supply current
value of the communication line at that time. The three are combined to
form a data block, where the operation status accounts for 1 byte, the
power supply current accounts for 2 bytes, and the coil current accounts
for 2 bytes. The intelligent monitor is always in a receiving state
during communication with the electronic lock. In order to improve
communication reliability, this article adopts a repeated transmission
method in the communication protocol. The electronic lock sends each set
of data 5 times, and the intelligent monitor receives this set of data
and uses the law of large number decoding to correct errors, ensuring
the accuracy of data reception. In addition, in order to save memory,
preprocessing techniques need to be used for the received data. That is,
after receiving each data, the data is first compared with the set
threshold value. If it is greater than the threshold value, an over
limit alarm will be issued; If it is less than the threshold value,
compare the data with the same type of data received on the same day,
and retain the larger one. The data stored each day is the maximum value
among similar data, as shown in the flowchart.
2.4 Intelligent analysis
Intelligent
analysis and prediction technology is based on the data blocks received
each time, comparing them with the recorded values of similar data
before, analyzing the magnitude and trend of current changes caused by
this operation, discovering existing problems in a timely manner, and
reporting them to management personnel, thereby improving the
reliability of the entire system.
3. System software design
The
intelligent password lock software uses 51 series microcontroller
assembly language to program the intelligent monitor and electronic lock
separately. The intelligent monitor software includes modules such as
keyboard scanning and LCD display programs, buzzer driver programs,
clock modification and reading programs, data communication and
preprocessing programs, intelligent analysis programs, and line
monitoring programs. The electronic lock software includes modules such
as keyboard scanning and decoding program, LCD display program,
communication program, electromagnetic actuator driver and detection
program, sensor interface program, etc. In the software design process,
modular design methods are adopted to facilitate program reading,
debugging, and improvement.
The intelligent password lock fully
utilizes the software and hardware resources of the 51 system
microcontroller, introduces intelligent analysis functions, and improves
the reliability and security of the system. It has been well received
by users through installation and use in a certain model of safe. In
addition, with slight modifications in software and hardware,
intelligent password locks can form an intelligent distributed
monitoring network, achieving centralized monitoring and management
within a certain range. They have broad application prospects in
finance, insurance, military important areas, and other security
prevention fields.