1 Introduction
Vehicles are becoming more and more popular in my country, and the issue of vehicle safety management has received more and more attention. At present, vehicles in many departments and systems in my country lack orderly management, and even present a relatively chaotic situation. For example, in the postal system, the phenomenon of using postal vehicles to smuggle goods is relatively common. In the bus, taxi, passenger transport and other industries, there are also requirements for coordination, management, dispatching, and monitoring of vehicles. The GPS vehicle-mounted positioning system uses the global positioning capability of GPS and the two-way data transmission capability of the existing mobile communication network (
GSM or GPRS) to enable the dispatch center to track and locate vehicles, manage and dispatch, and monitor safety. A typical vehicle-mounted positioning system mainly consists of two parts: the positioning terminal and the monitoring center. Among them, the vehicle-mounted terminal is the key to the design of the entire system. This article introduces the design of the vehicle-mounted positioning terminal in the GPS vehicle-mounted positioning system in which the author participated. The terminal has been applied to a certain extent. This terminal adopts a novel dual-CPU design in design, which effectively solves the problem that the terminal is difficult to run continuously for a long time.
2 System Hardware Structure
The main functions of the vehicle terminal include two aspects. One is the communication function: the terminal can be used to obtain various information from the monitoring center. Most of this information is the command issued by the center to the terminal, and the terminal must be able to respond to the center quickly and give a report; the other is monitoring: after obtaining the command from the center, the terminal must be able to detect the vehicle's condition according to the requirements of the command and control the vehicle when necessary. For the communication function, the terminal is mainly realized through an OEM industrial mobile phone module. The use of this module can not only meet this functional requirement, but also cooperate with a vehicle handle to fully realize the function of a vehicle mobile phone. Users can use the handle to send and receive text messages or make and receive calls at will, and it is not limited to the communication between the terminal and the center. For the monitoring function, most of the information required by the center comes from a global positioning system (GPS) module on the terminal. The module can provide information such as the time, geographical location, speed and direction of the terminal (i.e. the vehicle). The other part of the information required by the center is partly realized by special sensors, such as the detection of the oil level and usage in the fuel tank, and partly by simply implementing an analog signal access port, such as the opening and closing of the door, whether the engine is started, etc. The terminal controls the vehicle by using a set of relays to output different levels. The vehicle terminal designed by the author can also be connected to various existing vehicle anti-theft devices on the market to further enhance the monitoring and control functions of the vehicle. When the functions implemented by the system are slightly more complex, the terminal will also integrate a memory module (usually a FLASH module) to store fixed information and record driving trajectories, and can read and write the memory through an RS232 interface, which can also save communication costs.
Figure 1 Overall structural diagram of the vehicle terminal
The GSM module, GPS module, vehicle handle, anti-theft alarm and FLASH mentioned above can be fully controlled by a high-performance single-chip microcomputer as a controller. The controller controls GSM, GPS and handle through the
UART port, realizes status input and control output through the IO port, realizes interconnection with the anti-theft alarm, and connects to the sensor through the AD channel. It should be noted that most single-chip microcomputers have only one or two serial ports. This system needs three serial ports to control three modules, and a 232 interface must be expanded for FLASH. Therefore, it is necessary to expand the serial port, or program it through multiplexing. The latter is slightly more difficult. This system adopts the latter solution. The solution also uses a small CPU to manage the system controller, which will be explained in detail later in the article.
Figure 1 shows the hardware design block diagram of the vehicle-mounted positioning terminal designed by the author.
3 Hardware Selection
3.1 Controller selection
MSP430F149 is a Flash-based ultra-low power 16-bit microcontroller produced by TI. It has the characteristics of strong processing power, fast running speed, high reliability, etc. It can adapt to industrial operating environments and is particularly suitable for battery applications or handheld devices. In terms of controller resources, MSP430F149 has two UART ports. UART0 is multiplexed for GPS and handles, and the extended 232 interface also uses this serial port. UART1 is used for GSM modules; MSP430F149 also has a 12-bit AD channel to facilitate the design of analog signal interfaces. In summary, we choose MSP430F149 as the main controller of the system.
3.2 GPS Module
The GPS module used in this vehicle terminal is Holux GR-85, which supports NMEA0813 V2.2 data protocol, that is, the output data is ASCII code. For specific meanings, please refer to its application manual. The data output format uses the recommended positioning statement: RMC statement. The positioning statement data contains parameters such as time, longitude and latitude, speed, direction, and whether the positioning data is valid. The refresh frequency of the positioning data is 1Hz.
3.3 GSM Module
The terminal uses Siemens' TC35I industrial GSM module, the interface of which is a 40-pin ZIF connector. Its interface circuit mainly includes power supply and startup circuit, RS232 interface, SIM card connector, voice interface, etc. In addition, the module has a 50Ω antenna connector.
Figure 2 SIM card connection circuit [page]
4 Design points
4.1 SIM card connection
In the system, the TC35I module works at 4.5V. After the system is powered on, a low level of more than 100ms must be applied to the 15th pin (/IGT) of the ZIF connector, and the signal fall time should be less than 1ms, otherwise the module cannot start normally. After startup, the 15th pin should remain at a high level. After startup, the terminal can send AT commands to the module serial port to control the module to implement initialization, short message sending, voice call and other functions. The module provides a SIM interface compatible with the ISO 7816-3 IC Card standard. The additional CCIN pin is used to indicate whether the SIM card is connected. Since the SIM cards currently provided by mobile operators do not provide this signal, CCIN is connected to CCVCC when designing the circuit. Considering the impact on voice quality, the CCGND end of the SIM card is coupled to the GSM ground through capacitors and inductors to provide an isolated ground for the SIM card to shield the impact of other signal lines on the SIM card. Figure 2 shows the connection circuit of the SIM card.
4.2 Dual CPU Design
The GPS terminal works in the vehicle, and the power is taken from the vehicle battery. It is often subjected to great impact when igniting or shutting down. In order to conceal theft, the terminal is often stuffed into the front console of the vehicle or placed deep in the trunk. It is seriously interfered by the electromagnetic interference of the vehicle circuit, and the ambient temperature is also high. In such a harsh environment, certain measures must be taken to ensure that the system will not crash. This system adopts a dual CPU design, and a slave CPU chip manages the MSP430F149. Its functions are: 1 Acting as a hardware watchdog, if it cannot shake hands with the main CPU within a set time, it restarts the system; 2 Manage the power supply of the entire system, the slave CPU can cut off or connect the power supply of other parts of the system; 3 When the system is running for a long time, it will periodically power off and restart the system when the system is detected to be idle, so as to maintain the stability of the long-term operation of the system.
5. System Software Design
5.1 Software Control of Module
The microcontroller controls the GSM module TC35I by sending AT commands to its serial port. Each module has a corresponding AT command set. Send the ASCII code of the specific AT command through the microcontroller UART port. For example, to set the SMS center number AT+CSCA="+8613800731500"To send a short message with the content "ABCD", first set the SMS sending mode to TEXT mode AT+CMGF=1, then send the other party's number AT+CMGS="XXXX (destination number)"After the module returns the correct information, send the text message content ABCDIn this system, except for sending Chinese text messages using the vehicle handle, the PDU mode must be used. In most cases, the sending and receiving of commands and data do not involve Chinese characters, so the TEXT mode is used.
Figure 3 System initialization module
The control of GPS by the microcontroller is not complicated. It only needs to read the positioning data from the module serial port regularly or when needed. The positioning data adopts the default recommended positioning information $GPRMC format statement. The specific form is $GPRMC,<1>,<2>,<3>,<4>,<5>,<6>,<7>,<8>,<9>,<10>,<11>,<12>*hh, where <1> to <12> are information contents, including longitude, latitude, speed, direction, etc., separated by commas, and hh is the checksum of the entire sentence. If the system needs GPS information, it will read the valid information part when it detects the appearance of the RMC sentence.
5.2 Terminal System Software Design
The terminal software design is closely related to the functions implemented by the terminal. The functions designed in this system are relatively complex, and the process followed by the system software is roughly as follows: initialization -> voice function processing -> SMS command reading -> handle command acquisition -> command execution -> vehicle status monitoring -> SMS report sending. That is to say, after the system is initialized, it cyclically detects the use status of the voice channel, the delivery of SMS commands and handle commands. Once it detects the arrival of a voice request (or interrupt request), SMS command or handle command, the system will execute the command and return a report to the center. The execution of some commands may require cyclic execution, such as timing to report location information to the center 500 times per minute, timing to record driving trajectories in FLASH, etc. Therefore, when no command is delivered, the system still continues to execute or terminate the command previously received by the terminal based on the judgment of the status flag. The system is also responsible for monitoring the safety and driving conditions of the vehicle. For example, when the fence function is turned on, the vehicle must report to the center when entering and exiting a fenced area. When the route function is turned on, the vehicle must report to the center once it deviates from the route, and so on. In addition, the terminal must also implement a series of functions that are not easy to express clearly with a simple process. For example, external commands require reading historical trajectory data in FLASH, or external computers write fence and route data to the terminal FLASH. When implementing these functions, the terminal may suspend the execution of other functions until the operation is completed and then continue to execute these functions.
The overall process of the system is too long, so here is one of the modules: the functional flow of the initialization module, as shown in Figure 3.
6 Conclusion
The GPS vehicle positioning system has been applied to a certain extent. This technology, combined with geographic information technology (GIS) and database technology, can realize visual monitoring of vehicles by the monitoring center. The location and various states of each vehicle can be clearly displayed on the center's electronic map. The concept of "visual" is still being further deepened in the future. Terminals equipped with cameras can achieve true visual monitoring using GPRS data transmission technology. In addition, the anti-theft function of the terminal is becoming more and more perfect, and there is a trend of further expansion in the application market of private cars. This design has been widely verified and is feasible. Based on the architecture of GPS-GSM, this article provides an effective, reliable and low-cost solution for the design of vehicle-mounted terminals.
References:
1. Hu Dake. MSP430 Series FLASH Ultra-Low Power 16-bit MCU. Beijing University of Aeronautics and Astronautics Press. 2001
2. Liu Tao, Zhang Chunye, Han Xudong, etc. Single chip microcomputer short message system based on mobile phone module TC35. Electronic Technology. 2003
3. Elliott D Kaplan. GPS Principles and Applications. Publishing House of Electronics Industry. 2001
4. Feng Yue, Li Xiaomin, Feng Zhensheng. Application of GSM technology in GPS vehicle monitoring system. Microcomputer Information. 1999