1. Introduction

How to alleviate urban traffic congestion and improve road capacity has become an urgent issue to be studied and solved. If the intelligent control of traffic lights can be realized according to the traffic flow of each lane and the control time of traffic lights can be reasonably allocated, the efficiency of the traffic system can be improved and the phenomenon of traffic congestion can be alleviated. In order to obtain traffic flow related data, a road traffic flow detection system must be designed. According to the requirements of traffic flow detection system, this paper introduces the principle of magnetoresistive sensor traffic flow detection, and designs a traffic flow detection system by using biaxial magnetoresistive sensor HMC1022 and wireless communication module technology.

2. Detection principle

Geomagnetic vehicle detector is a vehicle detection technology based on magnetoresistive sensor. It has the characteristics of small size, convenient installation, no response to non ferromagnetic objects and high reliability. The magnetoresistive sensor mainly uses the magnetoresistive effect of nickel iron magnetic conductive alloy. The basic component of the magnetoresistive sensor is the Wheatstone bridge. The resistance of the bridge is made of nickel iron magnetic conductive alloy. The resistance value of the resistance has a certain functional relationship with the included angle between the bias current and the magnetic field vector.

The intensity of the earth’s magnetic field is very weak. At the strongest two poles, its intensity is less than 1mt, and the average intensity is about 0.06mt. The ferromagnetic substances contained in the vehicle itself will affect the geomagnetic signal in the vehicle’s existing area and bend the earth’s magnetic line of force in the vehicle’s area. In a limited space, the earth’s magnetic field can be regarded as uniform. When this uniform magnetic field is disturbed by ferromagnetic materials (such as iron, steel, nickel, cobalt, etc.), its uniformity will be destroyed. When the vehicle passes near the sensor, the sensor can sensitively sense the change of the signal, and the traffic flow information on the detected road can be obtained through signal analysis.

3. Hardware design

This design is a single node distributed traffic flow information acquisition and control system based on STC12C5A60S2 single chip microcomputer and HMC1022 as information acquisition sensor. The sensor node is composed of two axis magnetoresistive sensor HMC1022, xl02-232ap1 wireless communication module and power supply. Compared with hmc1001 / 1002 and other three-axis magnetoresistive sensors, HMC1022 has lower power consumption and reduces peripheral circuits. The maximum energy of the node is mainly consumed at the time of wireless sending and receiving data. Multiple geomagnetic sensor nodes are connected with the computer system through the serial wireless communication module to feed back the detected traffic flow information to the host computer, so as to detect the traffic flow of the whole intersection. The system includes signal amplification module, wireless communication module, a / D conversion module, sensor setting / reset module and so on. The design framework of traffic flow detection system hardware is shown in Figure 1.

Design of intersection traffic flow detection system based on STC12C5A60S2 single chip microcomputer

3.1 wireless communication module

In this paper, a biaxial magnetoresistive sensor HMC1022 produced by Honeywell is selected, which has the advantages of small volume, high sensitivity, low price and good stability. The sensitivity of HMC1022 can reach 1mV / V / GS, the linear error is 0.1%, and the lag error and repeatability error are also very small, which can reach 0.05%

Because the magnetoresistive sensor has a detection range of only a few meters, and the magnetic field signal intensity decreases linearly with the increase of distance. In practical application, we usually place the sensor in the middle of the lane. In order not to affect the normal operation of traffic, this paper adopts xl02-232ap1 wireless communication module, which adopts high-performance industrial single chip microcomputer, with good anti-interference and stable and reliable communication. Its communication channel is half duplex, which can be used for point-to-point communication. It is simple to use. When the module works normally, it is in the data receiving state by default. This design enables xl02-232ap1 module to work in a point to multipoint communication mode. This communication mode needs to set one module as the master station and the rest as slave stations. Each station is preset with a unique address code, and the master station is in the receiving state by default, and all slave stations are in the sending state by default. Each slave station sends data or commands by using the data frame with address code. The master station receives all the data frames sent by the slave station, determines which lane detection point sends the data according to the address code of the received data, and then controls the corresponding traffic light signal. These tasks are completed through the upper layer protocol, which can ensure that the master station receives the data sent by the slave station in time, so as to avoid mutual interference and frame loss.

