In the microcontroller application system, it is quite difficult to completely store an image of 30 fps and 640×480 pixels due to the limitations of image acquisition speed, program memory and data memory addressing space. This paper uses a high-performance 16-bit Freescale microcontroller to directly acquire images at ultra-high frequency, but can only acquire 320 pixels per line, lose images, and cannot obtain a complete image. This paper solves this problem better by adding a FIFO chip AL422B in the image acquisition process, which reduces the cost of the image acquisition system compared to the expensive DSP. 1
Monocular point light source ranging principle
When working in the field, it is necessary to know the distance between the front benchmark and the observation point during movement. This paper makes the benchmark into an equally spaced infrared point light source benchmark, which meets the requirements of the pinhole imaging principle ranging model based on a single-frame static image, reduces the amount of image processing, and improves the real-time and all-weather performance of the measurement. H is the actual distance of each point light source benchmark; n is the number of point light sources, which can be obtained through image processing; f is the focal length of the camera; the actual pixel physical distance h of the ruler is obtained by camera calibration. The schematic diagram of the long-distance ranging principle is shown in Figure 1, where the entire point light source pole is within the camera's field of view. The schematic diagram of the short-distance ranging principle is shown in Figure 2, where only part of the point light source pole is within the camera's field of view. From Figure 1, the distance D between the front pole and the observation point can be calculated. The imaging geometry of the camera can also be approximately expressed by the pinhole imaging principle:
[page]
2 Hardware Design of Image Acquisition System
According to the requirements of monocular vision ranging, a black and white camera is required to collect the point light source benchmark of the front vehicle in real time, and the distance of the front vehicle is calculated by the pixel distance of the point light source on the ruler. In order to read the image completely, this paper adds a FIFO chip, and the schematic diagram of the image acquisition principle is shown in Figure 3. The single-chip microcomputer monitors the line/field signal of the camera and controls the FIFO to read the corresponding image; after reading all the lines, the FIFO image reading function is turned off, and the single-chip microcomputer starts to read the image data from the FIFO and performs corresponding image processing. According to the complexity of the image processing, the time ratio of image processing and image acquisition is determined. Since FIFO is first-in-first-out, the single-chip microcomputer only needs to enable the line/field signal through an interrupt when reading data, and the single-chip microcomputer can be used for image processing most of the time. This paper adopts that after collecting a frame of image, the single-chip microcomputer uses the idle time of two frames of image and the next frame of FIFO acquisition time, a total of about 3 frames of time for image processing and control, the result is that the image changes from the original 30 fps to 10fps. Although the frame rate is slow, analysis shows that at 100 km/h, the lag distance is 2.8 m, which meets the requirements.
2.1 Freescale 16-bit MCU MC9S12DG128
This article uses Freescale 16-bit MCU MC9S12DG128 as the main control chip. This chip is an enhanced, automotive-grade 16-bit microcontroller in the S12 series of microcontrollers launched by Freescale. The on-chip bus clock frequency can reach up to 25 MHz. It integrates 8 KB RAM, 128KB Flash, and 2 KB EEPROM. It has high integration and rich resources.
2.2 Camera chip OV7670
OV7670 is a Camerachiptm image sensor launched by OmniVision. It has a small size and low operating voltage. The VGA image can reach up to 30fps. Its main features are:
◆ Photosensitive array (a total of 656×488 pixels, and the effective pixels in YUV mode are 640×480);
◆ High sensitivity is suitable for low-light applications and is sensitive to infrared light;
◆ Standard SCCB interface, compatible with I2C bus interface;
◆ RawRGB, RGB (GRB4:2:2, RGB565/555/444), YUV (4:2:2) and YCbCr (4:2:2) output formats;
◆ Support VGA, CIF and various sizes from CIF to 40×30.
2.3 FIFO chip AL422B
AL422B is a FIFO storage chip with a storage capacity of 393 216 bytes × 8 bits launched by AverLogic. All of its addressing, refreshing and other operations are completed by the control system integrated in the chip. The internal functional structure block diagram of AL422B is shown in Figure 4.
The main features of AL422B are:
◆ The storage body of AL422B is 3 Mb (393 21 6 bytes × 8 bits);
◆ It can store one frame of graphics information in VGA, CCIR, NTSC, PAL and HDTV formats;
◆ Independent read and write operations, can accept different I/O rates;
◆ High-speed asynchronous serial access;
◆ Read and write cycle is 20 ns;
◆ Access time is 15 ns;
◆ Internal DRAM self-refresh.
[page]
3 Image acquisition system program design3.1 System implementation
To realize static storage of digital images in the single-chip microcomputer application system, two major problems must be solved: storage speed and storage capacity. For the speed problem, it is necessary to analyze the data output timing of OV7670 to meet the requirements. The VGA timing diagram is shown in Figure 5. PCLK is the pixel clock, and its frequency is consistent with the main frequency, that is, 27 MHz. The data output is valid on the rising edge; VSYNC is the field signal;
HREF is the horizontal reference signal, which is high when the pixel is valid in the window, otherwise it is low; HSYNC is the row signal; D[7:0] is the 8-bit data output.
The timing diagram of AL422B write operation is shown in Figure 6. WCK is the write clock of AL422B, with a maximum cycle of 1000 ns and a minimum cycle of 20 ns (corresponding to a main frequency of 50 MHz); data is written at its rising edge, and the write pointer automatically increases as the clock is input into it. It can be seen that the speed of AL422B meets the design requirements. In specific operations, the write enable/WE of AL422B is controlled by the I/O port of the microcontroller to be low, enabling the write function, and the data terminal DI7~0 writes data at the rising edge of WCK. After writing an image, the write reset/WRST is controlled by the I/O port of the microcontroller to be low, enabling reset, and the data write address pointer will return to the 0 address position.
The timing diagram of AL422B read operation is shown in Figure 7. RCK is the read clock of AL422B, with a maximum cycle of 1000 ns and a minimum cycle of 20 ns. When /RE and /OE are valid, the data is valid on its rising edge. With the input of this clock, its internal read pointer automatically increases. When the main frequency of the microcontroller is 25 MHz, it cannot directly provide a clock to the system clock XCLK of OV7670. We use an external crystal oscillator to provide a 27 MHz same frequency signal to OV7670.
[page]
The schematic diagram of the image acquisition circuit is shown in Figure 8. The pixel clock PCLK of OV7670 is directly connected to the data read clock WCK of AL422B. In specific operation, the I/O port of the microcontroller controls the read enable/RE and output data enable/OE of AL422B to make them low level; enable the data read function, and the data terminal DO7~0 outputs the data to the microcontroller at the rising edge of RCK. After reading an image, the I/O port of the microcontroller controls the write reset/RRST to make it low level, enable reset, and the data read address pointer will return to the 0 address.
3.2 Programming
The programming flow is shown in Figure 9. When the MCU detects that the field signal is updated, it starts to monitor the arrival of the line signal, then enables /WE and starts to read the image sequentially. After reading a frame of image, turn off /WE, enable /RE and start to read 640 pixels in the first line of image. This paper adopts the method of reading and processing, which better solves the problem of up to 3 MB of a frame of image. Point
light The infrared light emitted by the source benchmark presents several halo areas on the image. The image coordinates of the point light source can be found by finding the center of the halo. For this purpose, each pixel point is compared with the threshold while reading. The pixel point less than the threshold is a suspected point light source and the corresponding coordinates are recorded; when a row of pixels is read, a group of pixel positions of the suspected point light source coordinates are obtained, which are statistically averaged to obtain the coordinates of the point light source in the row, which is up to 12 bytes (6 for the front benchmark and 6 for the side benchmark), which is much less than 640 bytes of the entire row.
When a frame of pixels is read, a maximum of 12×480 bytes are obtained, which can be fully stored in the 64 KB capacity of the microcontroller. Finally, the rows are averaged to obtain the final point light source coordinates. It has been verified that the total time required is completed within 2.15 frames of image.
Conclusion
This paper discusses the point light source image acquisition system based on FIFO chip and microcontroller, describes the monocular point light source ranging principle, image acquisition system hardware and software design methods, and focuses on the bridge role of FIFO chip in image acquisition. Through the system prototype test, it can meet the requirements and achieve the expected effect.
Previous article:Design of real-time acquisition of all-digital images based on USB2.0 microcontroller
Next article:Microcontroller extended RAM read and write timing experiment
Recommended ReadingLatest update time:2024-11-16 17:49
- Popular Resources
- Popular amplifiers
- Point Cloud Registration from Beginner to Master (Guo Hao)
- A review of learning-based camera and lidar simulation methods for autonomous driving systems
- Semantic Segmentation for Autonomous Driving: Model Evaluation, Dataset Generation, Viewpoint Comparison, and Real-time Performance
- Image segmentation: principles, techniques and applications
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!
- 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
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Proteus MSP430 MCU simulation example 16 - timer timing 1 second
- Building ESP32-C3 development environment based on window Visual Studio Code: ESP-IDF
- [AT-START-F403A Review] + Unsuccessful W25Q128 Read and Write
- A brief discussion on LTE technology and practical application solutions
- What is the drilling process in the Siliton ceramic substrate PCB?
- SD/TF card usage issues
- Download address of Arteli technical resources
- MSP430F249 external interrupt P1.3 port
- It was despised the day before yesterday, it was debunked yesterday, and today... it was blocked.
- J-linK connection problem