Jotrin Electronics
Description Quantity Total (USD) Operation
Shopping cart products
Shopping cart products : 0
Home > Processor/DSP > Design of Inductive Intelligent Electronic Door Lock System Based on P

Design of Inductive Intelligent Electronic Door Lock System Based on PIC16F73 Microprocessor and RS485 Bus

Update Time: 2020-04-20 11:47:14

1 Overview

Early intelligent electronic door locks were magnetic card locks that used a magnetic card as the key to open the door, and were mainly used in hotel rooms. With the development of semiconductor technology, smart electronic door locks with more powerful functions and higher reliability have become the mainstream. The main advantage of the contact IC card electronic lock is that the card has a large storage capacity and a complete mechanism. The use of intelligent electronic door locks can flexibly set a variety of door opening permissions, prevent illegal copying, and realize hierarchical management and sub-regional management. Its time control function and storage door opening record function have completely changed the single state of mechanical door lock function, making the door lock part of the management system, greatly improving the management level and service level, so it has gradually become one of the basic facilities of star hotels.

In the 21st century, inductive IC card (also called non-contact IC card) technology has developed rapidly, and a new generation of intelligent electronic door locks based on inductive IC card technology has also emerged. Because the inductive intelligent electronic door lock has no mechanical contact and does not produce friction, it reduces wear and human damage and greatly reduces the failure rate. At present, the application field of inductive electronic locks is constantly expanding, and has expanded from the traditional hotel industry to high-end office spaces, high-end apartments, and even entered the family.

This article focuses on the inductive intelligent electronic door lock system suitable for high-end hotels.

2. System composition and function

Inductive intelligent electronic door lock system usually consists of five parts: intelligent electronic door lock, induction card, card issue management software, handheld POS machine and card issuer. The main functions of each part are introduced below.

(1) Smart electronic door lock

Installed on the customer door. When an induction card approaches the antenna on the lock body, the microcontroller (MCU) in the lock automatically starts the card reading process. If the valid card is read, the micro motor is driven to drive the clutch mechanism. At this time, the handle is pressed and the lock is opened; if the non-valid card is read, an invalid card prompt is issued, and the handle can also be pressed at this time But the lock cannot be opened.

Smart electronic door lock

The main functions of the intelligent electronic door lock:

* Zone management function-support zone management, service card is only valid in this service area;

* Hierarchical management function-support four levels of management of service area, floor, building and hotel;

* Age control function-no matter the guest card or the staff card, there is a time limit, which will automatically expire;

* Schedule function-you can specify valid and invalid days in 7 days a week;

* Time window function-you can specify the effective period and invalid period in 24 hours a day;

* New card replaces old card function-the new card can automatically terminate the old card;

* Termination / Resume function-you can use the termination card to suspend the use of the designated guest room door lock, and use the recovery card to resume the suspended guest room door lock;

* Unlock record function-when swiping the card, the door lock records the card number and door opening time in the lock for inquiries at any time, the maximum number of records is 240;

* Low voltage reminder function-when the battery voltage is lower than 5.1V, the green and yellow lights are on at the same time to remind the user to change the battery (after the low voltage reminder, you can still unlock more than 100 times);

* Anti-locking function-the door opening card can be set to allow anti-locking or not;

* Normally open function-the office type lock has the normally open function, the hotel type does not have this function.

(2) The types and functions of induction cards are listed in Table 1.

Table 1

Scope of application
Guest Card
Accommodation guests
Room door lock
Open the door lock of the specified room within the given time domain
Service card
Service area room door lock
Open the room door lock of this service area within the given time domain
Floor card
Floor foreman
Floor room door lock
Open the room door lock of this floor within the given time domain
Building card
Building Manager
Door lock for the whole building
Open the door lock of the guest room in the building within the given time domain
Master card
General manager
The entire hotel
Open the door lock of each room of the entire hotel in the given time domain
Emergency card
Senior management
The entire hotel
Open the door lock of each room of the entire hotel in the given time domain
Termination card
The entire hotel
Suspend the use of the designated room door lock, even if the guest card is temporarily invalid
Recovery card
The entire hotel
Restoring the use of guest room door locks in suspended state

(3) Card issue management software

The main functions of the card issuing management software;

* System management-operation log, password change, operator setting, system suspension;

* Function management-user information, management area, room settings; default parameter settings;

* Communication management-door lock data communication, basic information inquiry / inquiry, unlock record inquiry;

* Room management-guest card making, guest refund, change validity period, vacancy inquiry, check-in status, and refund inquiry;

* Employee management-make employee card, return employee card, change employee card, employee card query, and process card.

(4) Handheld POS machine

The handheld POS machine is used for information communication between the card issuing management software and the intelligent door lock. The card issuing management software downloads the hotel identification number, room number, card reading password and other information to the POS machine through the RS232 serial port, and then the POS machine downloads the hotel identification number, room number, card reading password and other information to the smart door lock through the RS232 serial port. At the same time, the time can be checked. Similarly, the unlocking records stored in the lock are also uploaded to the card issuing management software for statistical analysis by the POS machine.

(5) Card issuer

