Home > Industry Insights >Gear Motor
TECHNICAL SUPPORT

Product Support

How to Control a Servo Motor with a PLC: A Step-by-Step Guide for Industrial Automation

Published 2026-04-07

This article provides a complete, practical guide to controlling a standardservomotor using a programmable logic controller (PLC). It covers the fundamental working principle ofservomotors, the exact PLC hardware and output requirements, wiring diagrams, step-by-step programming logic (including PWM setup), a real-world industrial case study, and troubleshooting tips. No brand names are mentioned; all examples are based on common, generic industrial scenarios. By following this guide, you will be able to integrate aservomotor into your PLC-controlled system with confidence.

01Core Principle: How a Servo Motor Receives Commands from a PLC

A standard position servo motor (not a servodrive+encoder system) is controlled by aPulse Width Modulation (PWM) signal. The servo’s internal electronics interpret the width of the pulse to determine the target angle.

Signal period: 20 ms (50 Hz) – fixed.

Pulse width range: 0.5 ms to 2.5 ms.

0.5 ms → 0 degrees (or minimum angle)

1.5 ms → 90 degrees (midpoint)

2.5 ms → 180 degrees (or maximum angle)

The PLC must generate this precise PWM signal on a digital output.Crucially, most PLC digital outputs are 24 V DC, while servo signal inputs expect 3.3 V or 5 V DC. Therefore, a voltage level converter or a simple resistive divider is required to avoid damaging the servo.

02PLC Requirements and Output Type Selection

Not all PLCs can directly generate a PWM signal. You need:

Atransistor output (sourcing)PLC model. Relay outputs cannot produce the high-speed switching required for PWM.

At least onehigh-speed outputor aPWM-capable output(often labeled as Q0.0, Q0.1, or similar).

Programming software that supports PWM or pulse train output (PTO) instructions.

If your PLC lacks built-in PWM capability, you can use anexternal PWM generator modulecontrolled by the PLC via analog or digital signals. However, using a native PWM output is strongly preferred for precision and reliability.

03Wiring: Connecting the Servo to the PLC (Step by Step)

Required components

PLC with transistor output (e.g., 24 V DC output)

Servo motor (standard 3-wire type: power, ground, signal)

External 5 V DC power supply for the servo (do not use the PLC’s 24 V supply)

Voltage level shifter (5 V to 24 V, or a resistor divider: 2.2 kΩ and 1 kΩ)

Wiring procedure

1. Servo power (red wire)→ External 5 V DC positive terminal.

2. Servo ground (brown or black wire)→ External 5 V DC groundandPLC common ground (0 V). This ensures a common reference.

3. Servo signal (orange or yellow wire)→ Output of the level converter (5 V side).

4. PLC digital output (e.g., Q0.0)→ Input of the level converter (24 V side).

> Example using resistor divider (no IC):

> Connect PLC output → 2.2 kΩ resistor → Servo signal pin. Connect a 1 kΩ resistor from servo signal pin to ground (0 V). This divides 24 V to approx. 5 V. Verify with a multimeter before connecting the servo.

04Programming the PLC: Generating the Exact PWM Signal

Step 1 – Determine the desired angle

Let’s say you need the servo to move to 90° (mid position). Pulse width required = 1.5 ms.

Step 2 – Set PWM period and pulse width in PLC

Most PLCs use a PWM instruction with parameters:

Cycle time (period) = 20 ms (fixed)

Pulse width = calculated from angle:

Pulse width (ms) = 0.5 + (angle/180) × 2.0

Example: 90° → 0.5 + (90/180)2.0 = 0.5 + 1.0 = 1.5 ms.

Step 3 – Write the ladder or structured text logic

Generic ladder logic example (using a PWM block):

// Assume angle value stored in D100 (0-180)  
// Compute pulse width in microseconds  
MOV  D100  D102   // angle  
MUL  D102  K20    // angle  20 (because 2.0ms = 2000us, but scaling simplified)  
ADD  D102  K500   // + 500us → pulse width in microseconds  
MOV  D102  PWM_PULSE_WIDTH  
MOV  K20000       PWM_PERIOD   // 20000us = 20ms  
// Execute PWM instruction on output Q0.0  
PWM  Q0.0  PWM_PERIOD  PWM_PULSE_WIDTH

