Design of vehicle detector based on single chip microcomputer MSP430

Publisher:ByteChaserLatest update time:2009-08-17 Source: 微计算机信息 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

0 Introduction

In recent years, vehicle detectors, as an important front-end part of traffic information collection, have attracted more and more attention from industry insiders. In view of the development needs of modern highway traffic management and urban traffic management, the development of vehicle detectors, a dynamic detection technology for moving vehicles, has attracted great attention both at home and abroad. Vehicle detectors use motor vehicles as detection targets to detect the passage or existence of vehicles. Their function is to provide sufficient information for intelligent traffic control systems to achieve optimal control. At present, the commonly used moving vehicle detectors mainly include magnetic induction detectors, ultrasonic detectors, pressure switch detectors, radar detectors, photoelectric detectors, and video detectors. The toroidal coil electromagnetic induction vehicle detector has the advantages of stable performance, simple structure, easy detection circuit implementation, low cost, low maintenance, and wide adaptability. It has the widest market application range. At present, almost all vehicle detectors actually used on highways and urban roads in my country are imported from abroad. There are many problems with domestic vehicle detectors, such as high false detection rate, low sensitivity, and poor long-term working stability. [1-2]

Based on a large number of field experiments, this paper proposes a new solution that integrates stability, sensitivity and high speed to solve many of the problems mentioned above.

1 Working Principle

This system uses the method of combining MSP430F1121A microcontroller with a ring coil to detect moving vehicles. It is a detector based on the principle of electromagnetic induction. The sensor coil is a ring coil with a certain current. When the iron object to be detected passes through the coil and cuts the magnetic lines of force, it causes the change of the coil loop inductance. The detector can detect the existence of the object to be detected by detecting the change of the inductance. This paper uses the coupling circuit composed of a ring coil to detect its oscillation frequency. However, coil detection is easily affected by the external environment such as vehicle, humidity, temperature, etc., and the reference frequency will drift, thus affecting the detection effect. At the same time, due to the differences in vehicle models, vehicle bodies, and vehicle speeds, the accuracy of detection will also be affected. In response to these situations, this paper proposes a method of software dynamic refresh detection benchmark 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, effectively improving the accuracy and reliability of detection.

2 System Structure and Hardware Design

2.1 System Structure

The system is based on MSP430F1121A microcontroller, and consists of a ring 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, etc. The system structure diagram is shown in Figure 1.

2.2 Principles and hardware implementation of each module

The ring coil sensor is a rectangular coil buried under the road surface, with leads at both ends connected to the vehicle detector. The ring coil acts as the inductor L in the LC oscillation circuit. When a metal object approaches, its inductance changes, causing the oscillation frequency to change. By detecting and comparing the frequency, it can be judged whether the vehicle is entering or leaving. The LC oscillation circuit composed of it and the shaping circuit together constitute the signal input circuit, as shown in Figure 2.

Design of moving vehicle detector based on MSP430

The toroidal coil and the moving vehicle are coupled through the electromagnetic field. When the vehicle passes through the toroidal coil and is at a certain position, the eddy current caused in the vehicle 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 loop with inductance L1 and resistance R1, which is linked with the toroidal coil through mutual inductance M. The supply voltage of the toroidal coil is Design of moving vehicle detector based on MSP430 , provided by the oscillation circuit, the inductance is L2, and the resistance is R2. Then the equivalent inductance can be deduced to be:

Design of moving vehicle detector based on MSP430 (1)

The change amplitude 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 operating frequency is selected appropriately, when a vehicle passes through the toroidal coil, the change of the first term in equation (1) will be smaller than the second term, that is, the equivalent inductance decreases. The oscillation frequency of the LC oscillator is:

Design of moving vehicle detector based on MSP430 (2)

Obviously, when a vehicle passes through the toroidal coil, L becomes smaller and f increases. The change in frequency is measured by the single-chip microcomputer detection circuit, so as to determine whether a vehicle passes.

The circuit is composed of transistors Q1 and Q2 to form a common emitter oscillator. Resistor R3 is the common emitter resistor of the two transistors and forms positive feedback. Tl is a magnetic tank transformer, which plays a dual role of impedance transformation and isolation from the external circuit. Its winding Ll is connected to an external ring coil through a lead wire. The inductive reactance of the ring coil is reflected to the winding L2 through Tl to form an equivalent inductance L. L and the parallel capacitor Cl form an oscillation loop. The LC value determines the oscillation frequency. When the switch Sl is closed, the capacitor C2 is connected in parallel with Cl, the capacitance increases, and the oscillation frequency decreases. The high and low oscillation frequencies are set in accordance with the different conditions on site to achieve better detection results. The LC oscillation circuit outputs a sine wave with glitches, which is not suitable for digital processing by a single-chip microcomputer. Therefore, a unidirectional voltage regulator diode and a single threshold voltage comparator are required to convert it into a square wave signal output.

Since the oscillation frequency of the LC oscillation circuit is not 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 microcontroller through the frequency selection interface, thereby avoiding the counting overflow of the microcontroller and enhancing the flexibility of the microcontroller in signal processing.

The MSP430F1121A microcontroller has a 16-bit RISC instruction structure; built-in 4kB Flash and 256B RAM; a 16-bit timer Timer-A and a watchdog timer; a comparator with 3 internal reference levels and an output with RC filtering, etc. [3-4]

