Positioning principle and solution of stepper motor in PLC

Publisher:CrystalClearLatest update time:2024-06-03 Source: elecfansKeywords:PLC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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


Keywords:PLC Reference address:Positioning principle and solution of stepper motor in PLC

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

Guoxin Sichen | PLC solution based on HME-M7 and domestic ferroelectric memory PB85RS2MC
PLC generally refers to a programmable logic controller (programmable control device), which is a digital operation electronic system designed specifically for use in industrial environments. It uses a programmable memory to store instructions for performing logical operations, sequential control, timing, counting a
[Embedded]
Guoxin Sichen | PLC solution based on HME-M7 and domestic ferroelectric memory PB85RS2MC
Communication and programming of Mitsubishi PLC, with practical examples
Mitsubishi FX series PLC is Mitsubishi's basic PLC. There are several common ways of communication between them, which are as follows: CC-LINK, N:N network connection, and parallel connection. 1. CC-LINK connection The CC-LINK connection diagram is as follows: The corresponding PLCs can
[Embedded]
Communication and programming of Mitsubishi PLC, with practical examples
How to add modules to Mitsubishi PLC programming software FX2N PLC
Mitsubishi Electric's FX2N series PLC is a small, high-performance programmable logic controller that is widely used in industrial automation. FX2N PLC supports a variety of expansion modules, including input/output modules, analog modules, special function modules, etc. This article will detail how to add modules t
[Embedded]
Is PLC just logic control? What about PLC network communication?
When people talk about the Industrial Internet, they will discuss PLCs in industrial sites. However, most people seem to have the same understanding of PLCs as they did 20 years ago: Is PLC just logic control? In fact, this was not the case 20 years ago. The form factor of the controller has changed Yes, t
[Embedded]
Is PLC just logic control? What about PLC network communication?
PLC Solutions for Industrial IoT Applications
Industrial Internet of Things (IIoT) applications promise to improve the efficiency of complex industrial systems. Since these IIoT applications are enabled by next-generation microcontroller-based programmable logic controllers (PLCs), developers are challenged to support the various industrial interfaces required
[Embedded]
PLC Solutions for Industrial IoT Applications
Configuration of Modbus to Ethernet/IP gateway module and Inovance PLC communication in gateway configuration software
Through the Modbus to Ethernet/IP gateway module (XD-MDEP100), interconnection between different protocols can be achieved, making data exchange between devices more convenient and efficient. As a slave station of the ETHERNET/IP network, the gateway can connect to PLCs of brands such as AB (Rockwell), Omron, Keyenc
[Embedded]
Configuration of Modbus to Ethernet/IP gateway module and Inovance PLC communication in gateway configuration software
Modbus communication of Siemens PLC
Modbus communication standard protocol can be transmitted through various transmission methods, such as RS-232C, RS-485, optical fiber, radio, etc. Modbus has two serial transmission modes, ASC2 and RTU mode. Those that support Modbus protocol generally support RTU mode, and both communicating parties (master statio
[Embedded]
Modbus communication of Siemens PLC
How to set the power-off retention of Siemens S7-200PLC counter?
1. When using Siemens S7-200plc, you can choose the following data retention methods: The CPU's built-in supercapacitor can provide power buffering for data and clock retention when the power outage time is not too long. A supercapacitor inside the CPU provides power buffering for the RAM memory afte
[Embedded]
Latest Embedded Articles
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号