1716 views|0 replies

3836

Posts

19

Resources
The OP
 

Design of control system for CNC engraving machine based on embedded system [Copy link]

With the continuous development and progress of science and technology and manufacturing technology, digitally controlled engraving machines have gradually become special tools for the engraving industry. From the processing principle, CNC engraving machines are a combination of drilling and milling processing. They are a typical mechatronics product and have a wide range of market applications in mold engraving, advertising production, decoration and other industries. The microprocessors
  used in the hardware platform of CNC engraving machine controllers on the market currently include: 8-bit single-chip microcomputers as the core, such products are cheap and simple in design, but have defects such as single function, poor performance, low efficiency, small storage capacity, weak independent working ability, weak practical performance, low positioning accuracy, complex human-computer interaction, and inconvenient operation; DSP as the core, such engraving machines have strong performance and efficiency, strong real-time performance, and moderate cost, but the functions are still relatively few, and they also lack independent working ability and cannot meet the requirements of human-computer interaction interface, peripheral circuit interface, network and other aspects.
  This paper proposes to use a 32-bit ARM9 processor combined with FPGA to replace the online control of the above-mentioned single-chip microcomputer and industrial computer, with Windows CE.net operating system as the platform, ARM to complete speed control, and FPGA to complete trajectory control. The torque-frequency characteristics of the stepper motor are combined in the trajectory control to make the motor trajectory accurate and smooth. The entire control system is integrated to complete the process from raw data reading to the output of the final control signal, completely getting rid of the dependence on industrial computers; by setting different pulse equivalents and motor operating parameters through the control keyboard, it can be used in conjunction with engraving machines suitable for various occasions, with high control accuracy and strong versatility.
  Control system design
  An embedded system must be composed of embedded hardware and embedded software; embedded hardware mainly includes embedded processors, peripheral controllers, interface circuits, etc.; embedded software mainly includes startup programs, embedded operating systems, application software, etc. The embedded processor is the hardware core of the embedded system; the embedded operating system is the core of the embedded software.
  Hardware system
  The hardware system mainly consists of the following three parts:
  (1) Processor (ARM9): As the processor of the controller, the Windows CE.net operating system is transplanted on ARM. In terms of human-computer interaction, it must complete the control of the LCD display and read the control commands of the control keyboard; in terms of engraving, it must complete the reading (through the USB interface), preprocessing, analysis and calculation of the raw data, and pass the calculation results to the FPGA, and work with the FPGA to complete the control of the stepper motor.
  (2) FPGA: Perform interpolation operations on the data received from ARM, and calculate the number of pulses and delays for controlling the stepper motor based on the interpolation results, and finally complete the control of the stepper motor to achieve three-axis linkage engraving.
  (3) Human-machine interaction interface: The human-machine interaction interface mainly includes a keyboard and LCD. Almost all information about engraving is displayed on the LCD in real time; the machine tool's pulse equivalent and parameters such as the maximum engraving speed and acceleration are set through the keyboard. At the same time, the keyboard can also input special instructions as needed during engraving.
  The overall framework of the hardware system is shown in Figure 1. The entire hardware core is a Samsung S3C2440 processor based on ARM920T, with 64MB SDRAM as the system memory and 128MB FLASH as the system external memory, which is equivalent to a hard disk, so as to save various system programs and debug download circuits after power failure. Peripheral auxiliary equipment includes USB interface: most processing files are saved in the U disk, and they are transferred from the U disk when they need to be read to save FLASH storage space; touch LCD: used to provide system display and operation; network interface: used to provide network services to facilitate remote program updates; control keyboard: used to provide the operations required for processing, including point control, start and stop, acceleration and deceleration, etc. Communication with the host computer through the serial port or USB interface can realize online debugging or display real-time information in the host computer. FPGA is connected to ARM and the bridge board, obtains data from ARM and converts it into a control signal, which is amplified by the bridge board amplifier circuit and sent to the control circuit of the stepper motor.


  Figure 1 Overall framework of the hardware system
  Software
  system The system software uses the embedded real-time multi-tasking operating system Windows CE.net. According to the requirements of the engraving machine control system, the system task modules can be divided into: human-machine interface module, USB interface module and engraving control module. The human-machine interface module includes LCD display and keyboard command reading; the original design data is read through the USB interface module; the engraving control module completes speed control and trajectory control after analyzing and calculating the read data. The software structure diagram is shown in Figure 2.
  In the control system, ARM completes speed control by analyzing and calculating the design data, and FPGA completes trajectory control through interpolation operations. The control system application flow chart is shown in Figure 3.
  Figure 2 System software structure diagram


  Figure 3 Control system application flow chart


  (1) Read the data and find the minimum number of lines that can be engraved without a sudden change in speed, which is called "S". Calculate the total displacement of each axis in "S" respectively, and define "Sx", "Sy" and "Sz" as the total displacement of the x, y and z axes respectively.
  (2) According to the maximum engraving speed and acceleration set by the operator, calculate the velocity component and acceleration component of each axis in this displacement segment. (3)
  Determine which speed segment the current data is in, calculate the number of pulses in the acceleration, uniform speed and deceleration segments of each segment of displacement and the initial frequency of each speed segment according to different situations, and send the data to FPGA.
  (4) FPGA performs interpolation operations based on the received data, and finally controls the speed of the stepper motor to achieve three-axis linkage.
  Continuous trajectory control of engraving machine
  In CNC machining, the motion controller uses interpolation algorithms to control the tool to move at a certain speed relative to the workpiece and cut out the part contour according to a given path. Interpolation technology is the core technology of CNC system, which mainly solves the problem of controlling the motion trajectory of the tool and the workpiece. The interpolation operation of this system is completed in an embedded processor with ARM9 as the core.
  Taking the interpolation operation of two-dimensional basic straight lines as an example, first, according to the pulse equivalent, the total number of pulses to be sent, mx and my, of the XY axis are calculated respectively. The axis with more pulses in XY is set as the basic axis and used as the reference axis. The purpose is to select a stable reference axis to facilitate the calculation of each pulse sending. In actual operation (taking the X axis as the basic axis), the frequency f of the basic axis sending pulses is calculated according to the processing speed and pulse equivalent. In each time interval, a basic axis pulse is sent and the number of sending times m is accumulated.
  When, then in
  Formula 1
  , a short axis pulse is sent. When, it is necessary to send a short axis pulse after a delay after ([ ] is a rounding operation). In Formula 1, the multiple n can also be regarded as a counter of the short axis. When m=mx, that is, n=my, the interpolation operation is completed. The schematic diagram of pulse sending of the digital integration method is shown in Figure 4:
  In Figure 4 (a), the ratio of the line segment XY axis is 2:1. If the moving point is depicted to move along a predetermined path, the speed ratio of the XY axis is 2:1. According to the control law of the stepper motor, the pulse frequency ratio of the two axes is controlled to be 2:1, and the ratio of the number of pulses sent by the two axes is 2:1. According to the above digital integral interpolation algorithm, the pulse sending frequency of the X-axis is first calculated. In each time interval, a basic axis pulse is sent, and a short axis pulse is sent every 2 basic axis pulses, so that the frequency of the short axis pulse is 0.5. When the basic axis is sent, the short axis pulse is also sent, and the number is consistent with the calculation. When the ratio of the two axes is 3:2, as shown in Figure 4(b), a short axis pulse is sent after every 1.5 basic axis pulses are sent, which effectively guarantees the pulse sending ratio, thereby ensuring the accuracy of the depicted line segment.
  When the arc is interpolated, the fitting chord length is first calculated based on the arc allowable radius error er:
  (r is the arc radius) Formula 2
  then calculates the corresponding center angle based on the fitting chord length l:


  Formula 3


  Figure 4 Schematic diagram of pulse transmission of interpolation algorithm
  The original arc is re-divided into multiple fitting straight lines by the center angle corresponding to the chord length, and then the arc is depicted by linear interpolation.
  This operation method no longer relies on the accumulation operation of the counter each time, but is based on the principle of velocity vector synthesis. By controlling the transmission ratio of each axis pulse, the synthesis point moves in the direction of the processing trajectory to achieve the processing purpose, avoiding repetitive integral accumulation operations, and all pulse data can be calculated at one time, as long as it is sent at a certain frequency. The
  program flow chart of the interpolation algorithm is shown in Figure 5:


  Figure 5 Digital integration method interpolation flow chart
  First, determine whether there is external interrupt information input, including mechanical signals in system requirements, such as machine tool origin, workpiece processing origin, tool change, spindle speed regulation and power-off protection input/output signals, as well as operator input pause, stop processing, manual acceleration and deceleration control and other information. When the interrupt program responds, it is necessary to protect the relevant key information that the program has calculated, including the read processing segment data information and the processed segment position information.
  Secondly, according to the definition of pulse equivalent: relative to the displacement of the machine tool moving parts of each pulse signal, the total number of pulses of each processing axis is:


  (where l is the length component of each axis)
  Formula 4
  and select the axis with the maximum number of processing pulses as the basic axis. The motor controller also needs the direction information of the pulse. The pulse direction is determined by the pre-agreed direction regulations and can be determined by the read-in data file. The initial values of each counting parameter are set in the interpolation calculation initialization stage, as shown in the digital integration method interpolation flow chart in Figure 5. COUNT stores the ratio between the basic axis and the short axis, and its value is: the number of basic axis pulses/the number of short axis pulses; LONG is the cumulative statistical variable of the basic axis, and its value increases by 1 every time the basic axis sends a pulse; SHORT is the cumulative statistical variable of the short axis, and the value of COUNT is assigned to SHORT in the initialization stage. Each interpolation operation starts with the basic axis sending a pulse and accumulating the value in LONG; then the integer part of the value of LONG and the value of SHORT is determined. When the two are equal, it means that a short axis pulse will be sent at this time. If they are not equal, a basic axis pulse will continue to be sent. When sending short axis pulses, since the pulses of the short axis are sent following the basic axis, the delay time required after the basic axis is sent is calculated, and the delay value is 1/f (SHORT-LONG), and the value of COUNT is accumulated in SHORT. The new SHORT value is used as the judgment basis for the next short axis pulse. After each calculation of each sending axis, a set of fixed information will be generated: pulse sending flag, pulse delay time and pulse direction flag. This information will be further processed to generate control pulse information sent to FPGA.
  Result Analysis
  When ARM is used as the main computing processor, it not only needs to run the interpolation program, perform real-time processing information reading, speed control budget and pulse sending calculation, but also needs to run the background operating system and process user input information. If the delay program is set on it and the pulse sending is controlled, the computing burden of ARM will become too heavy. Therefore, the FPGA co-processing computing solution is adopted to assist ARM in the delayed sending of pulses.
  Assume that the frequency of FPGA is


  , then the time for a cardinality accumulation calculation is


  , the current execution speed of the motor is Vs, the pulse equivalent is, then the current frequency of sending pulses is:


  Formula 5
  : The interval of each pulse is converted into the cumulative number of FPGA:


  Formula 6
  uses an exponential method in the acceleration and deceleration stage, in which the frequency change of each section of the basic axis is calculated in advance, that is, fs in Formula 6 is a specific value, and for the short axis, its delayed transmission frequency value can be obtained by the formula 1/f (SHORT-LONG) used in the calculation, that is, the frequency of each step pulse can be determined by Formula 6. When ARM calculates the transmission of each pulse, it needs to calculate the delay count number of the pulse, and then send it to the FPGA together with the direction of the pulse transmission. The stepper motor controller has certain requirements for the duration of the control pulse. Assuming that the required pulse duration is TP, the pulse duration count in the FPGA is:
  Formula 7
  FPGA can send this pulse to the stepper motor controller according to the theoretical calculation frequency through the pulse direction and pulse count number, that is, it can count the delay, and complete the control pulse transmission of the motor controller. The control waveform sent is shown in Figure 6:


  Figure 6 Pulse waveforms of each axis
  It can be seen from Figure 6 that the interpolation algorithm not only sends pulses evenly and proportionally, but the short axis can control the motor according to its own frequency change law.
  Conclusion
  According to the actual needs of the engraving machine and the torque-frequency characteristics of the stepper motor, an embedded CNC engraving machine control system was developed. The system hardware is based on ARM and FPGA, and the software is based on the Windows CE.net operating system. Combined with the inherent characteristics of the stepper motor and the interpolation program, the engraving machine can complete various engraving files with three axes. Practice shows that the controller can be separated from the support of the industrial computer, independently complete the analysis and calculation of the original design data, and finally control the motor to complete the engraving through the interpolation algorithm, and can accurately achieve speed control and trajectory control during the engraving process.

This post is from Microcontroller MCU
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list