Using the S7-200SMART timer to directly control the four-phase eight-beat stepping motor

        S7-200SMART is a small PLC of Siemens. This article introduces a method for PLC to directly control the stepper motor, with a ladder diagram program attached.

        Many of the existing tutorials that can be found use stepper motor drivers, and then use the wizard in the development tool to generate PWM subroutine calls. This method is the most used in actual projects because it is simple and reliable. You can also use PTO, which is also initialized using the wizard in the development tool. You can find many tutorials for the above two methods. There are very few tutorials that only use timers for direct control. The direct control introduced in this article is not applicable to the motor driver, and only relies on the timer of the PLC to generate the control pulse.

 

Brief introduction of stepper motor

        Since it is to control the stepper motor, we must first understand the stepper motor. Stepper motors are divided into three categories: permanent magnet, reactive, and hybrid. You can check the specific differences by yourself, so I won’t go into details here (don’t ask, it’s just lazy code).

        The four-phase stepper motor forms rotating magnetic fields with different strengths and directions by energizing the four stator coils in different order and time, and attracts the rotor to rotate in different directions and speeds. According to the different power-on sequences, it can be divided into three working modes: single four-beat, double four-beat, and eight-beat. The step angles of the single four-beat and the double four-beat are equal, but the rotational moment of the single four-beat is small. The step angle of the eight-beat working method is half of that of the single four-beat and double four-beat. Therefore, the eight-beat working method can not only maintain a higher rotational torque but also improve control accuracy. This article introduces the eight-beat driving method.

5a289a81314f43b0be6b3a976c8b93fc.png

 

Control principle:

The four-phase coils of the four-phase eight-beat motor are represented by A, B, C, and D respectively.

When the motor is rotating forward, its working mode is as follows: A→AB→B→BC→C→CD→D→DA→A.

When the motor reverses, its working mode is as follows: A→AD→D→DC→C→CB→B→BA→A.

 

Design requirements:

        Design a program to realize the control of start, stop, forward rotation and reverse rotation of the stepping motor and realize three-speed speed regulation, that is, fast, medium speed and slow speed. The working mode of the stepper motor in the control module is a four-phase eight-beat motor. The four-phase coils of the motor are represented by A, B, C, and D respectively. Need to use the digital tube to display the motor gear.

 

Realization of PLC Ladder Diagram Program

 

The I/O configuration allocation of this program is as follows:

I/O port

connection port

I/O port

connection port

I0.0

start up

Q0.3

Stepping motor D phase

I0.1

stop

Q1.0

Nixie tube A section

I0.2

Forward

Q1.1

Nixie tube B segment

I0.3

reverse

Q1.2

Nixie tube C segment

I0.4

fast

Q1.3

Digital tube D segment

I0.5

slow

Q1.4

Digital tube E segment

Q0.0

Stepper Motor Phase A

Q1.5

Nixie tube F segment

Q0.1

Stepper motor B phase

Q1.6

Digital tube G segment

Q0.2

Stepper Motor Phase C

 

 

 

        The following is the program to realize the control of the four-phase eight-step stepper motor by using the Step 7MicroWIN SMART software programming of the s7-200 smart official integrated development environment. The working principle and the explanation of this procedure are given in the form of comments in the figure below. Here we only declare the meaning of the variables appearing in the program: VB10 (byte variable storing motor speed gear), VW50 (word variable storing speed, that is, pulse width), VB100 (byte variable for eight-beat feed control) .

d150a40e2a464f2eabedb8809605f27e.png

f5f681ba71354ae0acfa56a8b82b267e.png

56b9458d6230491993068349c393070e.png

91f066c7e36244c3a1425ce66d1ff94c.png

 

b7f9c29762f24523b6d32f355d7759ed.png

c377d4517227449d8f92d7e9ed4f79c8.png

 

Here I want to remind you of a problem that I overlooked in programming:

In the program part of the control pulse, I first wrote the following ladder diagram, and found that there was a problem with the output relay, which did not output according to my program, but the software showed that there was no problem, and the output relay could output normally. I first disassembled the test box to verify that the stepper motor is ok, and then used the power supply to supply power to the stator coils in sequence according to the control sequence, and found that it can run normally. Therefore, there must be a problem with the program. The problem is that the output relay coil cannot be reused, as shown in the figure below:

b6bdc3543b3e4b62bae3da1ae5cf2400.png

 The solution is to use a set of intermediate relays as the output of 8 beats, and then use these intermediate relays to control the real output ABCD four-phase coil.

 

postscript

        It is not too difficult for me to complete the PLC to directly control the stepper motor. But this time the design is also deeply touched, I thought I learned it well. After debugging for a long time, I couldn't find any faults, and I swore that my program was fine. After dismantling the experiment box and debugging the stepper motor alone to no avail, the teacher made it clear that the output relay coil cannot be reused, and Fang felt his ignorance and insignificance. There is no limit to the sea of ​​learning and no end, and half-knowledge makes people laugh and be generous.

 

Guess you like

Origin blog.csdn.net/weixin_63268005/article/details/130953066