Shenzhen ZTRON Microelectronics Co., Ltd
Telephone
0755-8299 4126

Personal consumer electronics

Ultrasonic reversing radar program development


In recent years, with the sharp increase in the number of drivers and motor vehicles, the road conditions are complex, and drivers often cannot timely understand the environment around the vehicle, especially the rear environment, resulting in untimely operation of the driver and causing many accidents. This paper designs a reversing radar system with AT89C51 single-chip microcomputer as the core, which uses ultrasonic waves to measure distance, and has the functions of display and alarm, which greatly improves the safety of reversing parking.


1. The overall design of the reversing radar system


In this paper, an ultrasonic reversing radar system based on single-chip microcomputer is designed, and the distance is measured by ultrasonic pulse echo method. AT89C51 single-chip microcomputer is used as the control unit of the whole system, and TCF40-16TRC ultrasonic transceiver integrated sensor is used as the distance measuring device. The system mainly includes distance measuring part, control part and display alarm part. Figure 1 shows the overall framework of the system.


When the car is parked in reverse gear, the ECU of the whole vehicle will generate a reverse signal. After receiving the signal, the single-chip microcomputer enters the working state and generates a pulse voltage signal. The signal is sent to the first road (rear left Branch) the distance measuring circuit, after the circuit is amplified, the sensor is driven to emit ultrasonic waves, and the single-chip microcomputer starts timing at the same time. The reflected echo generated by the ultrasonic wave encountering an obstacle is received by the ultrasonic receiving sensor and converted into an electrical signal. After the single-chip microcomputer receives the signal, it responds to the interrupt, and the system will execute an external interrupt program to stop the previous timing. The controller The time difference between the ultrasonic emission and the echo will be obtained, and the execution of the next path will continue after the timing interruption. The ranging sequence is rear left, rear left center, rear right center and rear right. Subsequently, the controller calculates the minimum distance value and transmits the value and the orientation to the LCD. When the value is less than the set safety distance, the single-chip microcomputer drives the buzzer to send out an alarm, and the AEB system enters the working state at the same time to ensure parking safety.


2. Hardware design of reversing radar system


The AT89C51 microcontroller is an eight-bit chip with low power consumption and high performance. The hardware circuit mainly includes a single-chip microcomputer control circuit, an ultrasonic distance measuring transceiver circuit, an echo electric signal amplification circuit, an LCD display circuit, an alarm circuit, and an azimuth light display circuit, etc.


1) Ultrasonic distance measuring transceiver circuit: The functions of the ultrasonic transceiver circuit mainly include: increasing the voltage amplitude of the driving and transmitting acoustic pulse, realizing the conversion between the acoustic signal and the electrical signal; increasing the effective ultrasonic transmission distance. This system chooses CD4052 type chip to be used for time-sharing gating the sensor of four branches.


2) Design of the echo electric signal amplification circuit: the amplification circuit selects the CX201 06A chip as the control core. In Figure 2, pin 1 is connected to the Y end of the CD4052 chip. The amplifying circuit processes the echo electric signal, finally generates and outputs a low-level signal to the single-chip microcomputer. This signal will apply for an interrupt to the control chip, and then the microcontroller will send a timing stop command, and the system will start processing the data at the same time.


3) Circuit design of liquid crystal display system: This design chooses YBLCD1602LCD liquid crystal display as the display device. The eight pin ports of the chip P0 are respectively connected with the eight pins of the LCD to transmit instructions and data. The P1.0, P1.1 and P1.2 pins are respectively connected to the three ports of the LCD to control the read and write functions of the LCD.


4) Circuit design of the system orientation light: When one of the diodes lights up, it indicates that the obstacle corresponding to the orientation of the sensor on this road is the closest to the vehicle body. The four light-emitting diodes are respectively connected to the pins of the chip, and when the output of the corresponding pin of the chip is low level, the diode corresponding to the pin is lit.


5) Design of system alarm circuit: The system uses PB2130UP002A buzzer as the sound alarm device. When the distance between the obstacle and the car body is too close, the buzzer will sound to play the role of alarm.


3. Software design of reversing radar system


The system software part is composed of running main program, ultrasonic transceiver subroutine, transmission channel gating subroutine, LCD display subroutine, alarm subroutine and so on.


3.1 Software main program design


When the car is in reverse gear, the system enters the working state. First clear each buffer unit to initialize the liquid crystal display. Subsequently, the system starts to detect whether there is a reversing signal, and if there is an ultrasonic ranging branch, it will start to work, otherwise continue to wait. Set the timer and assign the initial value, and at the same time, the T1 timer is interrupted. The single-chip microcomputer judges whether the four-way detection is completed by detecting the flag bit of the four-way detection. If the flag bit is 1, it means that it has been completed, and the data is processed. After completion, the minimum distance is displayed on the LCD. After about 0.5s, the system returns to the detection of the reverse signal to start the next cycle.


3.2 Ultrasonic transceiver subroutine design


The single-chip microcomputer receives the signal of the ultrasonic echo, and the system enters the external interrupt 0 program. At this time, the timer T0 first stops counting, prohibits the interrupt of external interrupt 0, and then the count value is saved in the unit starting with 40H. Subsequently, the system waits for the 40ms interrupt set by the timer T1 to be generated, and once generated, it will continue to measure the distance of the next branch.


3.3 Timer T1 interrupt program design


The system enters the timer T1 interrupt program, T1 is closed, the external 0 interrupt is disabled, and T1 is reassigned to the initial value. If all the gates are completed and there are four count values, the system will set the flag bit and then compare the four values and return to the main program. If all four channels have not been selected, the system will continue to select channels that have not been selected, and at the same time call the subroutine for transmitting ultrasonic waves, start timer T0 and timer T1, and allow timer T1 to be interrupted.


4. Debugging and simulation of reversing radar system


In this paper, Keil software is used to debug the program, and Proteus software is used to simulate the circuit. The program of the system is debugged with Keil software and the whole system is simulated with Proteus professional simulation software to verify the correctness and stability of the system.


Summarize


In this paper, a parking radar system with simple structure and high reliability is designed by using single-chip microcomputer control and ultrasonic ranging. Ultrasound is used for distance measurement, the measurement accuracy is relatively high, and the functions of display and alarm are realized at the same time, which fully meets the needs of drivers for parking.


The above is the design and development example of ultrasonic reversing radar based on single-chip microcomputer introduced by Shenzhen Zuchuang Microelectronics Co., Ltd. If you have the development needs of the reversing radar control circuit board, you can trust us. We represent a variety of single-chip microcomputers, voice chips, dual-mode Bluetooth ICs, and wifi chips. Brands include Songhan MCU, Yingguang MCU, Jerry Bluetooth, Ankai Bluetooth, Allwinner, and Realtek. Our technical services include: PCB design, MCU development, Bluetooth solution, software and hardware custom development, APP development, small program development, WeChat official account development, etc. It can also undertake the design of intelligent electronic products, the development of living appliances, the research and development of beauty equipment, the application of Internet of things platform, the smart home control system, the development of TWS earphones, Bluetooth earphone speakers, the development of children's educational toys, the design of electronic education products, etc.


  • TOP