Design of Intelligent Automobile Anti-collision Alarm Based on AT89C2051
[Copy link]
Abstract: This paper introduces the performance and characteristics of the AT89C2051 single-chip microcomputer, and introduces a low-cost, high-precision, miniaturized, digital display car anti-collision alarm with it as the core. The anti-collision alarm uses ultrasonic waves and integrated Hall elements to measure the distance and speed of the car, and uses the real-time control and data processing functions of the single-chip microcomputer to complete the control of the system. The article gives the hardware circuit principle and software design of the alarm. Keywords : single-chip microcomputer, ultrasonic distance measurement, Hall integrated sensor摘要CH(结束)← →关键CH(开始) 关键CH(结束)←→摘要EN(开始) With the acceleration of the pace of modern life, the frequency of traffic accidents is also increasing. In order to improve the safety of automobile operation, this article introduces a car anti-collision alarm system controlled by a single-chip microcomputer. The device combines the real-time control and data processing functions of the single-chip microcomputer with the ultrasonic ranging technology and sensor technology. It can detect the distance between the rear obstacle and the car and the speed of the car during the operation of the car, display the distance through the digital display device, and issue a warning sound according to the distance by the sound circuit. 1 Principle of ultrasonic distance measurement The principle of ultrasonic distance measurement is to continuously detect the echo reflected by obstacles after the ultrasonic wave is emitted, so as to measure the time difference T between the emission of ultrasonic wave and the reception of echo, and then calculate the distance S = C × T / 2, where C is the ultrasonic wave speed, which is 344m / s at room temperature. After the sound speed is determined, as long as the time of the ultrasonic wave is measured, the distance can be calculated. 2 Principle of speed measurement The measurement of automobile speed is achieved through Hall integrated sensor. That is, the input shaft of the turntable equipped with permanent magnet is connected to the rotating shaft of the wheel. When the wheel rotates, the turntable rotates accordingly. At this time, the permanent magnet on the turntable will pass through the Hall integrated sensor, thereby obtaining a magnetic signal at the input end of the Hall integrated sensor. If the turntable keeps rotating, the Hall integrated sensor will output a speed signal. It can be said that the measurement of automobile speed is essentially the measurement of the frequency of the speed signal. 3 Functions and features of controller AT89C2051 AT89C2051 is a low-power, high-performance CMOS 8-bit microprocessor, compatible with MCS-51 series instruction set and pins, with the following features: 128 bytes of internal RAM, 2Kbytes of EPROM, 15 I/O lines, 2 16-bit timer/counters, 5 two-level interrupt sources, 1 full-duplex serial port, an on-chip precision analog comparator and on-chip oscillator, low-power idle and power-down modes. The operating voltage range is 4.25V~5.5V, and the operating frequency is 12MHz. The two 16-bit timer/counter registers T0 and T1 in AT89C2051 can count machine cycles when used as timers, and the counting frequency is 1/12 of the oscillation frequency; when used as counters, they can increase by 1 when the external input pins P3.4 / T0 and P3.5 / T1 change from 1 to 0, and the counting frequency is 1/24 of the oscillation frequency. 4 Hardware System Design The alarm consists of a control system, an ultrasonic transmitting circuit, a receiving circuit, a speed measuring circuit, an alarm circuit, and an LED display circuit. The circuit principle block diagram is shown in Figure 1. The ultrasonic transmitting circuit consists of a CC7555 time base circuit and an ultrasonic transmitting probe. The P1.7 pin of the single-chip microcomputer AT89C2051 controls the CC7555 time base circuit to generate a 40kHz frequency signal to the ultrasonic generator, and the ultrasonic wave emitted by the ultrasonic probe is directed to the obstacle. Ultrasonic ranging has the following characteristics: high measurement sensitivity, strong penetration, fast measurement speed, large measurement angle, and can detect objects within a large range. The ultrasonic receiving circuit consists of an ultrasonic receiving probe, an amplifier, and a shaper. The ultrasonic wave reflected by the obstacle is converted into an electrical pulse signal by the receiving probe, and then amplified and shaped by the amplifier and shaper and sent to the P3.2 pin of the single-chip microcomputer AT89C2051 . The amplifier should be a broadband amplifier with sufficient gain and low noise to keep the pulse signal, especially the leading edge, from being distorted and improve the accuracy of ranging.
The speed measurement circuit is composed of a sensor, a pulse amplifier, a shaper, a CC7555 time-base signal circuit, and a gate. The Hall integrated sensor converts the wheel speed signal into a pulse signal output, which is sent to the gate after amplification and shaping circuits. The unit time-base signal generated by the CC7555 time-base circuit controls the opening and closing of the gate to control the speed signal to pass through the gate within a unit time and is sent to the P3.5 pin of the single-chip microcomputer AT89C2051 to control the T1 counter to count, thus realizing the counting within a unit time. The alarm circuit is composed of the CC7555 circuit and a speaker. The P1.6 of the AT89C2051 controls the CC7555 circuit to generate a signal of a certain frequency according to the measurement results to drive the speaker to sound an alarm. When the speaker sounds an alarm, the time-base circuit CC7555 is in a temporary stable state. At this time, the power supply charges the capacitor, so that the CC7555 ends the temporary stable state and returns to a stable state, outputs a low level, and stops the speaker from sounding an alarm until the next distance measurement is completed and a new alarm sound is generated. The LED display circuit consists of a digital tube and a driving circuit. Two digital tubes are used to display the distance. The digital tubes use static display and are driven by the chip MCS14495. P1.4 and P1.5 are used as latch signals of the driver chip MCS14495 to control whether the generated BCD (Binary Code Decimal, a decimal number represented by binary code) code displays high or low. The controller AT89C2051 mainly completes the execution of the program, data processing and real-time control of the external circuit. The internal timer T0 works in the timing mode. T0 starts counting when the ultrasonic wave is emitted. When the P3.2 pin receives the echo, it stops counting. The time counted by T0 is the round-trip transmission time of the ultrasonic wave. The single-chip microcomputer processes the data to measure the distance. The internal timer T1 works in the counting mode. The pulse signal input by the P3.5 pin controls the T1 count . The count value of T1 determines the speed of the car . The single chip microcomputer compares the measured distance and the vehicle speed to determine whether to drive the alarm circuit to alarm. For example, when the vehicle speed is less than or equal to 30km/s, the safety distance should be greater than or equal to 1m; when the vehicle speed is less than or equal to 80km/s, the safety distance should be greater than or equal to 2m; when the vehicle speed is greater than 80km/s, the safety distance should be greater than or equal to 5m. 5 Software Design The control software of this device should complete the initialization of the system, control the transmission and reception of the trigger pulse signal, calculate the distance of the obstacle according to the timing time, calculate the vehicle speed according to the counting frequency, determine whether the measured distance is within the safety range corresponding to the vehicle speed, and generate BCD code and pulse signals of corresponding frequency according to the calculation and judgment results to drive the display circuit and the sound circuit. The main flow chart for realizing the functions of the entire system is shown in Figure 2. 6 Conclusion The car alarm introduced in this article uses the single-chip microcomputer AT89C2051 as the controller of the alarm device, which can give full play to the data processing and real-time control functions of AT89C2051, make the system work in the best state, and improve the sensitivity of the system. The alarm is based on the single-chip microcomputer design, so it has the characteristics of small size and easy use. If the safety distance is set to 0.5m, it can be used as a car reversing alarm to improve the safety of the car when reversing.
|