Design of multi-visual sensor measurement and control system based on CAN bus[Copy link]
1 Introduction Visual inspection technology is a new test technology based on machine vision. It is popular because of its characteristics of non-contact measurement, fast speed, large amount of information, and wide application field. Structured light sensor is an early and mature visual sensor. Therefore, this system uses structured light sensor to collect images and send them to the computer for processing through image acquisition card. Since the visual sensor is responsible for the collection, switching and transmission of video image signals (measurement data) in visual measurement. Therefore, how to make the visual sensor measurement and control system quickly and accurately obtain the ideal video image information, and then provide reliable support for the later image processing, that is, the design of the visual sensor measurement and control system is particularly important. 2 Overview of the visual system In the visual inspection system, the visual sensors that collect images of the objects to be measured are divided into monocular and binocular. This measurement and control system can use monocular vision sensors or binocular vision sensors to collect data. This article mainly discusses the multi-visual sensor measurement and control system composed of multiple binocular vision sensors. Each of the visual sensors uses a line structured light vision sensor with relatively mature technology. Its structure is composed of dual CCD cameras, a laser projector and an MCU control circuit. Based on the principle of stereoscopic parallax, two cameras are used to imitate the function of the human eye, and the perspective or image point coordinates of the spatial point on the image plane of the two cameras are used to obtain the three-dimensional coordinates of the spatial point. When the workpiece to be measured is large and requires more than one visual sensor, the above-mentioned multiple visual sensors plus a multi-channel video switching switch constitute a multi-visual sensor measurement and control system. For example, when detecting many feature points on the car body, dozens or even hundreds of sensors are required to measure. Since the controller area network CAN (controller area network) bus has a strong load capacity and can connect up to 110 nodes on a CAN network, this system uses the CAN bus for communication and network control. The MCU control circuit in the visual sensor provides power to the CCD camera and laser projector and controls their opening and closing. In order to avoid the laser projector from being used for too long and causing the laser to heat up and cause the unstable distribution of the light energy of the line structure light, thus affecting the measurement accuracy, when the sensor starts measuring, it is first powered on and initialized, then the laser is turned on, and it is turned off after the measurement is completed to extend the life of the projector. In this system, the upper computer is a PC, and the lower computer is an 8051 single-chip microcomputer control unit. The upper and lower computers communicate with each other using the CAN bus. Since the PC does not have a CAN bus interface, a CAN interface card is required. The USBCAN smart interface card of Guangzhou Zhou Ligong Company is used for communication because it has the characteristics of small size, external and plug-and-play. In this way, the PC can be easily connected to the CAN bus network through the USB bus to control each CAN node for data acquisition and processing. The USBCAN smart CAN interface card can be connected and run with the ZLGCANTest universal CAN-bus test software to perform the receiving and sending test tasks of CAN-bus bus data, which is easier to realize CAN-bus product development and data analysis. The USBCAN intelligent CAN interface card uses the general ZLGVCI driver library provided by Zhou Ligong Company, supports WIN98, 2000 and XP operating systems and supports the Linux platform. Users can quickly and easily develop CAN system application products through the ZLGVCI dynamic development library provided by the interface card. In order to convert the analog video image of the object under test output by the analog CCD camera into a digital signal and process it by the computer, the CG400 image acquisition card of Beijing Daheng Image Company is used here. It uses the PCI bus, and the collected image data transmission basically does not occupy CPU time, and the image can be directly transmitted to the computer memory or video memory. 3 Introduction to CAN Bus CAN bus is a serial data communication protocol developed by BOSCH in Germany in the early 1980s to solve the data exchange between many control and test instruments in modern cars. It is a multi-master bus, and the communication medium can be twisted pair, coaxial cable or optical fiber. The communication rate can reach 1Mbps. The physical layer and data link layer functions of the CAN protocol are integrated in the CAN bus communication interface, which can complete the framing processing of communication data, including bit filling, data block encoding, cyclic redundancy check, priority discrimination and other tasks. One of the biggest features of the CAN protocol is that it abolishes the traditional station address coding and replaces it with coding the communication data block. The advantage of this method is that the number of nodes in the network is theoretically unlimited. The identification code of the data block can be composed of 11 or 29 binary numbers, so 211 or 229 different data blocks can be defined. This method of encoding by data block can also enable different nodes to receive the same data at the same time, which is very useful in distributed control systems. The data segment length is up to 8 bytes, which can meet the general requirements of control commands, working status and test data in the general industrial field. At the same time, 8 bytes will not occupy the bus for too long, thus ensuring the real-time nature of communication. The CAN protocol uses CRC verification and can provide corresponding error handling functions to ensure the reliability of data communication. CAN's excellent characteristics, extremely high reliability and unique design are particularly suitable for the interconnection of industrial process monitoring equipment. Therefore, it has received more and more attention from the industrial community and has been recognized as one of the most promising field buses. In order to meet the detection of the three-dimensional contours of large-sized objects, this system requires at least 64 sensors. Each visual sensor has two cameras, that is, there are a total of 128 video inputs, and at any time the system only selects one of the video images to transmit to the computer for image acquisition and processing. For example, dozens of sensors are arranged around the car body to detect key dimensions on the body such as windshield window size, door installation edge gap, and positioning hole position, and measure the corresponding edge and hole surface space position dimensions. The visual sensor can work in the required order, or it can select specific points of the object to be measured and select specific sensors for detection through the CAN control network. The computer collects the image of the detection point and processes it, and compares the calculated value with the standard value to obtain the result of visual detection. 4 Control design of multiple visual sensors The control circuit of the visual sensor mainly includes three parts: video switching, power supply and CAN communication interface. Each sensor has two CCD cameras, which means it can collect two video inputs at the same time, but the sensor can only output one video signal at any time. Here, MAXIM's video multiplexing amplifiers max4313 and max4315 are used to switch and transmit multiple video signals. The sensor uses a single-chip microcomputer to control max4313 to switch between two videos. Multiple sensors in the system are connected in series through multiple eight-to-one video switching chips max4315 to achieve the switching selection of multiple visual sensors. The multi-channel video switching circuit can well realize this function. The three address lines of the P2 port of the P89C668 microcontroller control the three address terminals of max4315 to decide which channel of video signal to switch. Max4313 and max4315 are low-power, high-speed, multi-channel video multiplexing amplifiers with good video characteristics such as fast channel switching speed (40ns), low switching transient (10mVp-p), low differential gain error (0.06%), and small phase error (0.02 degrees). They work on a single power supply of +4~+10.5V (dual power supply of positive and negative 2V~positive and negative 5.25V). In this case, they work on a dual power supply of positive and negative 5V. In order to reduce interference and facilitate installation in the internal space of the sensor, the power supply circuit and the control circuit are made separately and placed on both sides of the projector. Since the video signal frequency is high and the frequency band is wide, when the two video signals are close to each other, attention should be paid to interference. When the two video signals are close to each other, crosstalk is likely to occur. In order to minimize crosstalk, the following points should be noted when designing the circuit: the digital module and the video switching module should be divided into two areas on a board, and the length of the video lead should be reduced as much as possible and a 75 ohm matching resistor should be used. The video lead should use a video coaxial cable with a shielding layer (75 ohm impedance).