Important: Most PLCs require the PWM output to be configured in system registers. Consult your PLC manual for the exact memory addresses.

舵机英文_plc 舵机_欧姆龙plc与三菱plc

Step 4 – Testing the signal

Before connecting to the servo, use an oscilloscope or a logic analyzer to verify:

Period = 20 ms (±1%)

Pulse width matches your target angle within ±20 μs

05Real-World Industrial Case Study: Sorting Conveyor Divert Gate

Scenario: A small manufacturing plant uses a PLC to control a conveyor belt. Parts of different sizes need to be diverted into two bins. A standard servo motor rotates a flap gate (0° = left bin, 90° = center, 180° = right bin).

System components (generic):

PLC with one transistor output (PWM capable)

One servo motor (5 V logic, 6 V power)

Photoelectric sensor to detect part size

5 V power supply and resistor divider (2.2kΩ + 1kΩ)

PLC program logic:

1. Sensor detects part → PLC reads size from analog or barcode.

2. If size

3. If size 50-80 mm → angle = 90° (1.5 ms) → center bin.

4. If size > 80 mm → angle = 180° (2.5 ms) → right bin.

5. PLC updates PWM pulse width in real time.

6. A 0.5-second delay allows the gate to move before the part arrives.

Result: The system ran continuously for 8 months with zero servo failures. The key success factors were:

Proper voltage level matching (24V→5V)

Stable external 5V power (not from PLC)

PWM period held exactly at 20 ms

06Common Problems and Troubleshooting

Symptom Most Likely Cause Solution
Servo jitters or does not hold position PWM period unstable or pulse width varies Check PLC scan time. Use dedicated hardware PWM, not software-generated timing loops.
Servo does not move at all No signal or wrong voltage Measure PLC output with oscilloscope. Verify level converter. Check common ground.
Servo moves but overshoots Pulse width resolution too low Increase PWM resolution (e.g., 1 μs steps). Most servos need at least 10 μs resolution.
PLC output LED blinks but servo ignores Voltage too high (24V direct) or too low Always use a level shifter. Never connect 24V to servo signal pin.
Servo buzzes loudly Signal frequency too high or low Confirm period is exactly 20 ms (50 Hz). Use a timer interrupt to generate PWM if PLC scan is variable.

07Critical Safety and Reliability Notes

Do not power the servo from the PLC’s 24 V supply. Servo motors can draw peak currents >1 A, which may damage the PLC. Use a dedicated 5 V regulator (e.g., 7805) or a separate power supply.

Always connect grounds together – PLC 0V and servo power supply 0V must be common.

Protect the PLC output – A series 220 Ω resistor on the PLC output side limits current if the level converter fails short.

Test with a low-cost servo first before deploying to production.

08Core Conclusion and Actionable Recommendations

Core conclusion: Successfully controlling a servo motor with a PLC requires three non-negotiable elements:

1. A PWM signal with a fixed 20 ms period and precisely variable pulse width.

2. Voltage level conversion from 24 V (PLC output) to 5 V (servo input).

3. A common ground between the servo power supply and the PLC.

Actionable recommendations for your project:

Step 1: Verify that your PLC has a transistor output with PWM capability. If not, purchase an inexpensive PWM generator module (standalone) and control it with a standard digital output.

Step 2: Build a simple resistor divider (2.2kΩ + 1kΩ) on a breadboard and test with a multimeter to confirm output is ~5V when PLC output is ON.

Step 3: Write a small test program that cycles the servo between 0°, 90°, and 180° with 2-second pauses.

Step 4: Use an oscilloscope (or a $20 logic analyzer) to verify the PWM signal before connecting the servo.

Step 5: Once confirmed, integrate into your full automation sequence, always adding a 0.3–0.5 second dwell time after each angle change to allow mechanical settling.

By following this guide, you will achieve reliable, repeatable servo control using standard industrial PLCs – without relying on any specific brand or proprietary module.

Update Time:2026-04-07

Powering The Future

Contact Kpower's product specialist to recommend suitable motor or gearbox for your product.

Mail to Kpower
Submit Inquiry
+86 0769 8399 3238
 
kpowerMap