introduction
Electronic information and digital image processing technology have been widely used in various fields, and the informatization of vehicle-mounted systems has become an important symbol of the modern automobile industry. Today's reversing radar systems can provide a lot of help to drivers. Most of them use ultrasonic ranging technology, which can directly display the distance between the rear of the car and obstacles. However, due to the scattering characteristics of ultrasonic waves, if there are sharp protrusions on the ground or angular objects in the air, the system cannot effectively "detect" them. If a visual function can be added to the existing reversing system, the driver can clearly see the situation behind the car without having to look back when reversing. This paper designs a visual safety reversing system, which uses an embedded Linux operating system kernel to drive a USB camera to realize real-time monitoring of the situation behind the car, and activates the voice alarm function by judging whether the ultrasonic ranging reaches the threshold.
1 System design
As shown in Figure 1, the system consists of a main control module, an ultrasonic transceiver module, a USB camera image acquisition module, a voice alarm module, and an LCD display module. The main control module uses Samsung's S3C2440 microprocessor based on the ARM9 core, with a maximum frequency of 533 MHz and a fast processing speed. Software programming technology is used to control its peripheral circuits and provide various signals required by the peripheral circuits, simplifying the design difficulty of the peripheral circuits.
2 System Hardware Design
2.1 Main control module
The composition of the main control module hardware platform with S3C2440 as the core is shown in Figure 2.
2.2 Ultrasonic transmitting circuit
The schematic diagram of the ultrasonic transmitting circuit is shown in Figure 3. The transmitting circuit is mainly composed of the inverter 74LS04 and the ultrasonic transmitting transducer T1, and uses the 40 kHz square wave signal output by the PWM timing counter inside the CPU.
One path is sent to one electrode of the ultrasonic transducer (pin 1 of T1) after passing through a first-stage inverter (U1C and U1E are connected in parallel to form a first stage); the other path is sent to the other electrode of the ultrasonic transducer (pin 2 of T1) after passing through two-stage inverters (U1D is the first stage, U1B and U1A form the second stage). This push-to-switch form adds square wave signals to both ends of the ultrasonic transducer to increase the emission intensity of the ultrasonic wave. Two inverters are connected in parallel at the output end to improve the driving ability. The upper resistors R1 and R2 can improve the driving ability of the inverter 74LS04 to output a high level on the one hand, and enhance the damping effect of the ultrasonic transducer on the other hand.
2.3 Ultrasonic receiving circuit
The schematic diagram of the ultrasonic receiving circuit is shown in Figure 4. CX20106A is a dedicated chip for infrared detection and reception, commonly used in infrared remote control receivers for televisions. Its advantages are simple and easy to use, simple circuit connection, and reduced trouble in production debugging. When CX20106A receives a 40 kHz signal, it will generate a low-level falling pulse at pin 7. This signal can be connected to the external interrupt pin of ARM as an interrupt signal input. [page]
2.4 USB camera image acquisition module
A USB digital camera using the Vimicro ZC0301 chipset. Compared with analog cameras, its advantages are: the CMOS image sensor can directly generate raw image data; the hardware supports standard JPEG compression; it has a mainstream high-speed USB bus device interface, etc. For cameras, the information transmission type on the USB bus is usually real-time transmission. The USB device side provides several communication ports, and a logical communication pipeline is established between the host and the port for data transmission. In the device initialization phase of the camera, the host communicates with port 0, and the driver detects the camera model and all port information. Entering the data transmission phase, the host establishes a communication pipeline with the detected real-time input port, and transmits back the image data captured by the camera in real time.
2.5 Voice Alarm Module and LCD Display Module
The voice alarm module uses the XF-S3011 Chinese speech synthesis chip produced by Anhui Zhongke University iFlytek Information Technology Co., Ltd. It is a single-chip processor designed for embedded applications and has the ability to synthesize any Chinese text. XF-S3011 receives commands and data sent by the host computer through the serial port (UART). The commands and data are packaged and sent in the form of frames, and the maximum length of the data allowed to be sent is 200 bytes. Its driving circuit is designed in a triode driving mode. When the distance measured by ultrasound is less than the set threshold, S3C2 440 sends a control command to XF-S3011 to start the voice alarm to remind the driver to pay attention. The display module uses Donghua 3.5-inch TFT LCD (resolution is 320×240), and uses the Frame. Buffer device under embedded Linux to drive the LCD.
3 System Software Design
This paper chooses the embedded Linux operating system. It has the characteristics of being customizable, stable kernel, powerful, and supporting multiple hardware platforms. First, a cross-compilation development environment is established on a PC (host) equipped with the Linux operating system, and the S3C2440 control module is used as the target board. Then, the low-level driver and top-level application required for this design are written on the PC using the C language with good portability, and then the cross-compilation debugging tool is used to compile and link to generate executable code, and finally ported to the target board.
3.1 Design of video image acquisition and LCD display program
Step 1, use the USB camera driver spca5xx of the ZC0301 chip group to dynamically load. The source code of this driver consists of 4 parts: the initialization module of the device module, the uninstallation module, the upper software interface module and the data transmission module. Unzip it under kernel/driver/usb and apply the patch. When compiling the system kernel, make menueonfig in the kernel directory of arm linux; select Video for linux under Multimedia device under <*>, load the Vide04linux module, and provide programming interface functions and related data structures for the video acquisition device; (M) select SPCA5XX.
Step 2: Use Linux's Video4linux to access the USB camera device, collect video images, and capture real-time data streams. The program flow is shown in Figure 5.
Define the data structure for the program:
This design uses MiniGui to load jpeg to achieve real-time LCD display of images collected by USB camera. When compiling the program, jpeg library support is added. The idea of programming is to continuously collect images from the camera and store them in /tmp/l.jpg. In MiniGUI, the Linux graphical user interface support system, images are loaded through the loadbitmap function, but the image will not be automatically updated after loading, and cannot automatically change according to the changes of 1.jpg. Therefore, a timer should be set in the program to refresh the screen every 100 ms, which basically realizes real-time update. [page]
3.2 Design of Ultrasonic Distance Measurement Driver
The function of the ultrasonic generator program is to generate a square wave with an ultrasonic signal frequency of about 40 kHz by the PWM timing counter. Timer0 is used, and Timerl is turned on for timing. The ultrasonic rangefinder main program uses external interrupts to detect the returned ultrasonic signal, and once it is found, it immediately enters the interrupt program. After entering the interrupt, Timerl is immediately turned off to stop timing, and the ranging success flag word is assigned a value of 1. The program flows are shown in Figures 6 to 8.
When the main program detects the successful reception flag, the distance between the rear of the vehicle and the obstacle can be calculated using the following formula (the speed of sound C at 20°C is taken as 344 m/s during design):
S=(C·T1)/2
Wherein, T1 is the count value of the counter Timerl.
This part of the program can be designed as a character device driver under Linux. The Linux system provides a device driver interface function struct file_operations data structure to realize the opening, reading, writing, releasing and controlling of the ultrasonic sensor device. The initialization and parameter setting of the timer and external interrupt related registers are completed in the open() interface function. It is defined in this device driver. The data structure of file_operations is:
The s3c2440_sonar_open() function is used to open the device. The s3c2440_sonar_rcad() and s3c2440_sonar_write() functions are used to read and write the device. The s3c2440_sonar_re-lease() function completes the release of the interrupt. The s3c2440_sonar_ioctl() function is used to control the timing interrupt and ranging value in the device. The copy_to_user() function and put_user() function are used to realize data transfer. The device is opened under the application to realize data transfer between kernel state and user state. The module initialization function s3c2440_sonar_init() realizes device initialization, interrupt initialization and processing, device registration, etc. The static void s3c2440_sonar_exit() is used to stop interrupts and release resources when the module is unloaded.
3.3 Voice alarm program design
When the measured distance value is less than the threshold, S3C2440 sends a control command to XF-S3011 to start the voice module. The following is part of the code that makes up a voice synthesis command frame:
After the command is synthesized, it can be sent to the XF-S3011 module. In the embedded Linux system, first open the XF-S3011 device file, then write the command frame to the file, and finally close the device file.
Conclusion
This paper uses an embedded Linux operating system and Samsung's S3C2440 microprocessor to design a safe reversing system with visual and voice alarms, which has high practical value. In the process of displaying video image processing, the distance between the rear of the car and the obstacle can be measured by ultrasound. When the distance value is less than the preset distance, there will be a voice alarm to the driver. The experiment has verified that the system runs stably, allowing the driver to accurately grasp the road conditions behind the car, and improves the safety of reversing.
References:
[1]. S3C2440 datasheet http://www.dzsc.com/datasheet/S3C2440_589562.html.
[2]. 74LS04 datasheet http://www.dzsc.com/datasheet/74LS04_772886.html.
[3]. U1C datasheet http://www.dzsc.com/datasheet/U1C_1541774.html.
[4]. U1B datasheet http://www.dzsc.com/datasheet/U1B_2041186.html.
[5]. CX20106A datasheet http://www. dzsc.com/datasheet/CX20106A_113.html.
[6]. ZC0301 datasheet http://www.dzsc.com/datasheet/ZC0301_732115.html.
Previous article:Application of S3C44B0X in Embedded Socket Communication System
Next article:Design of DRM test receiver
Recommended ReadingLatest update time:2024-11-17 01:57
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- Things to note when using peelable adhesive
- Last day! TI Live Broadcast with Prizes | Application of Precision ADC in Transmitters
- Renesas CPK-RA6M4 development board evaluation + SHT20 sensor reading data
- Share 2018 Electronics Competition Paper - [B- Fire Extinguishing Aircraft] Fujian Province Ti Cup Special Prize / Xiamen University / Changmen University Team
- Constant voltage and constant current power supply design
- About the difference between CC1312R LAUNCHPAD versions
- About the signal input mode of the power amplifier
- My Journey of MCU Development (Part 1)
- How to understand the accuracy parameter (1.5% + 3) of the Fluke F17B+ multimeter?
- Another bottleneck.