| In the production line of the motor,the assembly of permanent magnets is a critical step.Before the permanent magnet installation process,it is necessary to ensure that the rotor and the permanent magnet are accurately aligned,and then the hydraulic press can be used for magnet insertion.The traditional production line mainly relies on manual completion of position calibration,which is inefficient.With the development of machine vision technology,it has become possible to automatically align the rotor and permanent magnets.The use of machine vision technology can achieve rapid and precise positioning of the rotor position on the production line,and measure the difference between the current position of the rotor and the standard position.Offset the angle,and then send the angle to the actuator for position correction to achieve precise alignment between the rotor and the permanent magnet.In this paper,aiming at the problem of rotor assembly position correction,a set of accurate measurement system of rotor offset angle based on machine vision technology is designed.Image acquisition of the real-time position of the rotor is carried out,and then the image is processed to obtain the deviation angle of the rotor,and finally the data is sent to the PLC to complete the position correction.The main content of this article includes the following parts:(1)The overall framework design of the system.According to the functional requirements of the accurate measurement system for the rotor offset angle,the overall system framework with STM32 as the core,external image acquisition module,data storage module,data transmission module and human-computer interaction module was determined.In terms of hardware,according to the characteristics of the rotor,a blue LED ring light source is selected to eliminate the metal reflection on the surface of the rotor.The OV5640 module is responsible for collecting images;the Ethernet chip LAN8720 A is responsible for data transmission;and the LCD touch screen is responsible for human-computer interaction.In terms of software,the μC/OS-III operating system is used for multi-task parallel design,which mainly includes image acquisition tasks,image processing tasks,human-computer interaction tasks based on the STem Win image library,and data transmission tasks based on the TCP/IP communication protocol.(2)Image processing algorithm design.In order to accurately measure the angular deviation between the real-time position of the rotor and the standard position,the acquired image of the rotor needs to be processed.First of all,due to the influence of external light sources and dust in the air,the original rotor image will contain some unknown noises.For this reason,this paper adopts an improved median filter algorithm to improve the image quality.Then,according to the feature that the permanent magnets’ installation slots are evenly distributed around the center of the outer circle of the rotor in the image,the projection method is used to locate the rotor,and the center of the outer circle is obtained by the least square method.Finally,with the center of the circle as the base point,three straight-line fitting algorithms,Hough transform,one-variable least squares method and two-variable least squares method,are used to perform straight-line fitting on the rotor installation slot,and calculate the angle deviation from the standard position.After many experiments,the straight line fitted by the binary least squares method has the highest accuracy and the best stability.(3)System testing.This paper builds an experimental platform to test the image quality of the rotor,the system’s anti-light interference ability and random errors.The results show that the processing speed of the system is relatively fast,the processing time of each picture is controlled within 1s,and the measurement accuracy is up to Expected requirements.After that,the system was inspected on site in the factory,and the results proved that the system is stable and reliable and meets the requirements of users. |