In fact, the card issuer is a TEMIC card reader, which is used in conjunction with the card issue management software to complete functions such as card issue, card lock, and card inquiry.

3. Intelligent electronic door lock design

Intelligent electronic door lock is the key equipment of the whole system. The main design goals of smart door locks are: to design a reasonable card data structure, to ensure that under the premise of realizing functions, to support system function expansion, that is, to support the "one card" function; the system static power consumption must be low enough; has a high reliability Sex and sufficient safety.

(1) TEMIC induction card technology

German TEMIC company (now acquired by American Atmel) has developed a series of non-contact IC card products, including e5530, e5550, e5551, e5560, e5561 transponder chips and U2270B read-write base station chip. The transponder is usually packaged in the form of a card, or it can be packaged in a glass tube.

The following is a brief introduction to the transponder e5550. e5550 is a TEMIC standard read-write transponder chip with 264-bit EEPROM, and its storage is divided into 8 areas, each with 33 bits. Bit 0 is the lock bit of the area. Once locked (set to 1), the area is "write protected" to prevent any overwriting. Area 0 stores the mode word, and its read and write operations depend on the setting of the mode word, such as the baud rate, the modulation mode of the transmitted data, the maximum allowed transmission data area, the password and AOR function, and the setting of the lock bit. Areas 1 to 6 are user data areas, which can be read and written by area. Area 7 is the password area when working in the password mode. If password protection is not required, area 7 can also be used as the user data area in the same way as areas 1 to 6.

The read-write base station chip U2270B is equipped with a small number of peripheral devices and coupling antennas, and constitutes a reader like the MCU. It can also be said that the U2270B read-write base station chip is the communication interface between the MCU and the transponder. After the transponder enters the RF magnetic field, the electrical energy is induced by the coil and is automatically powered on and reset, after waiting for 256 RF field clock cycles, it starts to read and send the data in the corresponding area of the memory repeatedly according to the bit rate and modulation mode set by the mode word . The base station chip demodulates the received signal and sends it to the MCU in Manchester code. The decoding of Manchester code is completed by the MCU program. The MCU controls the CFE of the base station chip and writes the data into the transponder in a short-gap RF field interruption method.

(2) Hardware design

The microcontroller (MCU) uses the 8-bit microcontroller (PIC16F73) from Microchip Corporation. The function of the infrared detection circuit is to detect whether the induction card is approaching. Every certain time, the transmitting circuit will automatically emit infrared signals. If an object approaches, the receiving circuit will receive the reflected infrared signal and immediately notify the MCU to read the card. operating. The induction card reader IC is driven by the MCU to read the induction card, and then returns the read data in Manchester code to the MCU, which is decoded by the MCU through the program; the decoded data on the card and the lock stored in the memory Check the parameters and determine whether it is a valid card according to the current time; if the card is valid, start the motor drive circuit to unlock, and store the relevant information (unlock record) into the memory. The MCU communicates with the handheld POS machine through the RS232 interface, receives various setting data, proofreading time, etc. from the POS machine; when necessary, it can transfer the unlocking records stored in the lock to the POS machine, and then pass it to the computer for statistical analysis. The low voltage detection circuit automatically monitors the battery voltage. Once the battery voltage drops to the specified value, the MCU is immediately notified, and the yellow low voltage prompt LED is activated by the MCU to remind the customer to change the battery as soon as possible. The power supply circuit plays an important role in controlling power consumption. Under the control of the MCU, it provides power for various circuits including the MCU, and can change the voltage value according to actual needs in different states, so as to keep the overall power consumption to a minimum and extend the battery life.

(3) Microcontroller software design

The most important environment in the entire system of MCU control software. We use assembly language programming, adopt top-down programming methods, and follow the principles of structured programming to make the software more efficient and maintainable.

The software is mainly divided into the following five functional modules: initialization and self-test module, decoding and card reading module, data verification module, communication module and serial memory read-write module. The main function of the serial memory read-write module is to provide other modules with access to the serial memory read-write module subroutine. Therefore, in addition to the serial memory read-write module, the remaining four modules are relatively independent. In this way, the complexity of programming and debugging is reduced, and the reliability and maintainability of the software are improved.

The function of the initialization and self-test module is to restore the system to the initial state and test each hardware circuit. The detection range includes: whether the read-write IC of the induction card is normal, whether the real-time clock is working normally, whether the serial memory is read and written correctly, whether the infrared detection circuit is working normally, the motor drive circuit, the buzzer and the LED display, etc. Using the LED on / off combination to indicate the fault circuit, the self-test coverage rate is more than 90%, which greatly improves the efficiency of production and maintenance work.

The decoding and card reading module is mainly responsible for driving the inductive card to read and write IC, and decodes the Manchester code data it returns. Increasing the speed and success rate of decoding is the difficulty of compiling this module. After successful decoding, the decoding and card reading module transmits the read data on the card in the form of binary code to the data verification module for processing. The latter checks based on the current time and the setting data stored in the serial memory, confirms whether it is a valid card, and then decides whether to unlock, and completes operations such as writing unlock records and replacing old cards with new cards.

