“In recent years, as an important front-end part of traffic information collection, vehicle detectors have attracted more and more attention from the industry. In view of the development needs of the modernized management of highway traffic and the modernized management of urban traffic, the development of dynamic detection technology of moving vehicles-vehicle detector has attracted great attention both at home and abroad. The vehicle detector takes the motor vehicle as the detection target to detect the passing or existence of the vehicle, and its function is to provide enough information for the intelligent traffic control system to carry out the optimal control.
The toroidal coil, MSP430F1121A single chip microcomputer and output interface are used to form a low-power driving vehicle detection system, which can perform vehicle detection and signal output according to the sensitivity, working mode and output mode preset by the user.
The method of dynamically refreshing the benchmark by software is also applied to improve the reliability and accuracy of detection. Experiments show that the system has the advantages of simple structure, low power consumption and convenient adjustment.
In recent years, as an important front-end part of traffic information collection, vehicle detectors have attracted more and more attention from the industry. In view of the development needs of the modernized management of highway traffic and the modernized management of urban traffic, the development of dynamic detection technology of moving vehicles-vehicle detector has attracted great attention both at home and abroad. The vehicle detector takes the motor vehicle as the detection target to detect the passing or existence of the vehicle, and its function is to provide enough information for the intelligent traffic control system to carry out the optimal control.
At present, the commonly used vehicle detectors mainly include magnetic induction detectors, ultrasonic detectors, pressure switch detectors, radar detectors, photoelectric detectors and video detectors, etc., while the toroidal coil electromagnetic induction vehicle detectors have stable performance. , Simple structure, easy implementation of detection circuit, low cost, less maintenance, wide adaptability and other advantages, the market has the widest range of applications. At present, almost all the vehicle detectors actually used in highways and urban roads in my country are imported from abroad. There are many problems in domestic vehicle detectors, such as high false detection rate, low sensitivity, and poor long-term working stability.
Based on a large number of field experiments, this paper proposes a new solution that integrates stability, sensitivity and high speed, and solves many of the problems mentioned above.
1 How it works
This system uses the method of combining MSP430F1121A single chip microcomputer and toroidal coil to detect the driving vehicle. It is a detector based on the principle of electromagnetic induction. The sensor coil is a toroidal coil with a certain current passing through it. When the detected iron object cuts the magnetic field line through the coil, the coil loop inductance changes, and the detector can detect the existence of the measured object by detecting the inductance change. In this paper, the oscillating frequency is detected by the coupling circuit formed by the loop coil. However, coil detection is easily affected by external environments such as vehicles, humidity, and temperature, and the reference frequency will drift, which will affect the detection effect. At the same time, the accuracy of detection will also be affected due to differences in vehicle models, vehicle bodies, and vehicle speeds. In view of these situations, this paper proposes a software dynamic refresh detection benchmark method and an anti-interference software digital filtering method, which makes full use of the on-chip resources of the MSP430 series microcontroller to detect the coil frequency, which effectively improves the accuracy and reliability of the detection. .
2 System structure and hardware design
2.1 System structure
The system takes MSP430F1121A microcontroller as the core and consists of toroidal coil sensor module, LC oscillation circuit, shaping circuit, frequency selection module, power supply module, voltage monitoring module, working mode setting module, signal output module and JTAG. The block diagram of the system structure is shown in Fig. 1.
2.2 The principle and hardware implementation of each module
The toroidal coil sensor is a rectangular coil buried under the road surface, the two ends of which are connected to the vehicle detector. The role of the toroidal coil is equivalent to the inductance L in the LC oscillating circuit. When a metal object approaches, its inductance changes, resulting in a change in the oscillation frequency. By detecting and comparing the frequencies, it is possible to determine whether the vehicle is entering or exiting. The LC oscillator circuit composed of it and the shaping circuit together constitute the signal input circuit, as shown in Figure 2.
The coupling between the loop coil and the moving vehicle is carried out by an electromagnetic field. When the car passes through the toroidal coil and is in a certain position, the eddy current caused in the car body is certain, and the influence of the eddy current on the toroidal coil is also certain. There is a certain mutual inductance between the vehicle and the toroidal coil. Therefore, we regard the vehicle as a short-circuit ring with inductance L1 and resistance R1, which is linked with the toroid through mutual inductance M.toroidProvided by the oscillator circuit, the inductance is L2 and the resistance is R2. Then the equivalent inductance can be deduced as:
The variation range of the first term L2 is related to the magnetic permeability of the vehicle, and the second term is related to the eddy current effect. If the working frequency is selected properly, when a vehicle passes through the toroidal coil, the variation of the first term of equation (1) will be smaller than the second term, that is, the equivalent inductance will decrease. The oscillation frequency of the LC oscillator is:
Obviously, when the vehicle passes through the toroidal coil, L becomes smaller, and f increases, and the change of its frequency is measured by the single-chip detection circuit, so that it can be judged whether there is a vehicle passing through.
The circuit consists of transistors Q1 and Q2 to form a common emitter oscillator, resistor R3 is the common emitter resistance of the two transistors, and constitutes a positive feedback. Tl is a magnetic tank transformer, which plays a dual role of impedance transformation and isolation from external circuits. The winding L1 is connected to the toroidal coil through the lead wire, and the inductive reactance of the toroidal coil is reflected to the winding L2 through T1 to form an equivalent inductance L. L and the parallel capacitor Cl form an oscillation circuit, and the LC value determines the oscillation frequency. When the switch Sl is closed, the capacitor C2 and Cl are connected in parallel, the capacitance increases, and the oscillation frequency decreases. Therefore, the setting of the two oscillation frequencies, high and low, takes into account the different conditions of the site, so as to obtain a better detection effect. The output of the LC oscillator circuit is a sine wave with glitches, which is not suitable for digital processing by a single-chip microcomputer. Therefore, a unidirectional Zener diode and a single threshold voltage comparator are required to convert it into a square wave signal output.
Since the oscillating frequency of the LC oscillator circuit is not nearly the same in different applications, the output square wave signal is divided by a counter, and then sent to the P2.5 port of the single-chip microcomputer through the frequency selection interface, thereby avoiding the counting overflow of the single-chip microcomputer , which enhances the flexibility of the single-chip microcomputer for signal processing.
The MSP430F1121A microcontroller is a 16-bit RISC instruction structure; built-in 4kBFlash and 256BRAM; a l6-bit timer Timer-A and a watchdog timer; a comparator with 3 internal reference levels and an output RC filter, etc.
In this paper, the external pin interrupt of the P2.5 port of MSP430F1121A and the Timer-A timing interrupt are used to collect data regularly to obtain the current frequency, and then compare it with the reference frequency according to the currently set sensitivity and working mode requirements to judge Whether there is a vehicle coming, and finally output the signal according to the set output mode.
The power module is converted from 5V to 3.3V by the AS1117 chip. Power supply for single-chip microcomputer, LC oscillator circuit, signal output module, JTAG and other modules.
The voltage monitoring module is used to monitor the 5V power supply voltage. The principle is to connect the 5V voltage with the P2.2 port comparator Comparator-A input pin of the MSP430 microcontroller. When the power supply voltage is lower than the set voltage, the alarm function of insufficient power supply voltage will be activated.
The working mode setting module is to set the input level of the corresponding pins such as sensitivity, working mode, output mode, etc. of the single-chip microcomputer through the dial, and then the single-chip computer performs key value query to complete the corresponding processing program.
3 System software design
3.1 Software programming
The system software is designed using the modular structure programming method, which makes full use of the rich on-chip peripheral modules of MSP430 single-chip microcomputer, which greatly simplifies the hardware circuit of the instrument. All programs are written in C language, which is easy to debug and maintain, and has the advantages of fast running speed, high execution efficiency and easy porting.
The system software consists of the main program, 3 initialization subroutines, and 10 functional subroutines. The three initialization subroutines are: the single-chip clock initialization subroutine, the single-chip I/O port initialization subroutine, and the timer A initialization subroutine. The 10 functional subroutines are: initial fundamental frequency measurement subroutine, vehicle detection subroutine, low voltage alarm subroutine, key judgment subroutine, key check subroutine, delay subroutine, dynamic refresh fundamental frequency subroutine, P2. 5-port interrupt subroutine, timed interrupt processing subroutine and signal output subroutine. The main program flow chart is shown in Figure 3.
A timer is set in the main program. In the case of no car passing by, the timer interrupt service routine is triggered after the time is turned on, and the current P2.5 port interrupt count value is read multiple times and the average value is obtained to obtain the current frequency value. . And set this frequency value as the reference frequency, and set the first frequency measurement flag, this flag can only be cleared when the system is reset. After that, determine the sensitivity value, working mode and output mode of the system at this time through the key judgment subroutine and the key check subroutine.
Due to the difference in vehicle type, vehicle body, and vehicle speed, the detection accuracy will be affected to a certain extent. At the same time, the oscillation frequency of the coupling circuit varies greatly with external factors such as temperature and humidity. If a fixed reference value is set, it may cause misjudgment and affect the reliability and accuracy of the design. Therefore, in this paper, on the premise of not affecting the detection speed, when judging whether the vehicle enters, the limit filter and the mean filter are used to collect the current frequency. The program flow chart is shown in Figure 4.
Limiting filtering can overcome the interference of spikes in the input. The basic idea is to compare the obtained multiple current frequency values with the current reference frequency value, and set the maximum allowable deviation according to experience. If the current frequency value and the current reference frequency If the difference between the frequency values exceeds the allowable maximum deviation, it is considered that interference has entered the sampling value, the interference value is discarded, and the remaining multiple current frequency values are averaged.
Compare the collected frequency value with the current reference frequency. If the difference is greater than the product of the current reference frequency and the sensitivity value, it is considered that a vehicle has entered, and then the relevant signal is output. If it is judged that no vehicle enters, the currently collected frequency value and the current reference frequency are weighted and averaged as the reference frequency for the next measurement, so as to realize the refresh of the reference frequency.
This vehicle detector has the characteristics of simple circuit, high precision, small size, short response time and stable performance. It has been used in a highway bayonet in Zhejiang with good effect. The detector is versatile, and can be used to measure traffic parameters in a series of intelligent traffic control systems such as traffic flow, fleet length, occupancy rate, etc.
The author’s innovation point: the use of the new high-speed and low-power MSP430 single-chip microcomputer greatly improves the speed of vehicle detection. One detection can be completed within 1.5ms at the fastest. The application software dynamically refreshes the benchmark, and anti-interference such as limit filtering and mean filtering. The method improves the reliability and accuracy of detection.
The Links: CM600HU-12F 6MBI50VA-120-50