Based on STC12C5A60S2 single-chip microcomputer, how to design the intersection traffic detection system?

Last Update Time: 2019-08-27 10:36:55

1 Introduction

How to alleviate urban traffic congestion and improve road traffic capacity has become an urgent problem to be solved. If the intelligent control of traffic lights can be realized according to the traffic volume of each lane, and the traffic signal control time can be reasonably allocated, the traffic system efficiency can be improved and the traffic congestion can be alleviated. In order to obtain traffic flow related data, a road traffic flow detection system must be designed. Aiming at the demand of vehicle flow detection system, this paper introduces the principle of vehicle flow detection of magnetoresistive sensor. A vehicle flow detection system is designed by using dual-axis magnetoresistive sensor HMC1022 and wireless communication module technology.

2. Detection principle

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

 

The strength of the Earth's magnetic field is very weak. The two strongest strengths are less than 1mT, and the average intensity is about 0.06mT. The ferromagnetic material contained in the vehicle itself will affect the geomagnetic signal in the area where the vehicle exists, so that the earth's magnetic field lines in the region where the vehicle is located will occur bending. In a limited space, the Earth's magnetic field can be seen as uniform. When this uniform magnetic field is disturbed by ferromagnetic materials (such as iron, steel, nickel, cobalt, etc.), its uniformity is destroyed. When the vehicle passes near the sensor, the sensor can know the change of the signal sensitively, and the traffic flow information of the road surface can be obtained through signal analysis.

 

3. Hardware design

This design is a single-node distributed traffic information collection and control system based on STC12C5A60S2 microcontroller and HMC1022 as information acquisition sensor. The sensor node is composed of a dual-axis magnetoresistive sensor HMC1022, a XL02-232AP1 wireless communication module, and a power supply. Compared with the HMC1001/1002 and other three-axis magnetoresistive sensors, the HMC1022 has lower power consumption and reduces peripheral circuits. The maximum energy of the node is mainly consumed when transmitting and receiving data wirelessly. A plurality of geomagnetic sensor nodes are connected to the computer system through the serial port wireless communication module, and the detected traffic information is fed back to the upper computer, thereby realizing the detection of the traffic volume of the entire intersection. The system includes a signal amplification module, a wireless communication module, an A/D conversion module, a sensor set/reset module, and the like. The design framework of the vehicle flow detection system hardware is shown in Figure 1.

image.png

3.1 Sensor Set/Reset Module

When the magnetoresistive sensor is exposed to a disturbing magnetic field, it is susceptible to interference from large magnetic fields. When the magnetic field of the magnetoresistive sensor exceeds ±6Gs, the output of the sensor will no longer maintain a linear relationship, and its sensitivity will also decrease, causing the output signal to decay, which will not accurately detect the weak signal magnetic field. In order to avoid this, affecting the detection accuracy, the pulse signal is applied to the built-in set/reset current band of the HMC1022 chip to restore its original high sensitivity.

 

In this design, the MOSFET switch tube adopts the enhanced high-voltage FET AO4606. The single-chip timer module generates a low-level clock signal of not less than 2us pulse width after every 100ms high level, thereby switching the conduction of the MOS tube. And off, generating a pulse signal that can control the set/reset current band.

 

3.2 Wireless Communication Module

This paper selects a dual-axis magnetoresistive sensor HMC1022 produced by Honeywell, which has the advantages of small volume, high sensitivity, low price and good stability. The sensitivity of the HMC1022 is up to 1mV/V/Gs, the linearity error is 0.1%, and the hysteresis error and repeatability error are also small, which can reach 0.05%.

 

Since the magnetoresistive sensor has a detection range of only a few meters, and the magnetic field signal strength linearly attenuates as the distance increases. In practice, we usually place the sensor in the middle of the lane. In order not to affect the normal operation of traffic, this paper uses XL02-232AP1 wireless communication module, which uses high-performance industrial-grade single-chip microcomputer, which has good anti-interference and stable and reliable communication. The communication channel is half-duplex, which can be used for point-to-point communication. It is simple to use, and the module is in the data receiving state by default when the module works normally. This design enables the 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 pre-configured with a unique address code, and the master station defaults. In the receiving state, all slaves are in the sending state by default. Each slave station uses a data frame with an address code to transmit data or commands. The primary station receives the data frames sent by all the slave stations, and determines which lane detection point transmits the data according to the address code of the received data, and then performs corresponding Traffic light signal control. These tasks are completed by the upper layer protocol, which ensures that the primary station receives the data sent by the secondary station in time to avoid mutual interference and cause frame dropping.

 

The XL02-232AP1 wireless communication module is powered by a +5V DC power supply. The maximum operating current does not exceed 60mA. The power supply can be shared with other devices, but pay attention to the quality of the power supply and the reliability of the grounding. Solar energy can be considered for powering the system. When using, 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 a parameter parameter state port, and when entering the setting mode, the first Pull this port low and power on the module. At this time, the green light is on and enter the setting mode. After the parameters are set, the port can be left floating during normal operation.

4. Testing and conclusion

The experimental results of this test system were obtained by field test on the road site. According to different positions of the detection points, different orientations of the sensitive axes of the sensors, and other conditions, the corresponding magnetic field signal change information is collected, and the classification and comparison are analyzed.

 

5. Conclusion

The experiment proves that the vehicle flow detection system has a good detection effect on the vehicle, and the algorithm is simple, the running speed is fast, and it is suitable for application to a single chip microcomputer. The detection system has the characteristics of low cost, small size, no wiring, and can be widely used in vehicle detection in the field of intelligent transportation.

If you want to know more, our website has product specifications for the single-chip microcomputer, you can go to ALLICDATA ELECTRONICS LIMITED to get more information.