Xl02-232ap1 wireless communication module adopts + 5V DC power supply, and the maximum working current does not exceed 60mA. The power supply can be shared with other equipment, but pay attention to the quality of power supply and grounding reliability. With the rapid development of China’s photovoltaic industry, solar energy can be considered to supply power to the system. When in use, the data output terminal TXD of the wireless communication module is connected to the data input terminal RXD of the single chip microcomputer, and the data input terminal RXD of the module is connected to the data output terminal TXD of the single chip microcomputer. The set terminal of the module is the setting parameter status port. When entering the setting mode, it is necessary to lower this port first, and then power on the module. At this time, the green light is on for a long time to enter the setting mode. After the parameters are set, the port can be suspended during normal operation.

3.2 sensor set / reset module

When the magnetoresistive sensor is exposed to the interference magnetic field, it is easy to be affected by the interference of large magnetic field. When the detected magnetic field of the magnetoresistive sensor exceeds the range of ± 6gs, the output of the sensor will no longer maintain a linear relationship, and its sensitivity will be reduced, resulting in the decay of the output signal and the inability to accurately detect the weak signal magnetic field. In order to avoid this situation and affect the detection accuracy, the pulse signal is applied to the internal integrated set / reset current band of HMC1022 chip to restore its original high sensitivity.

In this design, the MOSFET switch selects the enhanced high-voltage FET ao4606. The single-chip microcomputer timer module generates a low-level clock signal with a pulse width of no less than 2us after the high-level every 100ms, so as to switch the on and off of the MOS tube and generate a pulse signal that can control the set / reset current band.

4. Algorithm implementation

Since the system requires that the detection data of sensor nodes can communicate with the host computer in real time through wireless communication module, and the storage space of single chip microcomputer is limited, the traffic flow detection algorithm can not consume too much storage space and calculation time of single chip microcomputer. Ding et al. Proposed the multi intermediate state machine algorithm, which has simple calculation, high precision, and can get real-time results during the operation of single chip microcomputer.

The multi intermediate state machine includes five states: nocar, car, count0, count00 and COUNT1. The input is u (k), the intermediate states are count0 and count00, and the output is car and nocar

Firstly, the signal detected by the magnetoresistive sensor HMC1022 is processed by the average processing algorithm to obtain f (k), then f (k) is converted into a binary signal U (k) as the input of the state machine, and the threshold T (k) is set. When f (k) ≥ t (k), u (k) = 1, when f (k)

Compared with the single intermediate state machine algorithm, the multi intermediate state machine algorithm can not only judge when the vehicle enters the detection area, but also increase the intermediate state of judging the vehicle leaving the detector, and can better extract the vehicle information from the time series. Therefore, it can effectively avoid misjudgment caused by interference.

5. Test and conclusion

The experimental results of the detection system are obtained by field testing on the road site. According to the different location of detection points and different placement directions of sensor sensitive axis, the corresponding magnetic field signal change information is collected and classified, contrasted and analyzed.

Detection node A and detection node B are respectively arranged at the center and edge of the lane, and the vehicle driving direction is from west to East, as shown in Figure 2. Change the direction of the x-axis of the sensitive axis of the magnetoresistive sensor, take the positive direction of the x-axis as the sign, make it face the East, West, South and north respectively, and test the magnetic field change of the detection node when the vehicle comes.

Design of intersection traffic flow detection system based on STC12C5A60S2 single chip microcomputer

By comparing and analyzing the test waveforms of detection node A and detection node B, it can be found that when the vehicle passes above the detection node, the detection value changes obviously, while when the vehicle passes next to the detection node, the detection value changes, but it is not obvious. According to this different change characteristics, the detection node can be placed in the center of each lane of the road, which can not only accurately identify whether there are vehicles passing in the lane, but also effectively prevent the interference caused by vehicles passing in the next lane and avoid false detection.

6. Conclusion

Experiments show that the traffic flow detection system has a good detection effect on vehicles. At the same time, the algorithm is simple and runs fast. It is suitable for single chip microcomputer. The detection system has the characteristics of low cost, small volume and no wiring of sensor nodes. It can be widely used in vehicle detection in the field of intelligent transportation.

Leave a Reply

Your email address will not be published. Required fields are marked *