Design and implementation of infrared remote control password lock based on AT89C51RC

Publisher:阳关三迭Latest update time:2011-09-16 Keywords:AT89C51RC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1 Introduction

According to the requirements and needs of users, this infrared remote control password lock system is designed mainly to solve the problem of no remote control password lock in the current market, to improve the reliability and security of the access control system, and to meet the needs of the market. This system has the functions of ordinary electronic password locks and also adds remote control functions. The lock uses 6 digits as the password, and the total password group has 106 groups, which fully meets the user's high requirements for password security. The system has strong practical application value, and the technologies involved include: infrared carrier data transmission technology, single-chip microcomputer control technology, infrared remote control system encoding and decoding technology, circuit design and demonstration board production technology, etc.

2 System hardware design and implementation (unit circuit design)

2.1 Hardware structure diagram:

The system is based on the single-chip microcomputer AT89C51RC. The system structure diagram is shown in Figure 1. The functional design goals of this system should include the following aspects: infrared transmission function module, infrared receiving conversion module, single-chip microcomputer module, buzzer alarm function module, LED digital tube display module, key function module, unlocking function module, etc. The following is a detailed introduction to the hardware circuit of each unit and the functions it realizes.

Figure 1 Infrared remote control password lock hardware structure diagram

2.1.1 Power supply design

The power supply of this system uses LM7805 chip to provide 5V voltage to the microcontroller after voltage stabilization. The design of the power supply circuit is shown in Figure 2.

Design and implementation of infrared remote control password lock

Figure 2 Schematic diagram of the infrared remote control password power supply

The power supply circuit uses four 1N4004 diodes to form a rectifier bridge. It can input DC or AC 9V power, and then stabilize it to 5V through 7805 for the microcontroller to work. The fixed three-terminal voltage regulator 7805 is composed of the output pin Vo, the input pin Vi and the ground pin GND. Its voltage regulation value is +5V. It belongs to the LM78XX series of voltage regulators. The input terminal is connected to a capacitor for further filtering. The output terminal also needs to be connected to a capacitor to improve the instantaneous impact of the load, and the stability of the circuit is also better. 2.1.2 Design of the infrared receiving head and LED display part

The infrared signal receiving part is realized by using KS38BL infrared receiving head, and its circuit is shown in Figure 3. Figure 3 is a simple circuit of the infrared remote control signal receiving head, which can receive remote control signals with carrier frequencies ranging from 33 to 57KHz. The 100Ω resistor plays a role in current limiting, and the 470uF capacitor filters to reduce interference. By touching the signal output terminal (OUT) of the infrared receiving module with a logic pen, it is possible to detect the emission of infrared digital signals when a certain button of the infrared remote control is pressed. If an infrared digital signal is emitted, the digital signal data is taken out through the infrared receiving module, and the logic pen pulse LED will flash. This is the simplest way to detect whether there is currently an infrared signal emission.

Design and implementation of infrared remote control password lock

Figure 3 Infrared receiving part

As shown in Figure 4, the system display is an 8-bit stable static display implemented by MAX7219. MAX7219 is a serial common cathode digital tube dynamic scanning display driver chip. It only uses a 3-wire serial interface to transmit data and can be directly interfaced with the microcontroller. Users can also easily modify its internal parameters to achieve multi-digit LED display. Therefore, the serial port of the microcontroller can be used to send display data conveniently. It takes less time and is convenient for programming and signal detection.

Design and implementation of infrared remote control password lock

Figure 4: Display design using MAX7219

2.1.5 Circuit design of password storage part

In order to save the password set by the user, the system uses AT24C04 to save the password set by the user. The P3.6 of the single-chip microcomputer AT89C51RC is connected to the SCLK port of AT24C04 as its serial shift clock, and the P3.7 of AT89C51RC is connected to the SDA port of AT24C04 as its serial data or address input and output. It should be noted that SCLK and SDA must be connected with an upper resistor with a resistance of 10K. The password set by the user is stored in AT24C04. When the user password needs to be changed or read, only the data in AT24C04 needs to be changed or read. Since the main chip AT89C51RC does not have an I2C bus, this system uses a software program to simulate the I2C bus timing to complete the connection between AT89S51 and AT24C04.

2.1.6 Alarm circuit design

The system is designed with anti-theft in mind and an alarm circuit is designed. The buzzer sounds to alarm. The buzzer is connected to the CPU pin P0.4 and amplifies the current through the PNP transistor. Therefore, the frequency and duration of the buzzer can be controlled by the single-chip microcomputer. When the wrong password is entered to unlock the door, the system will alarm. The P0.4 port outputs a low level to turn on the PNP transistor, and the two ends of the buzzer are powered. The buzzer emits a 1-second alarm sound. When the password is wrong three times in a row, the system will alarm for a long time. This is to prevent others from illegally trying to unlock the door.

