Currently, the mainstream products in the anti-theft device market are electronic anti-theft devices, which are divided into one-way anti-theft devices and two-way anti-theft devices. Both of these anti-theft devices allow the owner to control the car through a remote control, while the two-way anti-theft device can feedback the real condition of the vehicle to the owner.
GPS car anti-theft device relies on the global positioning system, which silently transmits the alarm information and the location of the alarming vehicle to the alarm center. Since the car owner cannot directly control the vehicle, the price and usage fee are high, which greatly limits its promotion and application, and it is not widely used at present. GSM car two-way anti-theft device is a rising star of network anti-theft devices. It relies on the global GSM network, and the car owner can directly receive the alarm and control the vehicle through the mobile phone. It has a good performance and price. It represents the development trend of car anti-theft devices and has been favored by customers since its launch.
The car embedded anti-theft system proposed in this paper belongs to the GSM anti-theft system. It does not use the expensive GPS module. The CPU uses the C51 single-chip microcomputer, which has a low market price and has been stable and reliable after many years of industrial application, and has a high cost performance.
2. Time trigger mode
Electronic control systems are generally real-time systems that often need to process input data from many concurrent events. The order and probability of the arrival of these events are usually unpredictable, and the system must respond within a pre-set time limit.
When it comes to controlling the complex behavior of a system, the commonly used event-triggered solution is that all the behaviors of the system are executed in response to external events. However, interrupt loss and the overhead of event-triggered systems are often overlooked. In order to meet stringent requirements such as safety, low cost, and as simple a program as possible, the development of electronic control systems ultimately moves towards event-triggered structures. Event triggering means that all actions related to sampling inputs, calculating output results, etc. are executed before the scheduled time, thus ensuring accurate scheduling time.
The time-triggered mode is an embedded software mode that uses the time stamp signal generated by the MCU's hardware timer to schedule multiple tasks. It can be applied to 8-bit 51 series microcontrollers. The time-triggered mode can control the control accuracy to the millisecond level, which is very suitable for real-time control systems. In a time-triggered embedded system, designers can ensure that only one event is processed at a time by carefully arranging a controllable sequence. In addition to improving reliability, the time-triggered mode uses very little memory and CPU resources, and even in small embedded systems, this system structure can benefit from it.
The time-triggered cooperative scheduler is usually implemented through a timer hardware timer. Most tasks are time-triggered, which also means that there are no other forms of interrupts except timer interrupts. The hardware timer will be set to generate a periodic interrupt signal, and the frequency of this periodic interrupt signal can reach 1KMz.
The main function of the time-triggered cooperative scheduler is to wake up the task that is to be executed at a predetermined time. During operation, the scheduler checks the static task list and determines whether there is a task to be executed based on the task cycle. If there is, the task is executed immediately; after the task is executed, the task list is checked again and the previous process is repeated. After completing the list check, the CPU can enter the sleep state and wait for the arrival of the next clock beat. Its task scheduling mechanism is shown in Figure 1. Since the cooperative scheduler can ensure that only one task is triggered in the system at the same time, and it can be guaranteed that there is a task executing in the system at any time. In this way, the efficiency of the system is improved.
The main reason why cooperative schedulers are reliable and predictable is that only one task is active at any time, and this task runs until completion, and then returns control of the CPU to the scheduler. If preemptive scheduling is used, there will be multiple active tasks performing "context switching" and "critical section protection", which will increase the system overhead. Many studies have shown that cooperative schedulers have many advantages over preemptive schedulers. [page]
3. System Overview
3.1 System Function Analysis and State Transition Diagram
After demand analysis, we defined the functions that the system should implement as follows:
1) The system will monitor the status of the car engine;
2) The system can accept the settings of the mobile phone user and set the mobile phone number;
3) If the system alarm is turned on, when the car starts, an alarm will be sent to the designated mobile phone user through the wireless module;
4) The system receives SMS messages from mobile phone users to cut off fuel and power supply to the car;
5) The system receives SMS messages from mobile phone users and can report the location of the car, which can be accurate to the wireless cell in the urban area;
6) The system will take certain measures to ensure the stability of the system.
The above target functions are also indicators for measuring system design. In the following design, we will use tools such as finite state machines to further refine each function until the system's hardware and software design is completed.
Based on the analysis of the system workflow, we can further design the system state transition diagram (Figure 2), from which we can clearly see the system workflow.
3.2 System Module Composition
Modular design methods are often used in embedded system design to reduce development difficulty, reduce the coupling between various parts, and enhance the stability of the system. As shown in the figure, the entire system is mainly composed of CPU, sensor, RS232 interface and GSM module. The CPU is the core control part of the system, responsible for receiving signals from each module, processing, and controlling other modules; the sensor detects that the car is started; the GPRS module is used to send and receive text messages, and communicate with the CPU through the RS232 interface to the owner's mobile phone; the electronic switch circuit is used to control the car circuit system, which can achieve the purpose of cutting off the oil and power of the car.
3 System hardware
1) The AT89S52 microcontroller produced by Atmel is used as the processing core. The processor has 32 I/O ports, 3 timers, and supports up to 8 interrupts. Because the 256B on-chip RAM resources are not enough, the system uses an extended 64KRAM. In addition, the 8K on-chip flash of AT89S52 is sufficient for the system. The processor can support different power consumption modes and is suitable for occasions that are sensitive to cost and power consumption. [page]
The CPU is connected to an AT24C01 EEPROM as a data storage device to store information such as the owner's phone number. The AT24C series serial E2PROM has an I2C bus interface function, low power consumption, and a wide power supply voltage (2.5V to 6.0V depending on the model). The operating current is about 3mA, and the static current varies from 30μA to 110μA depending on the power supply voltage. The system uses the P2 port to simulate the I2C bus and connect to the E2PROM. This method can simplify the circuit and reduce costs compared to hardware implementation of the I2C protocol.
The AT89S52 chip provides a built-in watchdog. We must set the watchdog register within a certain time period. If it is not set in time, the watchdog will reset the system.
2) Each terminal needs to be initialized before use. This setting is done through the serial port, and the terminal device is initialized by reusing the serial port connected to the GPS. The communication protocol and the specific content that needs to be configured need to be defined.
3) The terminal is installed in a relatively hidden place in the car and is powered by the car power supply. The main functions of the terminal are to receive and process GPS signals, report alarm data, receive and process central control commands, and execute commands.
4) The GPRS module uses the French WAVECOM company Q2406B, with an upload rate of up to 2618 kbit s/s and a download rate of up to 5316 kbit s/s. There are two options for the GPS module:
a) Directly select the GPRS MODEM with serial port connection.
b) Select the design method of built-in GPRS module plus antenna.
The first method can reduce the difficulty of development and maintenance, and is easy to install, but the cost is relatively high. The second method requires designing related circuits on hardware, which is more difficult to develop, but it can reduce costs.
5) The wheel speed sensor is also called a wheel speed sensor or a rotation speed sensor. It can measure the number of gear rings that rotate together with the drive shaft, and then generate an AC signal that is proportional to the wheel speed. The wheel speed sensor signal is converted into a digital signal through the ADC circuit and transmitted to the CPU for interpretation.
3.4 Task Design
Through the analysis of Figure 2 and system functions, we divide the system software into multiple tasks. The task name, task cycle, execution time and other information are listed in Table 1.
Among the tasks listed in the table, Task1 queries the buffer every 1ms. If there is information that needs to be sent or received, it is sent or received immediately through the serial port. The string stream received by the serial port is stored in the buffer and handed over to Task2 for processing. Task2 has a cycle of 1s and is responsible for the encoding and decoding of PUD text messages, the recognition of commands and the sending of control signals. It is the most resource-consuming task in the system. Task3 is executed every 10s. It judges the signal collected by the vehicle speed sensor. If an alarm is required, the message is sent to Task2 for processing. Task4 detects the message every 48ms and completes the sending of the vehicle control signal. Task5 sets the watchdog in less than 16383 CPU machine cycles (here, the cycle is 12ms) to ensure the normal operation of the system.
According to the principle of cooperative scheduler and the cycle of each task, the timer is set to generate a periodic interrupt signal every 1 ms. Because the execution time of multiple tasks exceeds 1 ms, Task1 cannot be executed at the specified frequency. Therefore, the method of directly including Task1 into the timer interrupt service subroutine is adopted, so that the cycle and execution time of all tasks can meet the requirements of system task schedulability.
The use of event-triggered mode in engineering will greatly increase the complexity of the system and lead to a huge code structure. Such code length and complexity are not suitable for ordinary developers to build, and commercial real-time operating systems are often expensive and require a large operating system overhead. Using a system developed based on a time-triggered mode can meet engineering requirements such as real-time, simplicity, and predictability. It can also be seen in the application examples that for tasks with a large difference between the task cycle and the execution time, in order to meet the requirements of schedulability, the method of adding short tasks that need to be executed frequently to the timer interrupt service subroutine prolongs the interrupt processing time and weakens the system's real-time response capability and predictability. In addition, the task schedulability can also be met by decomposing tasks with long execution time into several tasks with short execution time. Compared with the event-triggered mode, the time-triggered mode has higher requirements for engineering and technical personnel.
4. Conclusion
Through the design of software and hardware, the car anti-theft system realizes real-time monitoring and alarm of the car, and can realize hardware anti-theft function. Embedded systems have been widely used in automotive electronics. How to integrate the original resources of the car and design powerful and practical applications will be the goal of future automotive embedded development.
Previous article:Design of low frequency ultrasound transdermal instrument
Next article:Design and Proteus simulation of multi-channel servo control PWM generator
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
- Let’s talk about the “Three Musketeers” of radar in autonomous driving
- Why software-defined vehicles transform cars from tools into living spaces
- How Lucid is overtaking Tesla with smaller motors
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- EEWorld invites you to dismantle (fifth issue) - Gosund CP5 Pro smart power strip dismantling report
- Is the vibration direction and wave propagation direction similar to the rhythm of the Humen Bridge?
- How to get started with Renesas MCU?
- Shanghai ACM32F070 Development Board Review 1. Unboxing
- Strange crash problem of STM32G series timer TIM7!
- Watch the video to win a JD card | Taixiang's actual test of Shui Ge's secrets [Second issue]
- How to choose MCU in applications running at high temperature
- EEWORLD University Hall ---- 2019UDE on-site report: Appotronics leads laser display to a new peak
- SK Hynix only pays 17 months' salary as year-end bonus, sparking employee dissatisfaction
- Microcontroller Program Outsourcing: Urgently need help to write an MCU to control the RF chip to send and receive