With the increasing requirements for the intelligence of automobile assisted driving systems and the networking development of automobile electronic systems, new reversing radars should be able to continuously measure and display the distance to obstacles, and have communication functions to send data to the vehicle bus.
Previous reversing radar designs used many components and had simple functions. This article introduces a reversing radar based on the new high-performance ultra-low power microcontroller MSP430F2274, which can make up for the shortcomings of previous products.
Overall system design
The system adopts the principle of ultrasonic ranging. Ultrasonic ranging instruments are generally composed of three parts: a transmitter, a receiver, and a signal processor. When working, the ultrasonic transmitter sends out ultrasonic pulses, and the ultrasonic receiver receives the reflected waves reflected by obstacles, accurately measuring the time from the ultrasonic wave being emitted to the reflected waves being reflected by obstacles. According to the propagation speed of ultrasonic waves, the distance of obstacles can be calculated. As a non-contact detection method, ultrasonic waves have the characteristics of small air propagation attenuation, strong reflection ability and penetration. Ultrasonic ranging has the advantages of being unaffected by light, rain, snow and fog within a short range, simple structure, convenient manufacturing and low cost. A high-performance single-chip microcomputer combined with ultrasonic ranging can realize a powerful and easy-to-use reversing radar. TI's 16-bit single-chip microcomputer MSP430F2274 has extremely low power consumption and rich on-chip resources. At the same time, using JTAG interface technology, the on-chip flash memory can be easily programmed, which is convenient for software upgrades. It is very suitable as a microcontroller for the reversing radar system. The block diagram of the reversing radar system is shown in Figure 1.
Figure 1 Block diagram of the reversing radar system
Hardware system design
The system is based on the MSP430F2274 microcontroller. The peripheral circuit consists of five parts: ultrasonic transmitting circuit, ultrasonic receiving circuit, sound and light alarm circuit, communication interface circuit, and keyboard LCD display circuit. They are introduced one by one below.
Figure 2 Main control circuit diagram of reversing radar system
The main control circuit diagram of the system is shown in Figure 2. The MSP430F2274 chip selected in this system has 32Kb flash memory and 1Kb RAM, so there is no need for external memory expansion. The external 32.768kHz crystal oscillator is used as the clock source of the B
asic-Timer in the CPU shutdown state, and is also used as the system's on-board clock.
The ultrasonic transmitter module circuit is shown in Figure 3, which consists of two parts: ultrasonic generation and emission. There are two methods for generating ultrasonic waves: hardware generation and software generation. The commonly used hardware generation method often adopts the following scheme: the ultrasonic wave is generated by the oscillator composed of CD4011, and is emitted by driving the ultrasonic transducer through the step-up conversion. The start and stop of the oscillator are controlled by the single-chip microcomputer. This design adopts the software generation method, because the software generation method can not only reduce the complexity of the hardware and the cost of the system, but also has the advantages of strong flexibility, easy implementation and good stability. This system uses the timer function of the MSP430F2274 single-chip microcomputer to generate a stable PWM (40Hz) pulse wave, and outputs it to the ultrasonic emission part through the I/O port P2.3. In the ultrasonic emission circuit, CD4049 includes a total of 6 NOT gates, and only 3 are used in the circuit in Figure 3. In order to prevent interference or electrostatic breakdown that causes damage to the entire CD4049, the 3 NOT gates on the unused side are connected in series for grounding. When the control end outputs a series of fixed frequency pulses, the piezoelectric ceramic ultrasonic transmitting transducer UCM-40-T adds positive and reverse voltages at a fixed frequency to emit high-power ultrasonic waves. The waveform obtained is more ideal than other methods. [page]
Figure 3 Reversing radar ultrasonic transmission module
The ultrasonic transmission module circuit is shown in Figure 3, which consists of two parts: ultrasonic generation and emission. There are two ways to generate ultrasonic waves: hardware generation and software generation. The commonly used hardware generation method often adopts the following scheme: the ultrasonic wave is generated by the oscillator composed of CD4011, and is emitted by the ultrasonic transducer after the boost conversion. The start and stop of the oscillator are controlled by the single-chip microcomputer. This design adopts the software generation method, because the software generation method can not only reduce the complexity of hardware and reduce the cost of the system, but also has the advantages of strong flexibility, easy implementation and good stability. This system uses the timer function of the MSP430F2274 single-chip microcomputer to generate a stable PWM (40Hz) pulse wave, and outputs it to the ultrasonic emission part through the I/O port P2.3. In the ultrasonic emission circuit, CD4049 includes a total of 6 non-gates, and only 3 are used in the middle line of Figure 3. In order to prevent interference or electrostatic breakdown that causes damage to the entire CD4049, the 3 non-gates on the unused side are connected in series for grounding treatment. When the control end outputs a series of fixed frequency pulses, the piezoelectric ceramic ultrasonic transmitting transducer UCM-40-T adds positive and reverse voltages at a fixed frequency to emit high-power ultrasonic waves. The waveform obtained is more ideal than that obtained by other methods.
Figure 4 Reversing radar ultrasonic receiving module
The amplifier CX20106 is composed of a preamplifier, a limiting amplifier, a bandpass filter, a detector, an integrator, and a rectifier. The preamplifier has an active gain control function, which can make the amplifier have a higher gain when the ultrasonic sensor receives a weak voltage from a far-away reflected signal, and the amplifier will not be overloaded when the input signal is strong at a close distance. By adjusting the external resistor R3 of the chip pin 5 and setting the intermediate frequency of its filter at 40kHz, a good effect was achieved. When receiving a signal that matches the intermediate frequency of the filter, its output pin 7 outputs a low level, and the output pin 7 is directly connected to P2.2 of the MSP430F2274 to trigger an interrupt.
Figure 5 Reversing radar sound and light alarm circuit diagram
The alarm module uses a simple sound and light alarm circuit, as shown in Figure 5. First, a critical value is set. When the distance between the rear of the vehicle and the obstacle is less than the set minimum distance, the red indicator light flashes and the green indicator light goes out. The microcontroller sends PWM pulses to its port. As the distance decreases, the duty cycle of the PWM pulse is controlled to increase the frequency of flashing and buzzing, thereby alerting the driver.
Figure 6 Reversing radar communication interface circuit diagram
The communication interface circuit is shown in Figure 6. Using Maxim's MAX3232 chip, the peripheral circuit is very simple, requiring only five 0.1μF capacitors. This circuit isolates the microcontroller serial port output signal and transforms it into an RS-232 signal and sends it to the car bus. At the same time, it can also realize the communication between the system and the computer.
Figure 7 Reversing radar keyboard display circuit diagram [page]
The keyboard and display circuit is shown in Figure 7, which consists of a keyboard and a liquid crystal display. The keyboard uses independent keys, with 3 keys, a setting key, an up key, and a down key. It can set various parameters such as alarm value, working mode, clock, etc. The liquid crystal display circuit uses ZJM12864BSBD, a low-power dot matrix LCD with a display format of 128 dots (columns) × 64 dots (rows). It has multi-function instructions and is easy to use. It can display clock, distance and alarm prompt information in real time, which is convenient and intuitive.
System software design
The software adopts modular design. The program consists of multiple modules such as the main program, distance measurement sub-program, keyboard display sub-program, clock display sub-program, etc. During the debugging process, each functional module and sub-program are debugged one by one. After each sub-program completes the specified function, comprehensive debugging is carried out. The software flow of the system is shown in Figure 8.
Figure 8 System software flow chart
The ultrasonic transmitter starts to count at the same time as it emits ultrasonic waves. When it encounters an obstacle, it will send a feedback signal to the ultrasonic receiver. After being processed by the CX20106 receiver, a low pulse will be generated. The signal will be sent to the microcontroller to generate an interruption, call the distance measurement subroutine, calculate the measured distance, call the display subroutine, and display the distance and alarm on the LCD according to different measured values. When the distance is greater than 2m, it will display "safe" and the measured distance, and continue to measure; when the distance is less than 1m, it will display "" and the measured distance, and the buzzer will be driven by P1.2 to alarm; when the distance is less than 2m and greater than 1m, it will display "attention" and the measured distance. In order to enhance the anti-interference ability, the system continuously transmits ultrasonic measurements three times, removes the maximum and minimum values, and takes the median value to calculate the exact distance. In this way, about three data can be measured per second, which can still meet the timeliness requirements.
Conclusion
The reversing radar uses the high-performance MSP430F2274 microcontroller and makes full use of its on-chip resources to make the system more functional, reduce the number of peripheral chips used, and improve the reliability of the system. The reversing radar is used in cars. When the driver is reversing, he can see the distance of the obstacle from the car at a glance on the LCD screen, overcoming the shortcomings of small rearview mirrors and narrow field of view, and eliminating the hidden dangers of accidents caused by reversing.
References:
[1]. CD4011 datasheet http://www.dzsc.com/datasheet/CD4011_214522.html.
[2]. CD4049 datasheet http://www.dzsc.com/datasheet/CD4049_1865297.html.
[3]. CX20106 datasheet http://www.dzsc.com/datasheet/CX20106_1135440.html.
[4]. MAX3232 datasheet http://www.dzsc.com/datasheet/MAX3232_1107769.html.
[5]. RS-232 datasheet http://www.dzsc.com/datasheet/RS-232_584855.html.