Abstract: This paper mainly introduces the specific design of the hardware and program implementation process of the infrared remote control password lock based on the AT89C51RC single-chip microcomputer. The paper gives the design circuit of the infrared transmitter and infrared receiver, as well as the typical design circuit part of the electronic password lock and the specific application method, and through a detailed study of the transmission and reception of infrared signals, a method and circuit for accurately decoding remote control signals are designed.
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.
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 supply, and then stabilize it to 5V through 7805 for the microcontroller to work. The fixed three-terminal voltage regulator 7805 is composed of output pin Vo, input pin Vi and ground pin GND. Its voltage regulation value is +5V. It belongs to the LM78XX series of voltage regulators. The input terminal is connected with a capacitor for further filtering. The output terminal also needs to be connected with a capacitor to improve the instantaneous impact of the load, and the stability of the circuit is also better.
2.1.2 Design of infrared receiver and LED display
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.
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.
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.
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.
Reference Summary
[1] Lin Shenmaopian, “8051 Single-Chip Microcomputer: A Thorough Study of the Basics”, Posts and Telecommunications Press, July 2003, 24-153.
[2] Zhao Guanglin, “Protel 99SE Circuit Design and Production”, Publishing House of Electronics Industry, 2005.8, 15-342.
[3] Feng Yaohui et al., “Introduction and Improvement of PowerPCB 5.0”, Posts and Telecommunications Press, 2004.6, 17-48.
[4] Kang Huaguang et al., Fundamentals of Electronic Technology, 2nd edition, Higher Education Press, 2004.7, 10-156.
[5] Hu Kai, Zhang Yingchao. Design of biochemical analyzer and its communication with PC[J]. Microcomputer Information. 2006, 22(4-1): 208-209
[6] Ma Hongwen. Design and implementation of automatic storage cabinet based on AT89C52 single chip microcomputer[J]. Microcomputer Information, 2006, 22(1-2): 101-103.
Previous article:Design of an intelligent anti-theft, fire prevention and lighting control system
Next article:Design of GSM Home Security Alarm System Based on ATmega16
- Popular Resources
- Popular amplifiers
- Mir T527 series core board, high-performance vehicle video surveillance, departmental standard all-in-one solution
- Akamai Expands Control Over Media Platforms with New Video Workflow Capabilities
- Tsinghua Unigroup launches the world's first open architecture security chip E450R, which has obtained the National Security Level 2 Certification
- Pickering exhibits a variety of modular signal switches and simulation solutions at the Defense Electronics Show
- Parker Hannifin Launches Service Master COMPACT Measuring Device for Field Monitoring and Diagnostics
- Connection and distance: A new trend in security cameras - Wi-Fi HaLow brings longer transmission distance and lower power consumption
- Smartway made a strong appearance at the 2023 CPSE Expo with a number of blockbuster products
- Dual-wheel drive, Intellifusion launches 12TOPS edge vision SoC
- Toyota receives Japanese administrative guidance due to information leakage case involving 2.41 million pieces of user data
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- High salary recruitment of visual software engineers
- Manchester encoding implementation of high-speed communication interface between multiple modules in industrial control applications is suitable for EtherCAT module communication
- 【Silicon Labs Development Kit Review】+ Experience the graphical configuration tool and run USART functions
- 【GD32L233C-START Review】 LCD5110 display driver
- Circuit short circuit protection burns out DC-DC, output 12V changes drastically to around 28V, green is the flip protection signal
- SHT31 evaluation + try to read sensor I2C bus data
- CircuitPython 5.0.0 RC0
- Linux calls dirent structure compilation error solution
- EEWORLD University ---- Matlab Machine Learning
- How embedded hardware and software systems work