Application Research of Vision Sensor in Material Sorting Automation Control System

Based on the PLC in the material sorting automation system, the paper builds an automatic material sorting system based on visual sensors. The control system involves various sensor technologies such as photoelectric sensors and vision sensors, mechanical technology, electrical and electronic technology, frequency converter technology, motor drive technology, air pressure control technology, human-machine interface technology, etc., and integrates the application of various technologies in training. On the platform, students can familiarize themselves with the process of detecting, transmitting, and processing the automatic production line and the control process of the system through the practice of this training platform. They can be familiar with the mechatronics technology. The system first detects the metal through the inductive sensor, detects the colour through the photoelectric sensor, and finally detects whether the processing is qualified by the machine vision system, and obtains the target data, and finally controls the robot to realize the sorting action, and completes the storage operation of the stereo warehouse.


Introduction
The goal of this research is to design a set of automatic material sorting control system based on PLC and vision sensor for training, which is from a company in our city designed and developed to meet the needs of the comprehensive training of students in the school's electromechanical profession. It can improve students' practical ability and ability to quickly adapt to work. At the same time, through the research of this topic, it can improve their design ability and teaching level.
The training platform of the automatic material sorting system studied in this subject involves various sensor technologies such as photoelectric sensor and visual sensor technology, microelectronic technology, mechanical technology, electrical and electronic technology, inverter technology, motor drive technology, pneumatic control technology, etc. It can integrate the application of various technologies on the training platform, so that students can familiarize themselves with the execution process of automatic production line detection, transmission and processing and the control process of the system through the practice of this training platform, and can master the mechatronics technology. The automatic material sorting training platform is installed on the guide rail of aluminum alloy, which can simulate various control links in actual production, such as material feeding, conveying, sorting, etc., so that practitioners can obtain real automation production experience and shorten the distance between school teaching and actual production of the enterprise [1].

System design
This design adopts a modular design method to analyze and design each control unit module of material sorting. The Mitsubishi FX3U series PLC is used as the controller. It mainly consists of a feeding unit, a conveying detection unit, a handling robot unit, a sorting storage unit and the like. The control system adopts PLC to control the feeding cylinder to push the material onto the conveyor belt; the belt is controlled by the frequency converter to transfer the material to the end of the conveyor belt; in the transmission process, the inductive sensor is used to detect whether it is metal material, and then the photoelectric sensor detects the color of the material which is then detected by the visual sensor to determine whether the material pattern is processed, so that the target data of the sorting is obtained; then the handling work is carried out by the handling robot, and the unqualified one is directly transported to the scrap area, and the qualified transport is carried to the transport platform. Finally, the automatic loading operation of the sorting and three-dimensional warehouse is completed by the loading platform, and the white materials are sequentially stored in the third warehouse, and the black materials are sequentially stored in the second warehouse, and the metal materials are sequentially stored in the first warehouse.

Sorting platform composition
The structure of the automatic material sorting system is shown in Figure 1. It is mainly composed of seven-unit workstations: PLC control terminal, feeding unit station, transmission unit station, detection unit station, human-machine interface unit station, handling robot unit station, and classified storage unit station, which is a flexible detection and sorting system. Each unit can be an independent part and is a complete mechatronic system. The handling unit selects the robot to grab the material, the transmission unit selects the inverter and the three-phase asynchronous motor equipment, and the classified storage and storage unit adopts the servo, stepping and stacking cylinder control, and the feeding unit is selected in the feeding unit [2].

System layout
Power unit: Three-phase AC power main switch (with leakage and short-circuit protection), single-phase power socket for module power supply and power supply for external devices, the power connection between modules is connected by terminals. Button unit: Buttons and indicators with a variety of different functions, mode switch, emergency stop button, start and stop button, robot and sorting mechanism zero button. The electrical circuit unit consists of six modules: Among them, the transmission and detection unit are composed of a belt controlled by an AC motor, and various sensors and visual sensor modules are installed around the periphery. Handling robot unit: A robot controlled by a stepper motor and cylinder. Classified storage unit: consists of a transport platform and a stereo warehouse.

Figure 2.
Overall layout of the system.

