Visual safety reversing system based on embedded Linux operating system

Publisher:甜美瞬间Latest update time:2018-02-26 Source: eefocusKeywords:Linux Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  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.

  

System structure diagram www.elecfans.com


 

  2 System Hardware Design

  2.1 Main control module

  The composition with S3C2440 as the core is shown in Figure 2.

  

The core of the S3C2440 is www.elecfans.com

 

  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.

  

Ultrasonic transmitter circuit schematic www.elecfans.com

 

  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.

  

Ultrasonic receiving circuit schematic diagram

 

  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.

  

Procedure flow chart

 

  Define the data structure for the program:

  

Program-defined data structures

  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.

  

Procedure flow chart

 

  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.


Keywords:Linux Reference address:Visual safety reversing system based on embedded Linux operating system

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

How to develop stc51 microcontroller under Linux
The first time I came into contact with a single-chip microcomputer , I naturally chose the simple 51 single-chip microcomputer. However, my operating system is Linux. It seems easy to get started with 51 under Windows. But it is not very smooth to build a 51 development environment on Linux. So let's talk about how
[Microcontroller]
OK6410A Development Board (VIII) 28 linux-5.11 Analysis of fork from the perspective of OK6410A process
Fork means bifurcation, a process is divided into two processes Previously, a multi-process OS was implemented, and fork must have been implemented https://github.com/lisider/learn_os/tree/master/process Let's take a look at what the essence of forking a process XXX is 1. Find a space for TCB 2. Fill in the sp mem
[Microcontroller]
OK6410A development board (eight) 80 linux-5.11 OK6410A CFS scheduler
What is the relationship between the CFS scheduler and the CFS scheduler class? There are two scheduler policies in the CFS scheduler class: SCHED_NORAML SCHED_BATCH , what does this have to do with the scheduler CFS CFS Completely Fair Scheduling  Complete fairness is reflected in the fact that the total virtual ru
[Microcontroller]
Transplantation Method of Linux to Target System AT91RM9200 and Analysis of Application Advantages
1 Introduction At present, embedded processors based on ARM micro-cores have become the mainstream of the market with their advantages of low power consumption and powerful functions. At the same time, the Linux operating system developed on the Internet is becoming more and more popular with its powerful functions, o
[Microcontroller]
Transplantation Method of Linux to Target System AT91RM9200 and Analysis of Application Advantages
OK6410A development board (eight) 64 linux-5.11 OK6410A linux exception analysis
In ARM, exception A is a hardware concept.  In Linux, exception B is a software concept Linux exception classification  Whether the arm exception is used yes Some of them take advantage of arm exceptions Page fault exception no Some are not used Division by 0 exception Can users feel yes Some abn
[Microcontroller]
The difference between ARM-Linux development and MCU development
      There are two main ways to develop ARM applications: one is to develop applications directly on ARM chips without using an operating system, also known as bare metal programming. This development method is mainly used on some low-end ARM chips, and its development process is very similar to that of a single-chip
[Microcontroller]
Construction of experimental platform environment based on arm920T embedded Linux
    The usage of embedded operating systems for ARM microprocessor architecture has continued to grow in recent years. Among various embedded operating systems, Linux is the third most supported force.     Currently, ARM Linux supports ARM processors including ARM610, ARM710, ARM720T cores, ARM920T cores, StrongARM 11
[Microcontroller]
Construction of experimental platform environment based on arm920T embedded Linux
[JZ2440] Configure and compile linux-2.6 kernel
1. Acquisition of relevant information   Personally, when I was learning the mini2440 development board, I followed teacher Wei Dongshan’s videos. The videos and information can be obtained from the Baiwen.com forum.   Baiwen.com forum link: http://www.100ask.net/bbs/forum.php   After downloading the information
[Microcontroller]
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号