Precision PCB Fabrication, High-Frequency PCB, High-Speed PCB, Standard PCB, Multilayer PCB and PCB Assembly.
The most reliable PCB & PCBA custom service factory.
PCB Blog

PCB Blog - Design of automatic detection system of PCB board based on image processing

PCB Blog

PCB Blog - Design of automatic detection system of PCB board based on image processing

Design of automatic detection system of PCB board based on image processing

2022-02-23
View:649
Author:pcb

A high-precision, large-scale, fast, and real-time automatic optical detection system for PCB board defects is studied, and the hardware structure and software system are designed respectively. The system is mainly composed of a two-dimensional motion platform, motor control module, image acquisition module, image processing module, and result in the analysis module. The improved stepper motor drive mode, subdivision drive, and improved image recognition algorithm ensure the accuracy of the system, and the design of one-button automatic detection improves the detection speed. The experimental results show that the system can quickly and accurately detect the defects on the PCB board, and has certain practical and development values.


The part of electronic products, the printed circuit boards, is an information carrier that integrates various electronic components. It has been widely used in various fields and is an indispensable part of electronic products. The quality of the PCB board has become the determining factor for the long-term, normal and reliable work of electronic products. With the development of science and technology, the development trend of high density, high complexity, and high performance of PCB board products continues to challenge the quality inspection of PCB boards.


Due to factors such as limited access, high cost, and low efficiency, traditional PCB defect detection methods have gradually failed to meet the needs of modern detection. Therefore, it is of great academic and economic value to study and implement an automatic detection system for PCB defects. Among the PCB board defect detection technologies researched at home and abroad, AOI (Automatic Optic Inspection) technology has received more and more attention, and the detection method based on image processing has also become the mainstream of automatic optical inspection. In this paper, a large field of view, high precision, a fast real-time automatic detection system for PCB board defects are studied through image processing technology, and the hardware structure and software algorithm flow are designed. Through the improved motor drive mode and the design of one-button automatic detection software, the detection speed of the system is greatly improved, and the improvement of the defect identification algorithm of the result analysis module improves the accuracy of the detection results.


pcb board

1. System structure
The PCB board defect automatic detection system is mainly composed of a motion control module, an image acquisition module, an image processing module, and a result analysis module. The working process of the system is as follows: the upper computer controls the movement of the stepper motor, the stepper motor drives the movement of the two-dimensional platform, transmits the CCD camera to the top of the PCB to be detected, and collects images of large scenes on the PCB, and the collected images are sent to the image acquisition card. To the host computer, the host computer software performs stitching and image preprocessing on the collected images, accurately locates and calibrates the processed images, performs template matching and image recognition through image segmentation, image morphological processing, etc., and obtains defect detection results. . System design includes hardware design and software design. System software and hardware work in coordination with each other to form a whole.

2. System hardware design
The hardware design of the PCB board defect automatic detection system mainly includes a two-dimensional motion platform, a motor motion control board, a motor drive board, a CCD camera, an image capture card, and a PC.


2.1 CCD camera and frame grabber
The main characteristic parameters of the CCD camera include camera format, photosensitive surface size, pixel size, resolution, electronic shutter speed, synchronization system method, illuminance, sensitivity, signal-to-noise ratio, etc. The camera format and online detection determine the sampling frequency of the image acquisition card. The balance of the photosensitive surface size, pixel size, resolution, and magnification of the imaging lens system depends on the measurement range and measurement accuracy. Taking into account the above factors and system requirements, frame grabbers, also known as video capture cards, are a type of video card. The main function of the frame acquisition card is to convert the continuous analog video signal of the camera into discrete digital quantities. Its basic principle: the video output signals of various formats output from the camera are processed by the input selection module to form a video signal that can be recognized by the image acquisition card. After the analog video signal is converted, it is stored in the frame buffer memory on the card, and the specific image transmission is controlled by the computer CPU through the computer bus, and finally stored in the computer's memory or hard disk for image processing. The model of the image acquisition card used in this design is NV7004-N, which converts the CCD camera analog signal into a digital signal and transmits it to the host computer for real-time display and can complete the image capture function.