This paper uses the external pin interrupt of the P2.5 port of MSP430F1121A and the Timer-A timing interrupt to collect data regularly to obtain the current frequency, and then compares it with the reference frequency according to the currently set sensitivity and working mode requirements to determine whether a vehicle is coming, and finally outputs a signal to the outside according to the set output method.

The power module uses the AS1117 chip to convert 5V to 3.3V, and provides power for the microcontroller, LC oscillation circuit, signal output module, JTAG and other modules.

The voltage monitoring module is used to monitor the 5V power supply voltage. Its principle is to divide the 5V voltage and connect it to the input pin of the Comparator-A of the P2.2 port of the MSP430 microcontroller. When the power supply voltage is lower than the set voltage, the power supply voltage undervoltage alarm function will be activated.

The working mode setting module sets the input level of the corresponding pins of the microcontroller representing sensitivity, working mode, output mode, etc. through the dial, and then the microcontroller performs key value query to complete the corresponding processing procedure.

3 System Software Design

3.1 Software Programming

The system software is designed with modular structure programming method, which gives full play to the rich peripheral modules of MSP430 microcontroller, greatly simplifying the hardware circuit of the instrument. All programs are written in C language, which is easy to debug and maintain, and has fast running speed, high execution efficiency and easy transplantation.

The system software consists of a main program, three initialization subroutines, and 10 functional subroutines. The three initialization subroutines are: MCU clock initialization subroutine, MCU I/O port initialization subroutine, and timer A initialization subroutine. The 10 functional subroutines are: initial base frequency measurement subroutine, vehicle detection subroutine, voltage undervoltage alarm subroutine, key judgment subroutine, key check subroutine, delay subroutine, dynamic refresh base frequency subroutine, P2.5 port interrupt subroutine, timer 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. When no car passes, the timing interrupt service program is triggered after the power is turned on. The current P2.5 port interrupt count value is read multiple times and the average value is taken to obtain the current frequency value. This frequency value is set as the reference frequency, and the first frequency measurement flag is set. This flag can only be cleared when the system is reset. After that, the sensitivity value, working mode and output mode of the system at this time are determined through the key judgment subroutine and the key check subroutine.

Due to the differences in vehicle models, vehicle bodies, and vehicle speeds, the accuracy of detection 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, this paper uses limiting filtering and mean filtering to collect the current frequency when judging whether a vehicle enters without affecting the detection speed. The program flow chart is shown in Figure 4.

Limiting filtering can overcome the interference of sharp pulses in the input. The basic idea is to compare the multiple current frequency values ​​obtained with the current reference frequency value respectively, and set the maximum allowable deviation based on experience. If the difference between the current frequency value and the current reference frequency value exceeds the maximum allowable deviation, it is considered that interference has been introduced into the current sampling value, and the interference value is discarded, and then the average of the remaining multiple current frequency values ​​is taken.

The collected frequency value is compared 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 the relevant signal is output. If it is judged that no vehicle has entered, the weighted average of the current collected frequency value and the current reference frequency is used as the reference frequency for the next measurement, thereby realizing the refresh of the reference frequency.

Design of moving vehicle detector based on MSP430

4 Conclusion

This vehicle detector has the characteristics of simple circuit, high precision, small size, short response time, stable performance, etc. It has been used at a highway checkpoint in Zhejiang with good results. This detector is universal and can be used to measure a series of traffic parameters in intelligent traffic control systems such as traffic flow, fleet length, occupancy rate, etc. through certain functional expansion, and has high practical value.

The author's innovation: The use of a new high-speed, low-power MSP430 microcontroller greatly improves the speed of moving vehicle detection. A detection can be completed in as little as 1.5ms. The application software dynamically refreshes the benchmark and anti-interference methods such as limiting filtering and averaging filtering improve the reliability and accuracy of detection.

分页
Reference address:Design of vehicle detector based on single chip microcomputer MSP430

Previous article:Design and simulation of remote meter reading system based on Proteus
Next article:Application of μPSD 32XX MCU in the Development of Tax Controller

Recommended ReadingLatest update time:2024-11-17 05:50

Soil foundation intelligent inclinometer based on MSP430F148 single chip microcomputer
Inclinometer is an instrument for measuring the inclination, azimuth, lateral displacement and settlement of the borehole, and plays an important role in actual engineering construction. Monitoring displacement during construction is the main means of studying environmental impact. At present, most inclinometers use
[Microcontroller]
Soil foundation intelligent inclinometer based on MSP430F148 single chip microcomputer
Design of weighing liquid level meter based on MSP430 single chip microcomputer
1 Introduction The liquid level measurement and control instrument is a type of intelligent instrument (referring to instruments that use microprocessors), and its development began in the 1970s . It is an intelligent product that integrates measurement and control, and is suitable for the liquid level meas
[Microcontroller]
Design of weighing liquid level meter based on MSP430 single chip microcomputer
Design of portable weather instrument based on MSP430 microcontroller
0 Introduction     The measurement of meteorological parameters such as temperature, humidity, air pressure, wind speed, wind direction, etc. plays a very important role in daily life, agriculture, fishery, industry, forestry, navigation and other fields. The measurement of meteorological parameters in many areas mostl
[Microcontroller]
Design of portable weather instrument based on MSP430 microcontroller
Application design of MSP430 single chip microcomputer in power system
1 Introduction The MSP430 series of microcontrollers is a 16-bit ultra-low power mixed signal processor that was launched by Texas Instruments (TI) in 1996. It has been highly praised by users for its ultra-low power consumption, powerful processing capabilities, high-performance analog techno
[Microcontroller]
Application design of MSP430 single chip microcomputer in power system
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号