System functions
The system workflow is shown in Figure 3. Firstly, the origin reset of the robot and the transport platform is performed. Select the switch to select the manual mode on the button panel, click the robot to rotate forward on the touch screen, the X axis is right, the Y axis is up, the robot moves after a certain distance, and then press the robot to reverse. The robot returns to the origin, the X axis returns to the origin, and the Y axis returns to the origin. Waiting for the origin indicator to light up, you can start automatic operation. The selection switch is adjusted to the automatic mode, and when the start button is pressed and the feeding device detects the material, the PLC pushes the push cylinder to feed, and the feeding belt rotates forward; When the photoelectric sensor of the robot conveys detects, the material will send a signal to the PLC. The PLC will drive the robot arm to open the gripper first, and then extend the gripper to lower the grip. The gripper lift arm retracts, and the arm rotates to the right limit, when the arm extends, the gripper drops. The material is placed on the transport platform, and the material is judged according to the signal from the sensor. The X-axis and the Y-axis are simultaneously sent to the silo of the material,  4 and then sent to the silo by the stack cylinder, and then returned to the original position. At the same time, the robot returns to its original position and waits for the next process. The sensor is identified according to the material characteristics, color, processing graphics and other characteristics of the material. The corresponding solenoid valve is controlled by the PLC to make the cylinder move, the material is sorted, the qualified feed is sent to the silo, and the unqualified feed is sent to the defective area [3].

Vision sensor design based on material sorting automation system
Machine vision is a branch of artificial intelligence that is rapidly evolving. The machine vision is to use the machine instead of the human eye to make measurements and judgments. The machine vision sensor converts the ingested target into an image signal through a machine vision product (i.e., an image capturing device, divided into CMOS and CCD), and transmits it to a dedicated image processing system to obtain shape information of the target. The brightness, color and other information are converted into digital signals; the image system performs various operations on these signals to extract the features of the target, and then controls the device actions in the field according to the result of the discrimination [4].

Hardware Design
The appearance of the coaxial light source is shown in Figure 4. In vision sensors, the scheme of light source and illumination plays a crucial role, not simply illuminating objects. The combination of the light source and the lighting scheme can highlight the characteristics of the object. It is possible to distinguish between the part that needs to be detected and the part that is not important, and increase its contrast. Transmitted or reflected light is typically used in vision applications. For reflected light, the relative position of the light source and the optical lens, the texture of the surface of the object, and the geometry of the object should be fully considered [5]. The system is to detect the upper pattern of the circular material. In order to obtain better results, the coaxial light source can be used. The coaxial light source can eliminate the shadow caused by the unevenness of the surface of the object, thereby reducing the interference part and adopting the spectroscope design to reduce the light.  The choice of industrial lenses is critical because the resolution of the lens directly affects the quality of the image. To purchase a lens, you must first understand the relevant parameters of the lens: resolution, focal length, aperture size, sharpness, depth of field, effective image field, and interface form, etc. This system uses a C-Mount lens for Omron 2/3-inch camera components, model 3Z4S-LESV-1214H.

Sensor Controller.
The measurement process is shown in Figure 5. The sensor controller includes an image capture card and a processor. The capture card sends the image to memory, then calculates and analyses it. This system uses the OMRON FH-L550 sensor controller. When the FH receives the measurement trigger signal from an external device such as a PLC, it will perform the image input from the camera registered in the measurement process in the order of the processing items registered in the measurement flow.

Implementation of automated sorting control algorithm
After the above analysis, the following is the research and analysis of the automatic sorting algorithm according to the order sorting operation time. Considering the time when the material is out of the sorting area for manual packing, there is time reserved for the staff to act. We will have two stages. With a certain distance d , then d=vt and v are the moving speeds of the conveyor belt, and t is the time interval for the sorter to sort the material. So the length of a shelf is:  There are k 1  orders in front of the k th order, so the distance between the "virtual domain" of order k and the entry point O is: When the order k "virtual domain" reaches the sorting entrance, the distance i L of the i th stage to the entry point O can be determined: The material of the i variety corresponds to the sorter number i  , and its position i f from the sorting entry point is fixed. Therefore, the total distance that a shelf reaches its sorter is total k i i T L L f    , and the belt speed is v . We can convert the distance into the corresponding amount of time, that is, the total time required for a stage to reach its sorter is: Therefore, the time required for each shelf to reach its designated sorter can be calculated. We can generate a time list of the order at the same time as the order is generated. Then the storage rack is arranged neatly on the conveyor belt according to this table. At the same time, we import the time parameters of each sorter action that is about to sort the volume materials into the PLC, and complete the control condition interlocking [6], when the belt passes the corresponding at the time, the sorter acts, and the material is sent to the belt. The order is continuously sorted and sorted to achieve the purpose of automatic sorting, which meets the requirements of the previous assumptions.

