Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 13, No. 1, 2024 253 System Design of Three-coordinate Dynamic Synchronous Tester Based on STM32 Wenqiang Li, Ke Ouyang, Zhongtao Cao, Jin Chen* Shanghai Second Polytechnic University, shanghai of China, 201209, China * Corresponding author: Jin Chen Abstract: In this paper, a three-coordinate dynamic synchronous tester system based on STM32 is developed. STM32F103C8T6 chip is used as the control system. The control system mainly consists of three modules: motion control module, magnetic encoder measurement module and displacement data collection module. The STM32 main control controls the three-axis stepper table to move according to the specified instructions, the AS5600 magnetic encoder is used to measure the data of the three-way stepper motor, and the TCA9548A module is used to expand the IIC channel and realize the communication between the STM32 and the host computer, and the data is transmitted to the host computer through serial communication. The test results show that the system meets the needs of the existing domestic industrial level, the cost is moderate, the performance is reliable and the operation is simple, and meets the practical application requirements. Keywords: STM32, magnetic encoder, three coordinate tester, TCA9548A, AS5600 magnetic encoder. 1. Introduction With the rapid development of the manufacturing industry, the requirements for product quality are becoming more and more stringent. Especially in the field of precision parts, such as aerospace and automotive manufacturing, there are extremely high requirements for the size, shape and position of parts. However, the traditional manual measurement method has some problems, such as large human error, time consuming and low efficiency, which can not meet the needs of modern manufacturing industry[1-3]. In order to solve this problem, coordinate measuring instrument (CMM) came into being. CMM is a kind of high-precision measuring equipment, the principle of CMM is that it takes X, Y, Z axis as the main coordinate system, including the movement trajectory of each axis. In the three-coordinate measuring instrument equipment, in addition to the main drive mechanical system with 3 axes and the host structure of the CMM, it also includes the hardware equipment of electrical control and the data processing software system[4-5]. According to the different ways of measuring the surface of the workpiece, the CMM can be divided into contact and non-contact measuring machines. The CMM equipment is used for various dimensional detection of mechanical parts, and the data processing requirements of the three coordinate points are further realized through the computer system. The three-dimensional coordinate values of the feature points of the measured parts are collected, and the geometric features are formed by numerical algorithms[6]. The three-coordinate dynamic test can often be measured quickly and the amount of data collected is large, and can measure the parts with more complex shapes[7]. In this paper, STM32 is used to design and implement a synchronous measurement scheme suitable for the three-coordinate motion system to realize the synchronous motion control of the three coordinate axes, ensure that the motion system can move according to the predetermined trajectory during the measurement process, effectively integrate the data of multiple magnetic encoders, and improve the measurement accuracy and stability of the measurement results of the three-coordinate motion system. 2. System Hardware Circuit Design The system structure block diagram of the three-coordinate dynamic synchronization tester is shown in Figure 1. The system consists of STM32F103 main control system, three- axis step sliding table motion system and magnetic encoder measurement system. The output position signal can be received and analyzed by the main control system through the TCA9548A expansion module and displayed on the host computer. Figure 1. System structure block diagram 2.1. Motion control module design For the control of the three-axis stepper slide, the stepper motor driver is subdivided into 3200, in which the stepper motor is added with subdivision algorithm and S-type acceleration and deceleration calculation, and smooth acceleration and deceleration are achieved by adjusting the stepping frequency, reducing vibration and noise, improving the running stability, thereby reducing overshooting and positioning errors, and improving the positioning accuracy of the system. By adjusting the acceleration and deceleration parameters, the performance of the motor can be fully utilized, such as using a higher acceleration as far as possible to improve the test efficiency while ensuring that no out-of-step occurs. Use STM32 timer to generate pulse signal to control 254 the stepper motor, configure the timer, set the appropriate pre- divider and automatically reload the register period value to generate the pulse of the required frequency. Stepper motor controller enable ENA+ to connect IO port, control motor enable; Stepper motor controller direction end DIR+ IO port, control motor rotation direction; The stepper motor controller PUL+ is connected to the IO port, and the PWM wave is generated by the STM32 timer to make the motor move, and the PWM period can be changed to control the motor speed. Configure timer output PWM wave, you can control the motor speed by adjusting the parameters. Figure 2. Step motor acceleration and deceleration calculation 2.2. Magnetic encoder measurement module The AS5600 Magnetic encoder is a 12-bit programmable non-contact potentiometer that is an easy-to-program magnetic rotational position sensor with a 12-bit high- resolution analog or PWM output. This non-contact module detects the absolute Angle of rotation of the magnet's radial magnetic axis. This non-contact module can detect the absolute Angle of rotation of the magnet's radial magnetic axis, making it ideal for stepper motor control. The AS5600's design allows it to eliminate the effects of external stray magnetic fields, providing accurate Angle measurements. The AS5600 relies on three main components: the disk, the sensor, and the regulating circuit. The disk has been magnetized and has many magnetic poles on its circumference. The sensor detects changes in the magnetic field as the disk rotates and converts this information into a sine wave. The sensor can be a Hall effect device or a reluctance device, and the regulating circuit multiplies, divides, or interpolates the signal to produce the desired output. Figure 3. AS5600 field air gap diagram The AS5600 is a Hall's rotating magnetic position sensor that uses a planar sensor to convert magnetic field components perpendicular to the surface of the chip into voltage. The signal from the Hall sensor is first amplified and filtered, and then converted by an analog-to-digital converter (ADC). The output signal of the ADC is processed by a hardwired CORDIC block (coordinate rotation digital processor) to calculate the Angle and magnitude of the magnetic field vector. An automatic gain regulator (AGC) uses the strength of the magnetic field to adjust the gain level to compensate for changes in temperature and magnetic field. The output stage is the Angle value provided by CORDIC algorithm. Users can choose between analog output or PWM encoded digital output. The former provides an output voltage, and the voltage Angle is expressed as a linear absolute value of the ratio. The latter provides a digital output whose Angle is expressed as the pulse width. The AS5600 is programmed to write on-chip nonvolatile memory through an industrial- standard IIC interface. This interface can be used to write to set the zero Angle (starting position) and the maximum Angle (ending position) and map the full resolution of its output to a subset of the entire 0-360 degree range. As shown in Figure 4. 255 Figure 4. AS5600 magnetic encoder Angle 2.3. IIC communication TCA9548A expansion module design Because the three-axis stepper needs three stepper motors, that is, three AS5600 magnetic encoder modules, but the AS5600 magnetic encoder module IIC address is the same, so choose TCA9548A-8-way IIC communication expansion module. The TCA9548A is an IIC bus extender produced by Texas Instruments that controls eight bidirectional channel switches via the IIC bus. These switches enable multiple IIC devices to share the same bus, effectively expanding the number of connections for IIC devices. Figure 5 TCA9548A functional block diagram. Figure 5. TCA9548A functional block diagram It has eight two-way channels: The TCA9548A offers eight channels, each of which can be controlled independently for connecting different IIC devices. Address pins: With three address pins (A0, A1, A2), allowing up to eight TCA9548A devices to be supported on the IIC bus, a unique IIC address can be assigned to each TCA9548A through different combinations of these pins. Channel selection: Channel selection through the IIC bus, you can select any one or more channels for communication, providing a flexible device connection. With the TCA9548A, data from the three-way magnetic encoder AS5600 can be accepted simultaneously. And print out through the serial port. Figure 6 shows the circuit schematic diagram of TCA9548A extended three-way AS5600. 256 Figure 6. Measurement module circuit diagram 3. System Software Design The system uses C language to write the program, the program successfully compiled is burned into the single chip computer, and the system debugging can be carried out. In this design, the source program of STM32F103 is written in KEIL5 compiler environment, and after compilation, the hex program code is generated, and the hex file is downloaded to the Flash of the target single chip computer with ST-Link download. The system software design is modular, which consists of main program, initialization program, interrupt service program, timer output PWM, AS5600 magnetic encoder test program and TCA9548A channel selection program. The overall program flow chart of the system is shown in Figure 7. Figure 7. System overall flow design diagram 4. Experimental Data Analysis Results This system uses a three-axis stepper slide table, first of all, the three-axis stepper slide table configuration and selection, from the stroke range, load capacity, precision requirements, speed requirements, etc., the following stepper slide table is selected, the three-axis stepper slide table is a kind of mechanical equipment used to achieve precise three- dimensional space movement, it is usually composed of three independent stepper motor driven slide tables, corresponding to X, Y, Z three coordinate axes, the three-axis stepper slide table drives the ball screw through the rotation of the stepper motor, and then promotes the slider to do linear motion along the direction of the guide rail. The movement of each axis is controlled by its own control system, which enables precise position control and path planning. By using a high-precision stepper motor and ball screw, the three-axis stepper slide table is able to achieve high-precision position control, and the slide table advances 4mm per revolution of the stepper motor. As shown in Figure 8. Figure 8. Three-axis stepper test slide Finally, a three-axis experimental platform was built for practical testing, and the data of each AS5600 magnetic encoder was collected through the TCA9548A module, and then the data was sent to the host computer through serial port communication for data collection. It is possible to derive the actual and measured values of the position coordinates of each point. The following is an example of the X-axis test. 257 Table 1. X axis test data Number Actual value(mm) Measured value(mm) 1 0.000 0.000 2 0.150 0.201 3 0.350 0.390 4 0.650 0.714 5 1.000 1.081 6 1.400 1.454 7 1.875 1.958 8 2.500 2.559 9 3.125 3.188 10 3.750 3.805 11 4.375 4.422 12 5.000 5.064 13 5.625 5.687 14 6.250 6.309 15 6.875 6.958 16 7.500 7.546 17 8.125 8.173 18 8.750 8.912 19 9.375 9.450 20 10.00 10.062 21 10.625 10.688 22 11.250 11.347 23 11.875 11.921 24 12.50 12.561 25 13.125 13.131 26 13.750 13.827 27 14.375 14.428 28 15.000 15.061 30 15.625 15.725 31 16.25 16.369 32 16.875 16.918 33 17.500 17.562 34 18.125 18.235 35 18.600 18.648 36 19.000 19.077 37 19.35 19.427 38 19.650 19.744 39 19.850 19.891 40 20.000 20.000 The error curve is drawn, and the error between the actual value and the test value can be observed to be extremely small, and the test results show that the system meets the needs of the industrial level, with moderate cost, reliable performance and easy operation, which meets the practical application needs. As shown in Figure 9. Figure 9. X axis test data 258 5. Conclusion In this paper, STM32 is used to design and implement a synchronous measurement scheme suitable for three- coordinate motion system, to realize the synchronous motion control of three coordinate axes, and to add some innovative elements to ensure that the motion system can move according to the predetermined trajectory during the measurement process, and effectively fuse the data of multiple magnetic encoders, but the model also has many shortcomings, and it is hoped that it can be corrected in the future. Acknowledgment We should be grateful to Mr. Chen Jin. This work was supported in part by a grant from SSPU. References [1] J. H. Robert, H. P. Paulo. Coordinate measuring machines and systems[M]. Boca Raton: CRC Press, 2016:18-21. [2] Z. Qin, Y. Lu. Self-organizing manufacturing network: A p aradigm towards smart manufacturing in mass personalizati on[J]. Journal of Manufacturing Systems, 2021,60:35-47. [3] W Liu,X Li.Binocular-vision—based error detection syste m and identification method for 5 PIGEs of rotary axis in five-axis machine tool[J].Precision Engineering,2017,1:20 8-222. [4] J. H. Robert, H. P. Paulo. Coordinate measuring machines and systems[M]. Boca Raton: CRC Press, 2016:18-21. [5] Z. Qin, Y. Lu. Self-organizing manufacturing network: Apa radigm towards smart manufacturing in mass personalizatio n[J]. Journal of Manufacturing Systems, 2021, 60:35-47. [6] STOJADINOVICSM, MAJSTOROVICVD, DURAKBASA NM, et al. Towards anIntelligent Approach for CMM Inspe ction Planning of PrismaticParts[J]. Measurement. 2016,92: 326-339. [7] Zou H B,Ding YJ,Zhang J,et al.Precise geometric error model based on z-axis motion platform of micro v-groove machine tools[J].The International Journal of Advanced Manufacturing Technology,2017,92(9-12):3219-3224.