How to Control Multiple Servo Motors with a Single PLC

How to Control Multiple Servo Motors with a Single PLC

Hello everyone, I am Lao Liu, and I have been in the automation industry for over 20 years. Today, let’s discuss a practical topic: how to control multiple servo motors with a single PLC. I have noticed that many beginners feel overwhelmed when they hear about servo control, but once you grasp the key points, it’s not that complicated.

Several Common Methods of Servo Control

Before we begin, let me outline a few common methods for controlling servos with a PLC:

  1. Pulses + Direction Method: Old-school but effective
  2. Analog Control: Simple but limited in precision
  3. Fieldbus Control: The current mainstream
  4. Motion Control Cards: High-end but complex

Each of these methods has its own advantages and disadvantages, and we need to choose the appropriate solution based on the site requirements. Below, I will focus on the two most commonly used methods.

Pulses + Direction: An Old but Useful Control Method

This is the first servo control method I encountered, and I still use it frequently. The advantages are low cost and simple wiring, while the downside is that it is susceptible to interference at high speeds.

Hardware Requirements:

  • PLC with high-speed pulse output (e.g., Siemens S7-200SMART, Mitsubishi FX3U, etc.)
  • Servo driver that supports pulse commands (almost all servos support this)
  • Shielded twisted pair cable (make sure to use good quality cable! Don’t skimp on this)

Wiring Method:

PLC pulse output (P) ——> Servo driver pulse input (PULS)
PLC direction output (D) ——> Servo driver direction input (SIGN)
PLC common (COM) ——> Servo driver common (COM)

I remember last year when I visited a filter press site, the customer said the servo was always running erratically. Upon inspection, I found they were using regular electrical wires to connect the PLC and servo, and I couldn’t help but laugh. After replacing it with twisted shielded cable, the problem was immediately resolved!

Code Example (using Siemens S7-200SMART as an example):

// Servo 1 running program (simplified version)
LD     I0.0                // Start button
EU                         // Rising edge detection
MOVD   10000, VD100        // Run 10000 pulses
MOVD   5000, VD104         // Speed 5000Hz
PULS   Q0.0, Q0.1, VD100, VD104  // Output pulses to Q0.0/Q0.1

// Servo 2 running program
LD     I0.1                // Servo 2 start button
EU                         // Rising edge detection
MOVD   5000, VD200         // Run 5000 pulses
MOVD   3000, VD204         // Speed 3000Hz
PULS   Q0.2, Q0.3, VD200, VD204  // Output pulses to Q0.2/Q0.3

Using this method, it is completely feasible to control 2-4 servos simultaneously. However, be aware that the PLC pulse output channels are limited; for example, the S7-200SMART supports a maximum of 4 pulse outputs, so if you want to control more, you will need to switch methods.

Fieldbus Control: The Mainstream of Mainstream

Currently, the most common method for multi-servo control in industrial settings is fieldbus control, especially with protocols like PROFINET and EtherCAT.

Hardware Requirements:

  • PLC that supports fieldbus (e.g., Siemens S7-1200/1500, Mitsubishi iQ-R, etc.)
  • Servo drivers that support the same bus protocol
  • Industrial Ethernet switch and cables

A few days ago, I went to a customer to retrofit equipment. The old pulse control system had a lot of wiring, but after switching to PROFINET, I managed to control 8 servos with just a few network cables, making the site much cleaner.

Code Example (using Siemens S7-1500 + PROFINET as an example):

// Servo 1 positioning program
"Servo1_DB"(
    Axis             := "Servo1",
    Execute          := "Start Servo1",
    Position         := 100.0,         // Target position 100mm
    Velocity         := 200.0,         // Speed 200mm/s
    Done             := "Servo1_AtPosition",
    Busy             := "Servo1_Running",
    Error            := "Servo1_Error",
    ErrorID          := "Servo1_ErrorCode"
);

// Servo 2 positioning program
"Servo2_DB"(
    Axis             := "Servo2",
    Execute          := "Start Servo2",
    Position         := 150.0,         // Target position 150mm
    Velocity         := 150.0,         // Speed 150mm/s
    Done             := "Servo2_AtPosition",
    Busy             := "Servo2_Running",
    Error            := "Servo2_Error",
    ErrorID          := "Servo2_ErrorCode"
);

This method may be a bit troublesome to configure initially, but it makes maintenance much easier later on! Servo parameters can be adjusted directly in the PLC, and position data can be read directly, eliminating the need to crawl behind the electrical cabinet to adjust the driver.

Several Tips for Coordinated Control of Multiple Servos

When controlling multiple servos, the biggest concern is coordination. Here are a few practical tips I have summarized:

1. Master-Slave SynchronizationSometimes, multiple motors need to run completely in sync, such as in a gantry structure. You can use a master-slave mode:

// Master-slave synchronization example (Siemens S7 series)
"ServoMasterSlaveSync_DB"(
    Master           := "Master Servo Axis",
    Slave            := "Slave Servo Axis",
    Execute          := "Start Synchronization",
    GearRatio        := 1.0,          // Gear ratio 1:1
    Done             := "Synchronization Complete",
    Error            := "Synchronization Error"
);

2. Electronic CamFor more complex multi-axis coordination, you can use electronic cam functions. In a packaging machine project I worked on last time, five servo axes achieved perfect coordination through electronic cams, moving as smoothly as a symphony.

3. Coordinate SystemsFor motion control involving three or more axes, consider using coordinate system functions. However, this requires higher specifications for the PLC, typically needing a dedicated motion controller.

Practical Problem-Solving Guide

Finally, I would like to share a few typical problems encountered in practice and their solutions:

Problem 1: Servo JitterIn 90% of cases, this is due to inappropriate PID parameters. My experience is to first adjust the P value until the device just stops jittering, and then gradually increase I and D.

Problem 2: Interference Between Multiple ServosWhen using bus control, if you find that servos are interfering with each other, it is often a communication quality issue. Check the quality of the cables and grounding, and install filters if necessary.

Problem 3: Insufficient PrecisionFor precision issues, first check the mechanical parts: is there any backlash, is the drive belt loose? Then consider whether you need to increase the electronic gear ratio.

Last year, I encountered an interesting case where a customer reported that two identical devices had one with normal precision and the other always slightly off. After much troubleshooting, we discovered that poor grounding of the frame was causing interference.

Conclusion

Using a single PLC to control multiple servo motors hinges on selecting the appropriate control method, ensuring communication quality, and paying attention to coordinated control. For beginners, I recommend starting with pulse control to grasp the basic principles before attempting bus control.

If anyone has questions, feel free to leave a comment, and Lao Liu will answer them all!

Leave a Comment