2.1.7 Circuit design for selecting local processing and remote control processing functions

This system is designed with a self-locking button to select local processing or remote control processing. When setting the password, it must be in the local processing state, and you can choose to unlock by remote control or local unlocking. When this button is pressed, the red light is on to indicate that local processing is selected. At this time, you can set the password, modify the password, and unlock the machine, but not the remote control; when this switch is not pressed, the red light is off and remote unlocking is selected. At this time, you can enter the password through the remote control to unlock, but you cannot unlock the machine or set the password during remote unlocking.

3 System Software Design

This system has two working states: remote control processing and local processing. The two working states are independent of each other. The current working state can be selected through the self-locking switch K. When K is closed, local processing is selected, and when it is disconnected, remote control processing is selected. The remote control processing part only has the unlocking function, so the design is relatively simple, while the local processing part can realize all functions such as unlocking, setting and modifying passwords.

To complete the functions of this system, we first need to solve the problem of decoding infrared signals and observe their specific waveforms on a storage oscilloscope, which requires understanding their encoding rules. A frame of code transmitted by general encoding contains a guide code, a user code and a key data code. The guide code consists of a longer carrier waveform and a period of off time, which serves as a guide for the subsequently transmitted code. The user code and key data code are strings of specified lengths composed of logic "0" and logic "1".

Logic "0" and logic "1" are represented by different combinations of high and low levels. Then, the two timing counters of the microcontroller can be used to count the high and low levels. Specifically, when the microcontroller detects the first low level, the timing counter T0 starts counting immediately. When the high level is detected, T0 stops counting and T1 starts counting again. While T1 is counting, the count of T0 is saved. When the low level appears again, T1 stops counting and T0 starts counting again. While T0 is counting, the count of T1 is saved. In this way, there is a set of low and high combinations. By judging which range this combination belongs to, "0" or "1" can be decoded, and the cycle is repeated until all bits are decoded. In this way, we can command the microcontroller system to complete the corresponding operation according to the decoded value. It should be noted that only the key data code is involved in the decoding, and the customer code is specified in advance (by a company or individual).

The design of the software part is based on assembly language and adopts modular design ideas. With the main program as the core, many functional module subroutines are set up. It is the main process in which a large number of functions are realized in the subroutines, as shown in Figure 5.

Design and implementation of infrared remote control password lock

Figure 5 Main flow chart

The software workflow includes 6 parts: system initialization, AT24C04 read and write operations, proofreading and unlocking, error alarm processing, and decoding of received signals. Initialization mainly includes: initialization of MAX7219 chip, interrupt and timer, and initialization of system parameters; the read and write operations of AT24C04 mainly complete the purpose of changing the original password or related settings, and then save the updated password into it. Proofreading and unlocking is to compare the input password with the password stored in the memory. If they are the same, they will pass, otherwise they will enter the error alarm stage. The error alarm mainly handles the situation that the input password and the password stored in AT24C04 are different. If the alarm is entered again after the alarm, the alarm will be triggered again for 3 times, that is, the wrong password is entered 3 times, then the system will alarm for a long time and lock itself for one hour. The decoding part mainly completes the decoding of the signal sent by the remote control in the remote control processing state to obtain the code value corresponding to the corresponding function.


4 Conclusion

The innovation of this article is that in addition to the functions of the traditional fixed keyboard electronic password lock system, that is, the operating keyboard is fixed on the panel of the lock, it also adds the function of remote control, which brings a lot of convenience to people. This is also the fundamental reason why the author developed and designed this system. In this system, unlike the previous use of 74LS164 chip to drive the display of digital tubes, a more powerful multi-functional serial LED display driver MAX7219 is used in this system to achieve 8-bit stable static display. Only three pins of the microcontroller are needed, and the serial port of the microcontroller can be used more conveniently to send display data, and it takes less time, which is convenient for programming and signal detection. At the same time, the power supply part and decoding part designed by this system have been repeatedly tested, proving that the circuit has extremely high stability and decoding accuracy and efficiency.

Keywords:AT89C51RC Reference address:Design and implementation of infrared remote control password lock based on AT89C51RC

Previous article:Multi-computer parallel communication system based on 51 single chip microcomputer
Next article:Design of high-precision PWM 12-bit D/A converter based on single-chip microcomputer

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号