Implementation of a two-way remote control door lock system for automobiles
[Copy link]
Introduction Car remote keyless entry (RKE) has become an indispensable part of cars. RKE is of great significance to improving the anti-theft and controllability of cars. The one-way RKE system designed in the past consists of a control end and an execution end. The biggest inconvenience of this system is that only the user sends information to the car door, and the car door cannot feedback its own information to the user, which makes it impossible for the user to know the status of the car, which brings hidden dangers to the safety of the car. In addition, since the system is powered by a battery, reducing power consumption is also a relatively large problem. In order to solve these two problems, this paper designs a two-way RKE system based on the wireless transceiver chip nRF9E5 and the LCD chip 12864-12. Figure 1 Bidirectional RKE system composition Figure 2 Schematic diagram of nRF9E5 and dot matrix LCD interface Figure 3 Host computer transceiver program flow Figure 4 Flowchart of the lower computer transceiver program
nRF9E5 function introduction nRF9E5 is a system-level RF chip launched by Nordic. It has a built-in nRF905 433/868/915 MHz transceiver, an 8051 compatible microcontroller and a 4-input 10-bit 80ksps ADC. Its built-in nRF905 transceiver is the same as the transceiver of the nRF905 chip, and can work in ShockBurst (automatically processing prefix, address and CRC) mode. The built-in voltage adjustment module suppresses noise to the maximum extent and provides the system with an operating voltage of 1.9~3.6V.
The on-chip microcontroller of nRF9E5 has a serial port that is the same as 8051, and timer 1 and timer 2 can be used as baud rate generators for asynchronous communication. The microprocessor contains 256B of data RAM and 512B of ROM. In addition, 2 data pointers are extended to facilitate reading data from the XRAM area. After power-on reset or software reset, the processor automatically executes the code in the ROM boot area. The user program is usually loaded from the EEPROM into a 4KB RAM under the guidance of the boot area. This 4KB RAM can also be used to store data.
The nRF9E5 chip integrates a transceiver, which can communicate with other modules through the internal parallel port or internal SPI, and has the same functions as the single-chip RF transceiver nRF905. The transceiver communicates with the microcontroller through the parallel port or SPI on the chip. The nRF9E5 transceiver consists of a complete frequency synthesizer, a power amplifier, a regulator and two receivers. The output power, channel and other RF parameters can be controlled by programming the special function register RADIO (0xA0). In the transmission mode, the RF current is 11mA and in the reception mode it is 12.5mA. In order to save energy, the on/off of the transceiver can be controlled by the program. Two-way RKE system hardware composition The two-way RKE system consists of two parts: the data terminal and the main transceiver. The data terminal is carried by the user and can be understood as a remote control key, while the main transceiver is installed in the car door and is used to open the car door. The data communication between the data terminal and the main transceiver is carried out through nRF9E5. Since nRF9E5 has a built-in microcontroller and the amount of data transmitted is not large, there is no need to add an additional microcontroller or expand other memories in the RKE system, making the system hardware structure very simple. The entire two-way RKE system is shown in Figure 1.
The main transceiver and the data terminal can be connected to the PC through the RS-232 or USB interface, and the communication between the PC and the nRF9E5 can be realized. In this way, the characters (alarm information) to be displayed by the data terminal can be written into the memory of the data terminal in ASCII form through the PC. When the car needs to alarm, the data terminal will bring out these alarm information and then display them through the LCD. At the same time, all commands can be pre-solidified into the hardware through the PC, and then the user only needs to operate the buttons in his hand to realize the two-way transmission of data.
In the user-side data terminal, since the LCD used is a 4-bit dot matrix liquid crystal display, the control and driver inside this display module are composed of CMOS circuits. CMOS circuits are low-power devices, and nRF9E5 also uses CMOS structure, so the drive circuit between the single-chip microcomputer and the display module can be omitted, and the two can be directly connected. Its hardware interface connection is shown in Figure 2. According to the interface in the figure, when powered on, the LCD automatically resets to an 8-bit data bus and a single-line display mode, and the left 8 bits of the display are lit and the right 8 bits are off. In the initialization program, the LCD must be set to a 4-bit data bus and a double-line display mode with instructions, so that the left 8 bits and the right 8 bits of the display are both in working state.
In addition, for nRF9E5, its biggest advantage is that it has a carrier detection function. When the transceiver is ready to send data, it first enters the receiving mode and detects whether the channel it is working on is idle. The standard for carrier detection is generally 5 dBm lower than the sensitivity. For example, if the sensitivity is -100 dBm, the carrier detection function detects a carrier as low as -105 dBm. That is to say, when the carrier is lower than -105 dBm, the carrier detection signal is low (usually 0); when it is higher than -95 dBm, the carrier detection signal is high (usually VDD); between -105 and -95 dBm, the carrier detection signal may be low or high. This feature avoids the collision between data packets of different transmitters at the same operating frequency and effectively prevents signal interference. It improves the stability of wireless key transmission and reception.
In addition, a simple buzzer needs to be added to the system. When the system needs to alarm, the buzzer sounds, and the alarm information will be displayed on the LCD. System software design communication protocol To realize the locking/unlocking and security alarm functions, wireless data communication between the data terminal and the main transceiver must be completed. All parts of the entire system serve the purpose of wireless data transmission. Therefore, in the software design of the entire system, the transmission of wireless data is the most important part. Wireless transmission is carried out in the form of data frames, and the format of the data frame is shown in Table 1.
The leading code is mainly used to prevent useful data from being interfered; the ID is mainly used to mark the information of a specific car for correct identification. If the ID does not match, the data frame will be ignored; the information code is used to indicate the user's operation, which includes locking, unlocking, displaying alarms, etc. When the user sends the corresponding command, locking and unlocking are executed respectively, and when the user exceeds the transceiver range, the main transceiver can automatically send a warning message; the check code is used to check whether the received data is correct. If it is incorrect, the data frame needs to be resent.
Software process Since the communication between the data terminal and the main transceiver is duplex, the data transmission direction is constantly changing during the actual system operation. To this end, in order to achieve coordinated communication between the two parties, a more suitable transceiver order must be designed. In order to better illustrate the program flow, the data terminal on the user's side is defined as the upper computer, and the main transceiver in the car is defined as the lower computer. The upper computer and the lower computer transceiver process are shown in Figure 3 and Figure 4. Conclusion The wireless data transmission part of the two-way RKE system composed of nRF9E5 does not require an external microcontroller or an external memory expansion; when connected to a dot matrix LCD, no external driver is required, which greatly reduces the complexity of the system. In addition, the system uses modules with low energy consumption, which to a certain extent achieves the low power consumption requirement of the system. The two-way RKE system designed in this paper can improve the security of data transmission, and the display can more intuitively reflect the status of the car. However, the system also has imperfections. If a DAC is added to the system and a speaker is added, the information of the car can be fed back to the user more intuitively. In addition, if a pressure sensor is added to the car door, it can greatly prevent the car from being damaged by human beings and further improve the safety of the car.
|