Programming
The control requirements of the system are to first detect the material and color of the workpiece, and then test the machining pattern of the workpiece. The main process of the program design is: when the feeding unit detects the materials, the feeding starts, the pushing cylinder moves, pushes the material onto the conveyor belt, and the inverter controls the motor to start the belt running, first carries out the material inspection, and then carries out the color detection. Finally, the visual inspection is qualified, and the qualified ones are placed in the three-dimensional warehouse in turn, and the excess and the unqualified ones are placed in the sub-grade. The program is designed by the programming software GX Works 2 software, a new project is created, and the ladder input is completed according to the logic of the design. The next step is to compile the program. If there is no syntax error, you can debug the program. If you find any problems, modify it and improve it. Finally, download the program to the PLC and monitor the PLC components, intermediate relays and parameters.

Interface design
After the save is completed, the user can use the compile function to check whether the screen plan is correct. If there is no error in the compilation result, the offline simulation function can be executed. If you need to perform online simulation, you can use the work button in the figure below after connecting the device. The design of the man-machine interface is completed in the same way, and finally the control of the automatic building system is completed by the PLC. The touch screen configuration draws the stop button to display the corresponding PLC address, as shown in Table 1.

System components and functions
The automatic material sorting system for training is shown in Figure 7. The system mainly consists of a feeding unit, a conveying and detecting unit, a handling robot unit, a sorting storage unit, a humanmachine interface unit and the like, and a pneumatic circuit and an electric control device corresponding thereto.  When the system is running, after the fiber sensor in the supply storage tank detects the material, the push cylinder quickly pushes the material onto the conveyor belt, and the AC motor drives the AC motor to drive the belt forward, and then sends the material to the sensor detection unit. The unit consists of a variety of sensors and visual sensors installed near the conveyor belt. It can judge the material, color, and whether the processed image is qualified and the position is in place. Finally, the workpieces detected by the actuator are sorted and processed, and the visual inspection fails and the materials of each type of material exceeding the number of warehouses in the warehouse are transported by the robot to the defective placement area for disposal. The loading platform is placed in different positions in turn. The main white plastic is placed in the 3rd floor of the 123 warehouses, the black plastic is placed in the 2nd floor of the 456 warehouses [7].

Material Inspection Processing Procedure
When the photoelectric sensor in the storage unit of the feeding unit detects the material, the cylinder action pushes out the material, and the inverter controls the operation of the AC motor, thereby driving the belt transmission, and installing a plurality of detecting sensors and visual lenses on the upper side and the two sides of the belt to form System detection module. The material passes through the silver metal sensor, and the inductive sensor is responsible for detecting whether it is metal. It is connected to the X15 end of the PLC. When the silver metal material arrives, the X15 contact is turned on and sent to the end of the belt. The black and white color detection of the material is realized by a reflective photoelectric sensor. The system uses a photoelectric sensor to detect black and white materials and is connected to the X16 end of the PLC. When the black material arrives, the X16 contact is not connected. When the white material arrives, turn on the X16 contact. The processing pattern detected by this system is "Rob", if it is qualified, it will be turned on X30, and if it is not, it will be turned on X31. When the material is transferred to the end of the conveyor, the X17 contact is turned on and then carried by the PLC control robot.

Online testing
After the system is started, download the program to the PLC, download the interface designed by the touch screen to the touch screen, and connect the connection line between the PLC and the touch screen. Manual operation test: adjust the mode selection switch to the manual gear, open the manual control of the touch screen device, and test the functions of each part in turn, including the number of pulses of the robot and the XY axis. For example, when the push cylinder is extended, observe whether the push cylinder is Extend, the magnetic switch changes. Automatic operation test: Switch the switch to automatic mode, press the start button, the system will run automatically. Press the robot to return to zero, observe whether the robot returns to the origin, and whether the origin indicator is lit. Also observe the zero return of the sorting and conveying platform. Main test of the feeding unit: When there is material in the storage tube, the operation of the cylinder is whether it is fed according to the program control requirements. It mainly tests whether the conveyor belt runs and stops as required, detects whether the signals fed back by each sensor are accurate, and adjusts the light source, focal length and contrast of the photoelectric sensor amplifier and visual sensor. It mainly tests whether the robot can move in place to grab the material and place the material on the transport platform and send the waste to the waste area to see if the position of the movement is accurate.

Conclusion
The system adopts the modular design of the structure, and can modify the module and modify the program according to the control requirements. The design of the system has met the basic requirements, completed the trial operation of the training equipment, and can operate stably and accurately. The system can automatically control material sorting, effectively save energy, improve management level, save manpower and material resources, can complete teaching and training tasks well, and provide certain reference value for actual production.