The communication module is responsible for controlling the communication with the hand-held POS machine. The POS machine is used to set important parameters such as the room number, start time, end time, card reading password, and current time of the door lock, and upload the unlocking records stored in the lock. In order to pass it to the computer for statistical analysis. In order to prevent illegal operations, password verification is required during communication.

(4) Low power consumption technology

Due to the use of battery power supply, low power consumption must be well solved when designing intelligent electronic door locks. In static state, the average current should be kept at about 25μA, so that the service life of 4 No. 5 alkaline batteries can generally reach more than 1 year. To this end, we take the following measures:

①Select PIC16F73. In sleep mode, if the I / O port status is set properly, the battery can be controlled at about 1μA.

② Reduce the crystal frequency as much as possible. Because the PIC16F73 uses an advanced RISC structure, it can work steadily even when the crystal frequency is low, and provide sufficient processing power.

③Extend sleep time as much as possible and shorten working time. To this end, infrared detection technology is used. The MCU is in a sleep state with extremely low power consumption for more than 99% of the time. Most circuits such as card reader ICs also stop working. Only the infrared detection circuit emits infrared signals at regular intervals. If there is no object close, the receiving circuit will not receive the infrared signal, and the MCU will continue to sleep; if the object is close, the receiving circuit will receive the reflected infrared signal, and immediately notify the MCU to read the card. It is very important to deal with the relationship between the sensitivity of the infrared detection circuit and the anti-interference ability. If the sensitivity is too low, the phenomenon of slow card reading reaction will occur; if the anti-interference can be insufficient, the infrared rays in various lights or sunlight may cause false triggers , So that the system is always in a working state, will seriously affect system performance.

④Adopt the power circuit that can be controlled by MCU. When some circuits are not working, the power supply is stopped, and the power supply is waited until work is needed; for some circuits, the power supply voltage can also be reduced to achieve the purpose of saving electricity.

(5) Safety and reliability

The problems that the door lock system needs to solve in terms of security are: to prevent the door card from being illegally copied; to prevent the lock from being unlocked in an abnormal way (if the tool is dialed, pryed, and attracted with a strong magnet, etc.); .

In order to prevent the door card from being illegally copied, each card is encrypted before leaving the factory, and different customers use different passwords. The card issuing management software is also protected with a password to prevent unauthorized personnel from using the card issuing management software to illegally make cards. Due to the use of a three-lock anti-dial lock core, when the door is closed, the anti-dial lock is pressed by the door frame and automatically locks the main lock. It cannot be pulled or pryed off with a tool; the clutch mechanism driven by the motor has an anti-strong magnet attraction function; the lock system No screws are exposed on the front lock body, preventing folding and smashing.

The reliability of the door lock system is also very important. We improve the overall reliability of the system from two aspects of hardware design and software design. In terms of hardware, the main processor PIC16F73 we selected has high anti-interference ability, and it contains a "watchdog (WDT)" circuit with an independent RC oscillator. It can automatically reset the CPU when the program runs away and restore it. Normal operation; use hardware write-protection measures for the EEPROM that stores important data to avoid data loss when it is disturbed; try to use chip components, strictly conduct aging screening, and ensure component quality PCB wiring, take a series of measures to improve anti-interference ability.

In terms of software design, we refresh each register and SRAM cell, even if these registers or SRAM cells are modified by interference, they can be restored immediately. In the program, avoiding dangerous program structure is also an important measure to improve reliability. There are several loop structures that are easy to cause "dead loop" hidden string people. For example, when performing a function, you must wait for a condition caused by an interrupt or a timer; because the waiting time may be longer, the loop will Contains the clear WDT instruction, which will not cause problems in the normal process. However, if the content of the PC is disturbed and changes, after the program runs away, it happens to fall into this cycle. At this time, the interrupt or the timer may not be turned on, so the program will cycle and wait for an impossible condition, that is, " Endless loop ". Although this situation has a low probability, it must also be prevented.

In addition, as mentioned earlier, in order to reduce power consumption, the MCU is in a sleep state with extremely low power consumption for more than 99% of the time, and the power of most circuits is turned off. In this state, the anti-interference ability is also strong.

4. Conclusion

The above-mentioned inductive intelligent electronic door lock has been fully tested and practically used in the past year. The results show that the system has reached the design requirements in terms of software and hardware functions, completeness, reliability, and low power consumption. Because at the beginning of the design, it was considered to realize the "one card" application, so the system has good scalability. At present, on the basis of the hotel-type intelligent electronic door lock, a management software that does not require card issuance has been developed. Users can issue cards by themselves. The office electronic door lock and the household electronic door lock system are used independently. , Smart consumer terminal using RS485 bus network, access control / attendance system and other 7 product series. Each product in this product series not only realizes the "one card" in function, but also uses many of the same components. Some products can even exchange circuit boards, reducing the complexity of production and product cost.


Previous: Lite-On Technology Selected as a Member of 2012 DJSI two years in a row, ranked as the Sector Leader of Electronic Component & Equipment

Next: XICOR parts naming conventions



Account Center


Live Chat