A stepper motor is an actuator that converts electrical pulses into angular displacement. When the stepper driver receives a pulse signal, it drives the stepper motor to rotate a fixed angle (called the "step angle") in the set direction, and its rotation runs at a fixed angle. The angular displacement can be controlled by controlling the number of pulses to achieve the purpose of accurate positioning; at the same time, the speed and acceleration of the motor rotation can be controlled by controlling the pulse frequency to achieve the purpose of speed regulation. As a special motor for control, the stepper motor is widely used in various open-loop controls because it has no accumulated error (accuracy is 100%).
1 Positioning principle and solution
Contents
1.1 Stepper motor acceleration and deceleration control principle
When a stepper motor drives an actuator to move from one position to another, it goes through the process of speed increase, constant speed, and deceleration. When the operating frequency of the stepper motor is lower than its own starting frequency, it can be started directly at the operating frequency and run at this frequency. When it needs to stop, it can be directly reduced from the operating frequency to zero speed.
When the stepper motor operating frequency fb>fa (starting frequency when starting with load), if the stepper motor is started directly with the fb frequency, it will cause the stepper motor to lose steps or even stall. Similarly, when it stops suddenly at the fb frequency, due to inertia, the stepper motor will overshoot, affecting the positioning accuracy. If the speed is increased or decreased very slowly, the stepper motor will not lose steps or overshoot, but it will affect the working efficiency of the actuator. Therefore, the acceleration and deceleration of the stepper motor must ensure that it moves to the specified position at the fastest speed (or the shortest time) without losing steps or overshooting.
There are two commonly used frequency control methods for stepper motors: linear frequency control and exponential frequency control. The exponential curve method has strong tracking ability, but poor balance when the speed changes greatly. The linear method has good stability and is suitable for fast positioning with large speed changes. The method of increasing and decreasing with constant acceleration has a simple rule and is relatively simple to implement with software. This article adopts this method.
1.2 Positioning Solution
To ensure the positioning accuracy of the system, the pulse equivalent, that is, the distance moved by the stepper motor for one step angle, should not be too large, and the stepper motor should be slow to increase or decrease speed to prevent loss of step or overshoot. However, these two factors together bring about a prominent problem: the positioning time is too long, which affects the working efficiency of the actuator. Therefore, in order to obtain a high positioning speed while ensuring positioning accuracy, the entire positioning process can be divided into two stages: coarse positioning stage and fine positioning stage.
In the rough positioning stage, a larger pulse equivalent is used, such as 0.1mm/step or 1mm/step, or even higher. In the fine positioning stage, in order to ensure positioning accuracy, a smaller pulse equivalent is used, such as 0.01mm/step. Although the pulse equivalent becomes smaller, the positioning speed will not be affected because the fine positioning stroke is very short (it can be set to about one-fiftieth of the full stroke). In order to achieve this goal, the mechanical aspect can be achieved by using different speed change mechanisms.
Industrial machine tool control plays an important role in industrial automation control, and positioning drilling is a common process. Assume that the tool or workbench is to be moved from point A to point C. It is known that AC=200mm, and AC is divided into two sections, AB and BC, AB=196mm, BC=4mm. The AB section is the rough positioning stroke, and a pulse equivalent of 0.1mm/step is used to move quickly according to the linear frequency increase and decrease law. The BC section is the fine positioning stroke, and a pulse equivalent of 0.01mm/step is used to complete the precise positioning with a low-frequency constant speed motion at point B. When the rough positioning ends and the fine positioning begins, the PLC automatically realizes the replacement of the speed change mechanism.
2 Positioning Program Design
Contents
2.1 PLC pulse output instructions
Currently, the more advanced PLCs not only have basic logic instructions that meet the requirements of sequential control, but also provide a wealth of functional instructions. The PLUS instruction of the Siemens S7-200 series PLC outputs PTO or PWM high-speed pulses at Q0.0 and Q0.1, with a maximum output frequency of 20KHz. The pulse train (PTO) provides square wave output (50% duty cycle), and the user controls the cycle and number of pulses. Pulse width modulation (PWM) can provide continuous, variable duty cycle output, and the user controls the cycle and pulse width. This article uses the multi-segment pipeline working mode of PTO to achieve coarse positioning, and the single-segment pipeline mode of PTO to achieve fine positioning.
In the above example, it is assumed that the starting and ending frequency of the motor is 2KHz and the maximum pulse frequency is 10KHz. During the coarse positioning process, 200 pulses are used to complete the frequency increase acceleration and 400 pulses are used to complete the frequency decrease deceleration. When using the PLC's PTO multi-stage pipeline pulse output, use the following formula to calculate the pulse increment value during the frequency increase and decrease process.
The cycle increment of a given segment = (ECT-ICT)/Q, where: ECT = the end cycle time of the segment, ICT = the initial cycle time of the segment. Using this formula, the cycle increment of the acceleration part (segment 1) is 2, and the cycle increment of the deceleration part (segment 3) is 1. Since the second segment is a constant speed section, the cycle increment is 0. If the PTO envelope table is stored starting from VB500, then Table 1 is the envelope table value of the above example.
2.2 Source Program
//Main program
LD SM0.1 //The first scan is 1
R Q0.0, 1 //Reset image register bit
CALL 0 //Call subroutine 0 to initialize coarse positioning related parameters
LD M0.0 //Coarse positioning completed
R Q0.0,1
CALL 1 //Call subroutine 1 to initialize parameters related to precise positioning
//Subroutine 0, coarse positioning
LD SM0.0
MOVB 16#A0, SMB67 //Set control word: allow PTO operation, select ms increment, select multi-segment operation
MOVW 500, SMW168 //Specify the starting address of the envelope table as V500
MOVB 3, VB500 //Set the number of envelope table segments to 3
MOVW 500, VW501 //Set the initial period of the first segment to 500ms
MOVW -2, VD503 //Set the first period increment to -2ms
MOVD 200, VD505 //Set the number of pulses in the first segment to 200
MOVW 100, VW509 //Set the initial period of the second segment to 100ms
MOVW 0, VD511 //Set the second period increment to 0ms
MOVD 1360, VD513 //Set the number of pulses in the second segment to 1360
MOVW 100, VW517 //Set the initial period of the third segment to 100ms
MOVW 1, VD519 //Set the third period increment to 1ms
MOVD 400, VD521 //Set the number of pulses in the third segment to 400
ATCH 2, 19 //Define interrupt program 2 to handle PTO completion interrupt
ENI //Enable interrupts
PLS 0 //Start PTO operation
//Subroutine 1, precise positioning
LD SM0.0 //The first scan is 1
MOVB 16#8D, SMB67 // Enable PTO function, select ms increment, set pulse number and period
MOVW 500, SMW68 //Set the precision positioning cycle to 500ms
MOVD 400, SMD72 //Set the number of pulses to 400
ATCH 3, 19 //Define interrupt program 3 to handle PTO completion interrupt
ENI //Enable interrupts
PLS 0 //Start PTO operation
//Interrupt procedure 2
LD SM0.0 //Always 1
= M0.0 //Start precise positioning
//Interrupt procedure 3
LD SM0.0 //Always 1
= M0.1 //Realize other functions
Previous article:Several torque modes of electric motor
Next article:How to convert PLC switch signal and analog signal
Recommended ReadingLatest update time:2024-11-16 11:38
- Popular Resources
- Popular amplifiers
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications