Design of an Embedded Car Monitor Based on GPS Positioning
2026-04-06 07:36:49··#1
With the improvement of people's living standards, cars have gradually entered ordinary households, and the number of cars in major Chinese cities has been increasing year by year. At the same time, car theft and robbery have become a serious social problem. Although the application of various car anti-theft/alarm devices has solved the car security problem to some extent, with the improvement of thieves' methods, most alarms are easily and quickly destroyed. Car alarms often involve flashing lights and honking horns, which may not reach the car owner, but severely disturb nearby residents. Furthermore, thieves can destroy alarms, steal cars, and then slightly modify their appearance, making the car disappear without a trace. To solve these problems, this design uses GPS monitoring to track the car's location. In the event of a theft, the GPS location can be sent to the car owner or the police via a GSM SMS module at any time, speeding up the investigation. Figure 1: System Function Diagram This monitor differs from ordinary car anti-theft devices; it does not provide functions such as sound and light alarms or car circuit cutoff upon theft. It is essentially a tracker with alarm functionality, using GPS positioning to determine whether the car has been stolen. After confirming a car theft, the vehicle's location information can be sent to the police via GSM SMS at any time. This type of monitor supplements general car anti-theft devices; it is difficult to detect, cannot be removed in the short term, and has high positioning accuracy (around 10 meters). The system functions of the entire monitor are shown in Figure 1. The monitor is installed in a concealed location within the car and is normally powered by the car battery. When the car's power is cut off, it automatically switches to independent battery power. The GPS receiving antenna is located outside the car for better signal reception. The basic operation of the monitor is as follows: when the car is in normal driving, the monitor is in a power-saving sleep state. When the car stops and the owner leaves, the owner can send an SMS to the monitor to command it to enter monitoring mode. At this time, the monitor's GPS receiving function is activated, periodically receiving position, speed, and altitude information from GPS positioning satellites, while marking stationary locations as safe locations. When a thief breaks the car's general anti-theft system and drives away, the GPS-received location coordinates change. When the speed or position deviation exceeds the set alarm value, the monitor will automatically send an alarm message to the owner's mobile phone, indicating that the car has been moved and may have been stolen. After the car owner reports the theft, to assist the police in locating the stolen vehicle, the owner can send another command to the monitor to activate the timed SMS sending function. This will periodically send the current car coordinates to the owner or the police center. Combined with an electronic map, the car's location can be easily found, facilitating rapid case solving. The system's included SD card can store the car's changing coordinates and other information for an extended period after an alarm is triggered, serving as evidence in the case and as clues to locating accomplices. System Hardware Design To achieve the monitoring function, the monitor is required to have GPS reception, GSM SMS sending, and large data storage capabilities, as well as some multitasking capabilities, low cost, and small size. The hardware structure of the monitor is shown in Figure 2. Figure 2. Hardware Structure Diagram of the Monitor. A suitable main chip plays a crucial role in the system; this monitor uses the FS7821LQ embedded chip. The FS7821LQ integrates a RISC-based 8051 core, a USB 2.0 controller, a transceiver, NAND flash memory, and SD and CF interface controllers. Embedded systems built using this chip offer simple external circuitry, powerful functionality, and low cost, perfectly meeting the requirements of this design. The monitor's SMS function primarily receives SMS commands from the vehicle owner and sends GPS location data. The system utilizes a mature GSM-RTU SMS module. This module embeds a GSM module, a 16-bit low-power MSP430 microcontroller for control and management, and features a telemetry and remote control core unit, a configurable standard serial port (RS-232C), a standard antenna, and a SIM card interface. After inserting the purchased SIM card into the SMS module and completing the system setup (including the service phone number), connect the serial port of the SMS module to the serial port 1 of the monitor (with an external level conversion chip to conform to the RS-232C level standard). This completes the hardware installation of the SMS module. The GPS module mainly receives GPS data from the car. The system uses the MG-30U/R-GPS module, employing a second-generation high-efficiency SiRF chip (with 12 channels, capable of receiving signals from up to 12 GPS satellites) for comparison and calculation. It can display speed, location, altitude, and other relevant data, offering low cost and high accuracy. The module output can use an RS-232C interface, connected to the GPS module via serial port 2 of the system's main control chip, FS7821LQ. Because the amount of data transmitted is small, using serial port data transmission avoids the hassle of creating a main USB port on the system when using a USB interface. Figure 3 shows the circuit design diagram of the system hardware. The FS7821LQ has a complete SD card driver and interface, allowing the system to directly connect to a 128Mb SD card. Two serial ports are formed using the general-purpose I/O ports PORT2_0 to PORT2_3 of the FS7821LQ chip. After adding a MAX232 level converter chip, these are connected to the GPS and GSM modules respectively. The FS7821LQ chip includes a USB interface function and hardware driver; a USB 2.0 interface is reserved in the system for product upgrades. In addition, the system also reserves 10 general-purpose I/O ports of the FS7821LQ as control ports for subsequent alarm functions. Figure 3 shows the system hardware circuit design and system software design. Since this monitor includes several complex functions, including bursty functions such as SMS sending and receiving and timed tasks such as GPS reception, the UE/OS-II operating system is ported to the embedded system to better complete task execution. UE/OS-II, as a free and open-source real-time embedded operating system, provides multi-task switching capabilities, interrupts, UART drivers, and other functions, fully meeting the requirements of this operating platform. As a basic task scheduling kernel, OS-II only has the ability to switch tasks. According to its functions, this monitor can be divided into 4 tasks as shown in Table 1: the main task has the highest priority (10); the SMS sending and receiving task has the second highest priority (12), which mainly includes the SMS receiving function (including setting and turning the monitor on and off) and the SMS sending function (sending GPS coordinates once every 5 seconds when an alarm occurs). The timing of this task is highly random and has high real-time requirements; the GPS receiving task receives GPS data once every 5 seconds and parses its coordinates to determine whether an alarm has occurred; the data storage task stores GPS coordinates once every 60 seconds after an alarm (a 128Mb card can store about 1 month's worth of data). Because the monitor uses USB devices and SD cards, in addition to having hardware interfaces, USB and SD drivers must be provided in the software. The development kit for the FS7821LQ chip provides USB drivers and SD/MMC card drivers, including support for standard MMC card commands; embedded 5B command memory; embedded 17B response memory; support for 1/4/8-bit data width; and support for a 20MHz clock frequency for the card. In order to save GPS data to the SD card as a file, a PC-compatible file system is required. This monitor successfully ported the simplified FAT16 file system, realizing free access to files. After porting the MG-30U/R-GPS module and embedding the drivers for USB and SD/MMC cards, the software installation system of the monitor's application layer is divided into multiple tasks with different priorities. The main task is used to generate other tasks, and its priority is the highest (10); the GPS receiving task is responsible for controlling the MG-30U/R-GPS module and obtaining the required GPS data from it, and its priority is the second highest (12); the SMS receiving task completes the function of receiving SMS messages from the car owner and sending GPS data, and its priority is the next highest (14); finally, the data storage function completes the function of storing GPS in the SD card and setting the system, and its priority is 16. A message queue is also established in the program to complete the communication and data exchange between the tasks. The software state flow diagram is shown in Figure 4. Figure 4 Software State Flow Diagram Development and Prospect This embedded car monitor design adopts a large number of mature technologies and modules. Its primary application is to issue warnings when a car is stolen and to provide accurate vehicle location information after theft. While it cannot replace traditional car alarms, it offers highly practical anti-theft functions, providing fast and accurate information for locating stolen vehicles. With technological advancements, the integration of the controller and main controller in GPS/GSM systems will inevitably become the future trend, further reducing costs and size. Simultaneously, this monitor can also be integrated with general car alarms, developing into a more comprehensive system.