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 suspended in mid-air, the system cannot effectively "perceive". 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 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 , 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 ease of 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, which can be connected to the external interrupt pin of ARM as an interrupt signal input.
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 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 unloading 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 dev IC e 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 to 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 captured by the USB camera. When compiling the program, the support of the jpeg library is added. The programming idea is to continuously capture images from the camera and store them in /tmp/l.jpg. In the Linux graphical user interface support system MiniGUI, images are loaded through the loadbitmap function, and the image will not be automatically updated after loading, and cannot automatically change according to the changes in 1.jpg. Therefore, a timer should be set in the program to refresh the screen every 100 ms, which basically realizes real-time updates.
3.2 Design of Ultrasonic Ranging 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. stat IC 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.
Previous article:OpenCV accelerates embedded system development applications
Next article:Driver Development of MISC Device AD7859L Based on Linux
Recommended ReadingLatest update time:2024-11-15 10:55
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- ASML predicts that its revenue in 2030 will exceed 457 billion yuan! Gross profit margin 56-60%
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- 【iFixit】Detailed disassembly of AirPods Pro, repairability score is 0!
- C++ GUI Qt 4 Programming (Second Edition)
- TMS320F28027 ADC priority
- How are chips made? CCTV's most powerful science popularization!
- Unboxing and verifying BOX function through APP
- Thermostat reference design based on TI SimpleLink wireless MCU
- Pre-registration for the live broadcast with prizes | ST Data Center and Communication Network Power Management Solutions
- MSP430 - Key interrupt control small light flip
- [NXP Rapid IoT Review] Rapid IoT Studio: The First Step in Simple Programming
- Adafruit Funhouse Development Board