2.2 Motor Motion Controller and Precision 2D Motion Platform
The motion controller of the PCB board defect automatic detection system is a self-designed MCU control board, the chip is the single-chip AT89S52 produced by ATMEL Company, and the control board communicates with the host computer through the RS-232 serial communication interface. Send commands to the control board by operating the man-machine interface, and the control board outputs control signals and square wave signals of various frequencies to the stepper motor driver board to control the speed, direction, and moving distance of the stepper motor. The two-dimensional motion platform is constructed by two precision motion guide rails produced by Japan SUS Corp. The motion guide rail is a ball screw type, which is very precise and has a small error. The stepper motor is connected with the moving guide rail to drive the movement of the guide rail. The stepping motor is a two-phase four-wire hybrid stepping motor produced by TAMAGAWA, Japan. This type of stepping motor runs stably and has low noise.


2.3 Motor drive
In fact, the driving of the stepping motor is to control the current of the excitation windings of each phase of the stepping motor, so that the synthesis direction of the internal magnetic field of the stepping motor changes, so that the stepping motor rotates. The magnitude of the synthetic magnetic field vector generated by the current of each phase excitation winding determines the rotational torque of the stepping motor, and the included angle between two adjacent synthetic magnetic field vectors determines the step angle. Two important concepts of stepper motors are introduced here: pitch angle θz and step angle θn. The pitch angle of the stepping motor refers to the angle between two adjacent stable magnetic fields when the stepping motor is running. The step angle refers to the angular displacement that the rotor of the stepping motor rotates corresponding to a pulse signal.


The step angle is not only related to the number of teeth of the motor, but also to the number of beats of the motor. The pitch angle θz and the step angle θn of the stepping motor can be expressed as: The subdivision of the stepping motor is based on the ideal symmetry of each phase winding of the stepping motor and the strict positive rotation of the pitch angle characteristics. The magnitude and ratio of the current in the windings reduce the step angle to a fraction to a few hundredths of the original, thereby improving the resolution of the stepper motor. Taking a two-phase stepping motor as an example, if the number of teeth of the motor is 50 and the number of running beats is the single-four-beat mode, the step angle is θ=360 degrees (50*4)=1.8 degrees (commonly known as a full step), eight When shooting, the step angle is θ=360 degrees/(50*8)=0.9 degrees (commonly known as half-step 0. Compared with the four-beat mode, the step angle θn is doubled, realizing the step angle The second subdivision. Under the condition of a certain number of beats, the more the number of teeth, the smaller the step angle, but due to the limitation of the manufacturing process, the number of teeth cannot be made a lot, so the step angle of the stepper motor cannot be very large. Small.


The step angle can also be changed by changing the number of beats of the stepping motor. The number of beats refers to the number of pulses or conduction states required to complete a periodic change of the magnetic field or the number of pulses required for the motor to rotate through a pitch angle. When the number of phases of the motor is determined, the number of beats is also determined. By increasing the number of teeth and phases of the stepping motor to reduce the step angle, the degree of step angle reduction is very limited, and it is difficult to meet the requirements of production. The commonly used method for motor subdivision driving is the current vector constant amplitude uniform rotation method. The current vector constant amplitude uniform rotation method can make the step angle after subdivision uniform and the output torque constant.


The specific method is to make them-phase windings pass through the phase difference respectively. If the sinusoidal current is 2π/m and the amplitude is equal, the current combined vector or magnetic field vector will rotate in space, and the amplitude of the combined vector will remain unchanged. For example, for the four-phase hybrid stepping motor, The phase windings are respectively supplied with sine wave currents with a phase difference of π/2 and equal amplitude. In order to obtain a circular synthetic magnetic field as much as possible and make the step angle change evenly, it is ideal to use a stepped sine waveform for the current reference signal of each phase winding.


Taking 8 subdivisions of a four-phase stepping motor as an example, 7 stable intermediate states are inserted into each phase. After subdivision, the current of each phase rises or falls in steps of 1/4. The angle will be completed by 8 steps, and 8 subdivisions of the step angle can be realized. The more subdivisions, the smaller the current change, which greatly reduces the vibration and noise of the motor. When the stepped sine wave is used to subdivide the current, The more steps (that is, the more subdivisions), the closer the waveform is to a sine wave, the smaller the step current is, and the smaller the step angle. This greatly reduces the step loss rate when the stepper motor is running. It reduces the noise and vibration of the stepping motor when it is running, and also makes the stepping motor run more stably, and it is easier to control the PCB board.