The printed circuit boards appearance inspection machine is an important quality inspection equipment on the PCB board product production line. It is based on the principle of optical image processing and computer vision recognition technology. Its main function is to detect the appearance defects encountered in the production process of PCB board components. China is a big country in PCB board production in the world, but not a strong country. An important link in the PCB board production chain - PCB board equipment and instruments are not strong is one of the important reasons for this situation. In order to promote the development and progress of China's PCB board industry, Compared with the automatic appearance inspection machine, a manual PCB board appearance inspection machine with simpler operation, more compact system and higher performance-price ratio is developed. The manual PCB board appearance inspection machine automatically transmits the PCB board through the manual board post-transfer device, and the linear CCD camera scans the PCB board evenly to obtain accurate images. The feedback control signal automatically sorts the PCB board (OK/NG). It can detect foreign objects, exposed copper, oil replenishment, scratches, poor gold plating, wrong characters, uneven green oil, uneven pads, residual copper, missing printing, development and other appearance defects. Since the speed and effect of image acquisition and processing will directly affect the accuracy and effectiveness of PCB board detection, the image acquisition system is studied in detail according to the characteristics of manual visual inspection machines, and C# is used. Net framework is used for secondary development of ActiveMil and the development of image acquisition software system is realized with GDI+graphics interface library.
1. The overall structure of the PCB board appearance inspection machine system
The PCB board online detection system has a complex structure, and its transmission control equipment, electrical control system and camera must be controlled by a computer to coordinate processing work and complete complex detection and sorting tasks. The structure of the PCB board online inspection equipment based on machine vision, the system is mainly divided into motion control, image acquisition and image processing parts. The image acquisition part is an important part of the whole system. Cameras and lenses are equivalent to human eyes in machine vision, and are responsible for capturing images of objects. The image acquisition part is an important part of the PCB board detection system, and it is also the basis of detection processing. The PCB board inspection system emphasizes the speed and accuracy of inspection, so the image acquisition part needs to provide clear images in a timely and accurate manner.
2. The hardware structure of the image acquisition system
2.1 The working principle of the image acquisition system
When the system is powered on, the MCU automatically detects whether the PCB stage is reset to the starting point. This process is mainly completed by two fiber optic sensors and servo motors. Two sensors are installed at the starting point of the motor track, namely the reset point and the track endpoint. It has the functions of reset, stop and motor reversal. After power-on, the MCU detects that the sesorl (reset point or starting point) is invalid, and calls the motor reversing program to make the PCB stage return to the starting position, and the serial port sends a color image invalid signal to the PC. Then the MCU continues to judge whether a key is pressed. If a key is pressed, the motor starts to rotate forward, and the serial port sends a color image valid signal to the PC. This process is also the PCB board line scanning process to complete the image acquisition. In this process, the motor goes through three stages: acceleration stage, constant speed stage and deceleration stop stage. During the forward rotation of the motor, starting from seven o'clock, the MCU counts the pulses fed back by the servo motor encoder through the unique capture and comparison unit (CCU6), but when the count value reaches the effective value of the image acquisition, the serial port sends the acquired image to the PC. Start signal, at this time, the linear array CCD starts to image the PCB board. When the motor decelerates forward to the sensor 2 at the end of the track, the motor stops and immediately reverses back to the starting point. In this process, the serial port sends an invalid signal to the PC. So far, a complete detection process is complete. The MCU continues to detect whether a button is pressed for down detection. Among them, the acquisition valid and start signals sent by the serial port can effectively avoid false triggering. The image signal collected by the CCD is sent to the image acquisition card by the Camrelink interface, and then further image processing is performed by the PC.
2.2 Reception and detection of sensors and buttons
Using optocoupler isolation technology can realize optoelectronic isolation between circuits, even if the input signal can pass through without resistance, and prevent the output signal from being fed back to the input terminal, which is beneficial to suppress the interference of spikes and various noises, stable operation, no contact, use Long life and high transmission efficiency. In order to detect the feedback speed signal of the rotating mirror in real time, the high-speed optocoupler ACPL-072L is used in this design, the transmission rate can be as high as 25 MBd, and the peripheral circuit is simple. This design utilizes the CC25 port of the capture/comparison unit in the XC164CS peripheral, and uses the optocoupler transmission signal as an external interrupt signal to trigger the XC164 to achieve high-speed sensor positioning and button detection.
2.3 CCD camera system
The image acquisition system of this manual PCB board appearance inspection machine adopts the 3CCD color line scan camera NUCLi7300 of NED rainbow series. The camera has a wide range of applications and can perform color difference detection that was previously impossible with black and white cameras. The external interface is a high-speed serial interface (Camera Link), which can be easily connected to the capture card, and can also easily set the gain and offset, and has the function of correcting the RGB line delay. The number of pixels is 7 300x3 Line, the pixel size is 10x10 μm, the data rate is 60MHz, and the short scan rate is 7.6kHz. The frame acquisition card in the system is Matrox's SoliosXCL-SU74, which has its own processor to handle two independent base modes or one mid-mode Camera Link configuration, 66 MHz acquisition rate, 64 MB buffer, and can acquire area arrays. and line scan cameras with multiple acquisition modes. At present, most of the image inspection systems on the market use area scanning (Areascan) cameras to collect and analyze images. However, due to the large size range of the PCB board products inspected by this PCB board appearance inspection machine - 50 mmx50mm ~ 330mmx250 mm, the accuracy is high. The resolution and image acquisition speed of the area scan camera cannot meet these requirements, so the system selects the line scan CCD. However, the line scan detection system must use the motion speed to obtain the area shadow, that is, when the PCB board under test moves to the camera's field of view, the hardware sends a trigger signal to the camera to start acquisition, so the acquisition mode of the acquisition card is set to hardware trigger synchronization Collect and allocate 64 M of memory.
3. Software system composition
The development language used for the software of the image acquisition system is C#, and the software development kit is the AetiveMil9.0 component. Matrox has a rich package - Image Processing and Pattern Recognition Library (MIL) and MIL's sub-library MIL-LITE (Basic Image Processing). MIL is a hardware-independent 32-bit image processing library, which utilizes Intel's MMX multimedia graphics acceleration function to optimize the image processing library and can process binary, grayscale or color images, and it is independent of hardware platform. And for rapid Windows application development, MIL bundles ActiveMIL. AetiveMIL is a* dynamic control for managing image acquisition, processing, analysis, display and archiving. Aeti-veMIL is fully integrated into Microsoft Visual Basic, Visual C++ and . net rapid application development environment. The image acquisition system uses the AetiveMil control library, which can realize all the functions of all MIL, and because of the use of ActiveX controls, it greatly reduces the difficulty of programming, shortens the software development cycle, and improves the application system stability.
3.1 Image acquisition program based on AclivrMil
The basic idea of the image acquisition program is: 1) Open the communication channel, that is, determine an application object (Application), and create one or more system objects (System) for each application object. 2) Initialize hardware resources, that is, allocate data buffer (Data Buffer), data collector (Digitizer) and data display (Display) objects for each system object. 3) Start the acquisition process, that is, read the image into the data cache, and assign the cache to the array, and realize the processing of the image by processing the array. After the image data is associated with the data display, the preprocessing can be displayed through the display control or form. the result after. AetiveMIL allows developers to quickly and easily combine a graphics application with a Windows user interface. Application development includes drag and scroll tool placement as well as punctuation and click configuration, substantially reducing the amount of code. exist. Net framework 3.0 card hair environment, after installing the MIL development package and configuring it correctly, the components such as Application, System, Image, ImageProcess, and Display will be automatically added to the toolbar. The developer drags the required controls onto the image acquisition form, an Application, corresponding to the single-lens manual appearance machine, a System, a single form display - a Disp-laly, in order to improve the CPU usage, dual Buffered asynchronous acquisition - two ImageBuffers, and one ImageProcess.
3.2 The idea of double-buffer asynchronous acquisition
Matrox MeteorII frame grabber supports two acquisition methods, synchronous and asynchronous. The synchronous acquisition mode is suitable for continuous acquisition and display of images without arithmetic processing. This is because in the synchronous acquisition mode, before each image acquisition, the CPU sends an acquisition synchronization signal to the acquisition card, and then waits for the acquisition to end. During the process, the CPU can only be in a waiting state because the image data cannot be obtained. Since it takes about 40 ms for the CCD to collect only one frame of image, which is roughly equivalent to the human visual retention, it cannot guarantee that the acquisition and processing are completed within 40 ms in the synchronous mode, and it cannot meet the requirements of real-time processing. In the asynchronous acquisition mode, the acquisition work and the computer's image processing work can be carried out at the same time, that is, when the CPU processes the image of the current frame, the CCD camera can perform the image acquisition of the next frame. Therefore, when programming, a buffer mechanism is needed to buffer the currently collected images and the images to be collected or being collected by the CCD camera, so as to realize the parallel work of image collection and processing. Obviously, using this double-buffer acquisition method can not only reduce the requirements for the hardware system, but also greatly improve the processing speed of the system to meet the requirements of real-time processing.
4. Image acquisition example
The image acquisition speed of the double-buffer asynchronous acquisition system is significantly improved, and the development cycle is shortened due to the use of ActiveX components, and the development labor cost is reduced. And improve the quality of image acquisition. It only takes 1.3 s to collect a 7300x10000 image and stitch it in real time, with no frame drop phenomenon and lossless stitching. The formula for calculating the size of the image buffer is MemSize=ImageWidthxlmageHeightxFrames. The experiment also shows that 7 300x1 000 images are collected by synchronous acquisition, and 1 frame of 8 bits per pixel needs approximately 6Gb of buffer space; the same resolution is acquired by asynchronous double-buffer acquisition. The images require less than 32 mb of cache to keep images continuously. It can be seen that using the asynchronous double-buffer acquisition method can not only save system resources, but also obtain a more efficient and better acquisition effect.
5 Conclusion
Double-buffering technology has been widely used in the field of image display in recent years. This design combines double-buffering technology and asynchronous acquisition in the image acquisition system of PCB manual visual inspection machine for the first time. Using Matrox's SoliosXCL-SU74, the asynchronous double-buffer acquisition method can realize the real-time continuous acquisition of the PCB board appearance machine (this experiment is set to acquire 10 frames of images per second, and the width of each frame is 7 300 and the height is 1 000). requirements, and use the GDI+ library to achieve real-time lossless image stitching. This solution is more efficient than traditional image acquisition, has lower hardware requirements, and is more suitable for large data image acquisition systems such as PCB board appearance machines.