S7-1200 PTO Missed Steps: MotionKing 2LD545 Driver Fix

David Krause16 min read
Motion ControlSiemensTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

S7-1200 PTO Missed Steps with MotionKing 2LD545: Engineering Diagnosis and Fix

Intermittent position loss when migrating a stepper system from an Arduino prototype to a Siemens S7-1200 PTO is one of the most common motion-control integration problems in industrial retrofitting. This article dissects a real field case where a working 5 V Arduino / Oriental Motor PK296DW / MotionKing 2LD545 prototype started dropping steps three times out of ten after the user replaced the controller with a S7-1214C and two SM 1223 modules. The article covers the root cause (logic-level transition, optocoupler forward current, and signal integrity), provides the complete electrical calculation, and gives a step-by-step resolution with TIA Portal configuration, mechanical checks, and verification procedures.

Critical: The defect is electrical, not firmware. TIA Portal axis configuration, command table, and PTO pulse generator are correct; the failure is at the optocoupler input of the MotionKing 2LD545 because the S7-1200 high-level output is 24 V, not 5 V, and the 2.2 kΩ resistor leaves the optocoupler under-driven at the edge of its guaranteed forward current range.

1. Problem Statement

The original system on the prototype bench performed reliably:

  • Controller: Arduino (5 V logic)
  • Stepper: Oriental Motor Nema 34, model PK296DW
  • Stepper driver: MotionKing 2LD545 (2-phase digital stepper driver, optically isolated PUL/DIR inputs)
  • Power supply: MeanWell 24 VDC industrial PSU

After integrating into the production machine, the controller was changed to a Siemens SIMATIC S7-1214C DC/DC/DC with two SM 1223 (DI16/DQ16) modules and one SM 1232 (AQ4) module. The motor, driver, and power supply were kept identical.

Configuration in TIA Portal:

  • Pulse generator: PTO3 on outputs Q0.4 and Q0.5
  • Current-limiting resistor: 2.2 kΩ in series with each PTO line to the driver optocoupler
  • Motion control: Axis with Command Table (PTO mode)
  • Pulses per revolution: 800
  • Mechanical lead: 1.5 mm/rev
  • Configured ramp-up: 0.1 s

Symptom: 7 of 10 moves complete to ±0.1 mm. 3 of 10 moves undershoot by approximately 2 mm. The motor visibly "jumps" or stutters during the constant-velocity portion of the move, not during acceleration or deceleration. The defect is not reproducible deterministically with the same program and parameters.

2. System Architecture and Signal Path

Understanding the signal path from PLC to motor is essential. The chain is:

  1. S7-1200 PTO hardware pulse generator – configured in TIA Portal as a hardware resource on the CPU. For the S7-1214C, pulse generators PTO1–PTO4 are mapped to outputs Q0.0–Q0.3 on the CPU. Note: Q0.4 and Q0.5 are not PTO-capable on the S7-1214C; they are standard 24 V digital outputs at 100 kHz max with no hardware pulse-train engine. PWM/PTO functionality on a signal board (if fitted) is mapped to Qa.0–Qa.3 at 20 kHz max. The user's wiring must be verified against this constraint; if the axis is configured against a non-PTO output, TIA Portal will fall back to a software-emulated pulse on the standard output, which is scan-time dependent and can produce exactly this symptom. Move the pulse output to Q0.0 (PTO1) on the CPU and re-test.
  2. Current-limiting resistor – 2.2 kΩ in series.
  3. MotionKing 2LD545 optocoupler LED input (PUL+ and PUL-) – differential input, internal series resistor, forward voltage approximately 1.2 V at rated If.
  4. Internal differential receiver of the 2LD545, triggering on each pulse edge.
  5. H-bridge switching the two motor phases.

Any break in this chain that prevents a clean edge from being registered by the optocoupler causes a missed pulse, which at 800 pulses/rev and 1.5 mm/rev is exactly 1.875 mm per missed pulse. The reported 2 mm error is consistent with one or two lost pulses during a multi-pulse move.

3. Root Cause Analysis: The 5 V to 24 V Logic-Level Transition

The system worked with Arduino because the Arduino is a 5 V CMOS device. The 5 V high-level output drove the MotionKing 2LD545 optocoupler through a different (smaller) current-limiting resistor, producing a forward current near the device's nominal rating. With the S7-1200, the high-level output voltage is 24 V nominal (minimum 20.4 V per the Siemens S7-1200 System Manual). The same 2.2 kΩ resistor that worked at 5 V is now too large, leaving the optocoupler under-driven.

The user's own troubleshooting confirms the diagnosis:

  • At 1.8 kΩ (higher current): "sometimes it was good and sometimes it didn't reach even half way" – over-current or excessive dv/dt causing ringing and double-triggering.
  • At 2.2 kΩ (lower current): "better but not 100%" – under-driven, edge-rate dependent, intermittent misses.

The fix must target a forward current in the middle of the MotionKing 2LD545 optocoupler's rated If range, not above it, and the resistor must be sized for the S7-1200 worst-case high level of 20.4 V (not 24 V) so that even at low supply the optocoupler still switches cleanly.

4. Optocoupler Forward Current Calculation

The required current-limiting resistor is calculated as:

R = (VOH(min) − VF) / IF

Where:

  • VOH(min) = minimum PLC high-level output voltage at rated load
  • VF = optocoupler LED forward voltage, typically 1.2 V to 1.5 V at rated If
  • IF = desired optocoupler forward current, mid-range of the manufacturer's specification

For a typical MotionKing-class optocoupler input, the guaranteed If is 7 mA to 16 mA. The recommended operating point is 12 mA to 15 mA for clean edges at frequencies above 50 kHz.

Resistor (kΩ) If at 24 V (mA) If at 20.4 V (mA) Verdict
4.7 4.7 3.8 Under-driven, will miss at high speed
3.3 6.7 5.5 Marginal, may work for slow moves only
2.2 10.3 8.5 User's current value, borderline at low supply
1.8 12.6 10.4 Borderline, sensitive to noise spikes
1.5 15.0 12.5 Recommended
1.2 18.6 15.5 Acceptable, near maximum rating
1.0 22.2 18.5 Maximum, check driver absolute maximum

Calculations assume VF = 1.4 V. With VOH(min) = 20.4 V (Siemens S7-1200 minimum high level at full load), the recommended 1.5 kΩ resistor delivers a minimum of 12.5 mA, which is comfortably inside the guaranteed operating range and provides the overdrive margin needed for fast switching edges at 100 kHz PTO frequencies.

To verify the value on the bench, measure the voltage across the resistor with the PLC output high. The forward current is then VR / 1.5 kΩ. Expect 18 V to 22 V across the resistor.

5. Signal Integrity, Cable Routing, and Shielding

Resistor sizing alone may not be sufficient if the wiring is not correct. The S7-1200 PTO and the MotionKing 2LD545 must share a common 0 V reference. If the 24 V supply's 0 V is not bonded to the S7-1200 M terminal, the optocoupler will not see a defined return path. Verify:

  1. Common 0 V: S7-1200 M terminal tied to the MeanWell PSU (−) and to the MotionKing 2LD545 GND.
  2. Twisted pair: Each pulse and direction line should be a twisted pair with its return (PUL+ with PUL−). If using single-ended wiring (PUL− tied to 0 V at the driver), keep the wire short and shielded.
  3. Shielded cable: Use a shielded 24 AWG twisted pair, shield grounded at the PLC end only (one-sided grounding) to avoid ground loops. For long cable runs above 5 m, use differential wiring with shielded twisted pair.
  4. Segregation: Route the pulse/direction cable at least 100 mm from any VFD output cables, motor phase cables, or 24 VDC relay switching wires. Crossings should be at 90°.
  5. PTO output frequency check: At 30 mm/s with 1.5 mm/rev and 800 pulses/rev, the pulse frequency is 30 / 1.5 × 800 = 16 000 Hz. At 100 mm/s it is 53 333 Hz. The S7-1214C PTO supports 100 kHz on Q0.0–Q0.3, so frequency is not the limiter. If the pulse is on a non-PTO output (Q0.4/Q0.5 as the user has), the CPU emulates the pulse in software and is scan-time dependent – this is a likely secondary cause of jitter and missed pulses.

6. TIA Portal Motion Control Configuration

Open the project in TIA Portal (V15.1 or later recommended for S7-1200 motion control). The configuration sequence is critical because a misaligned axis configuration will reproduce the symptom even with the correct hardware.

  1. Add a new TO_Axis_PTO axis under the S7-1200 CPU. Right-click the CPU and select "Add new object" > "Axis".
  2. Select the pulse generator: PTO1 (mapped to Q0.0) or PTO2 (Q0.1). Do not select Q0.4 or Q0.5 – these are not PTO-capable on the S7-1214C.
  3. Enable the axis in the device configuration under "Pulse generators (PTO/PWM)" and set:
    • Output source: onboard CPU
    • Output: Q0.0 (PUL), Q0.1 (DIR)
  4. Configure mechanics:
    • Pulses per motor revolution: 800 (assuming 1/4 microstep on a 200-step motor)
    • Load distance per motor revolution: 1.5 mm
    • Direction reversal: check the actual sign convention by jogging the axis
  5. Configure dynamics:
    • Maximum velocity: 50 mm/s (start well below the failing speed for commissioning)
    • Maximum acceleration/deceleration: 100 mm/s² (corresponds to ramp time ≈ 0.5 s for a 50 mm/s step)
    • Emergency stop deceleration: 200 mm/s²
    • Jerk limiting: leave disabled for first commissioning; enable later if vibration is observed
  6. Set homing mode to passive homing with a digital input, or active homing with a hardware limit switch.
  7. Build the Command Table with the moves you require (relative, absolute, velocity, halt). Each command entry references a "Command" job number from the user program.
  8. PLC program logic:
    • Call MC_Power with Enable := TRUE to enable the axis.
    • Call MC_Reset if the axis is in error.
    • Call MC_CommandTable with the job number, StartMode := MC_BUFFERED or MC_ABORTING, and a Execute trigger.
    • Monitor MC_CommandTable.Done, .Busy, .Error, .ErrorID.
Note: The S7-1200 motion control axis uses the SIMATIC S7-1200 Motion Control function manual as its reference. The MC_CommandTable and MC_Power blocks are PLCopen-compliant, but axis behaviour and error codes are Siemens-specific. Always consult the manual shipped with the installed TIA Portal version for parameter ranges and ErrorID mappings.

7. S7-1200 PTO Hardware Specifications

Parameter S7-1214C DC/DC/DC
Onboard PTO outputs Q0.0, Q0.1, Q0.2, Q0.3
Maximum PTO frequency 100 kHz per output (CPU), 20 kHz per output (signal board)
Output type Solid-state, sourcing (PNP), 24 V
High-level voltage VOH 20.4 V min, 24 V typical at rated load
Output current per point 0.5 A (standard) – 24 V PTO outputs share this rating
Grouping of PTO outputs 4 outputs per group, common 24 V supply
Signal board PTO (optional) SB 1222 DQ4 – 20 kHz max on Qa.0–Qa.3
Minimum pulse width 10 µs at 100 kHz

Source: SIMATIC S7-1200 Programmable Controller – Product Page and the S7-1200 System Manual available on the Siemens Industry Online Support portal.

8. Mechanical Resonance and Speed Selection

The Oriental Motor PK296DW is a 2-phase Nema 34 stepper with a 1.8° step angle. Resonance occurs at specific rotor speeds where the magnetic excitation frequency matches the mechanical natural frequency of the rotor–load system. For Nema 34 steppers with moderate inertia loads, the most problematic band is typically 5 to 15 rps (300 to 900 RPM), exactly the band the user is operating in.

With the configured mechanics:

  • 300 RPM = 5 rps = 7.5 mm/s
  • 900 RPM = 15 rps = 22.5 mm/s
  • 1200 RPM = 20 rps = 30 mm/s (user's failing speed)

The user reports "jumps" at constant speed. Two distinct phenomena produce this visual effect:

  1. Mid-band resonance: The rotor momentarily stalls at a resonance speed, then "snaps" past it. Visible as a stutter. Solution: change the speed to move through the resonance band quickly (use a short, sharp ramp), or enable microstepping (already at 1/4) to a higher value (1/8 or 1/16) on the 2LD545 DIP switches.
  2. Missed pulse from optocoupler underdrive: The optocoupler fails to register a pulse. The motor stalls for one pulse period (62.5 µs at 16 kHz) and then continues at the next pulse. Visible as a single stutter. Solution: increase optocoupler forward current as described in section 4.

Both can occur simultaneously. The first step is to fix the electrical interface, then re-evaluate the mechanical behaviour.

9. Step-by-Step Resolution Procedure

  1. Verify pulse output assignment: Open TIA Portal > Device Configuration > CPU Properties > Pulse generators. Confirm the axis is bound to PTO1 (Q0.0) or PTO2 (Q0.1), not Q0.4 or Q0.5. This is the most common root cause and must be fixed first.
  2. Re-wire the pulse and direction outputs to Q0.0 and Q0.1. Move the 2.2 kΩ resistors accordingly.
  3. Measure the high-level voltage on the S7-1200 output with a multimeter when the output is forced high. Expect 20.4 V to 24 V.
  4. Calculate the correct resistor for 12 mA to 15 mA through the optocoupler. With VOH(min) = 20.4 V and VF = 1.4 V: R = 19 / 0.012 = 1583 Ω. Use a 1.5 kΩ, 0.25 W, 1 % metal film resistor. Replace the 2.2 kΩ resistors on both PUL and DIR lines.
  5. Verify common 0 V between S7-1200 M terminal and MotionKing 2LD545 GND terminal. Add a dedicated 1.5 mm² wire if not already present.
  6. Re-cable with shielded twisted pair, shield bonded to PLC cabinet ground at the entry gland only. Route away from VFD and motor phase cables.
  7. Download the corrected configuration to the S7-1200 and perform an online axis diagnostic. In TIA Portal: "Online > Diagnostics > Motion Control diagnostics" shows actual position, velocity, and following error.
  8. Run a 50 mm move at 5 mm/s as the baseline test. Measure actual vs commanded position with a dial indicator or caliper. Expect ≤ 0.05 mm error.
  9. Run a 50 mm move at 30 mm/s (the user's original failing speed). Repeat 10 times. Expect 10/10 success.
  10. Run a 50 mm move at 100 mm/s to confirm headroom.
  11. Run a 1000 mm move at 30 mm/s to detect cumulative drift. If cumulative drift appears, the problem is mechanical (backlash, leadscrew error) rather than electrical.

10. Verification and Commissioning

After the fix, the following verifications confirm a robust installation:

  • Static check: With the PLC stopped and outputs forced, measure the voltage across each current-limiting resistor. Expect approximately (24 − 1.4) = 22.6 V across a 1.5 kΩ resistor (15 mA). The voltage across the optocoupler LED should be approximately 1.4 V.
  • Dynamic check with oscilloscope: Trigger on the rising edge of PUL+. Expect a square wave with a rise time below 1 µs. Look for any ringing or undershoot. Ringing below the input threshold will cause double counting. A small RC filter (100 Ω + 100 pF) at the driver input can be added if ringing is present.
  • Following error check: In TIA Portal online diagnostics, observe the axis's actual position versus commanded position. The following error during a 30 mm/s move should be constant in steady state and below 0.1 mm.
  • Position repeatability: Run 100 identical moves and record the final position. Standard deviation should be below 0.02 mm (one pulse at 1.875 mm resolution is 1.875 mm; multiple lost pulses will be visible as a multi-modal distribution).
  • Long-term thermal check: Monitor the 2LD545 driver and the MeanWell PSU for thermal drift over a 1-hour continuous-run test. Supply voltage sag at elevated temperature can re-introduce the underdrive condition.

11. Troubleshooting Matrix

Symptom Likely Cause Fix
Missed steps at high speed only PTO frequency too high for optocoupler / S7-1200 output stage Reduce max velocity, increase current-limiting resistor to reduce edge rate, or use lower microstep
Missed steps at all speeds, 3/10 rate Optocoupler under-driven at 24 V with 2.2 kΩ Replace 2.2 kΩ with 1.5 kΩ, verify common 0 V
Missed steps with double triggers at edges Over-current causing ringing / optocoupler saturation Increase resistor to 2.0 kΩ – 2.2 kΩ, add 100 Ω + 100 pF RC filter
Missed steps consistently at exactly one position Mechanical binding, leadscrew error, or limit switch bounce Inspect mechanics, check home switch, decouple motor from load
Missed steps only during accel/decel Ramp time too short, acceleration exceeds motor torque envelope Increase ramp-up time to 0.2 s – 0.5 s, reduce max acceleration
Axis reports ErrorID 16#8001 (configuration error) Pulse output not assigned to a PTO-capable output (e.g., Q0.4) Reassign axis to PTO1/PTO2 on Q0.0 or Q0.1
Axis reports ErrorID 16#800D (following error limit exceeded) Position lag exceeded the configured tolerance Increase following error tolerance, reduce velocity, or check mechanical load
Jitter or pulse skipping at scan-time boundaries PTO bound to a non-PTO output, CPU is software-emulating Reassign to PTO1–PTO4 on Q0.0–Q0.3

12. Preventive Engineering Notes for Future Builds

  • Default resistor value: For 24 V PLC outputs driving 5 V–24 V optocoupler inputs, start with a 1.5 kΩ resistor unless the driver datasheet specifies otherwise. This provides 12 mA to 15 mA and tolerates supply voltage variation down to 20 V.
  • Document the wiring change: The transition from a 5 V controller to a 24 V PLC almost always requires a resistor change. Note this on the schematic with both the original (5 V) and updated (24 V) values.
  • Add a diagnostic output: Wire a low-current LED indicator (2 mA) in parallel with the optocoupler input. The LED gives a visual confirmation of the pulse stream at commissioning and at any later service call.
  • Use differential wiring for cable runs over 5 m. The MotionKing 2LD545 supports differential PUL+/PUL− and DIR+/DIR−. Driving the negative side from a second PLC output (or the inverse from the same PTO) rejects common-mode noise from VFD and motor phase cables.
  • Verify PTO-capable outputs before commissioning. On S7-1200 CPUs, only Q0.0–Q0.3 (onboard) and Qa.0–Qa.3 (signal board) support PTO. Marking the PLC I/O assignment in TIA Portal before downloading will catch a misassignment at the design stage.
  • Test at the worst-case supply voltage. If the MeanWell PSU is undersized, the 24 V rail can droop to 22 V or below under motor acceleration. The optocoupler current will drop, and the failure reappears. Verify the PSU rating against the motor's peak current demand with a 1.5× derating factor.

Why does the S7-1200 PTO miss steps with a MotionKing 2LD545 when the same setup worked with an Arduino?

The Arduino outputs 5 V and the S7-1200 outputs 24 V. A 2.2 kΩ current-limiting resistor that produced adequate optocoupler forward current at 5 V is too large at 24 V, leaving the optocoupler under-driven at the edge of its specification. Use 1.5 kΩ to deliver 12–15 mA reliably.

What is the correct current-limiting resistor value for a 24 V PLC output driving a stepper driver optocoupler?

Calculate R = (VOH(min) − VF) / IF. With VOH(min) = 20.4 V (Siemens S7-1200 minimum) and VF = 1.4 V, R = 19 / 0.012 = 1583 Ω. A standard 1.5 kΩ, 0.25 W, 1 % metal film resistor is the recommended value.

Which S7-1200 outputs support PTO pulse generation?

On the S7-1214C DC/DC/DC, the onboard outputs Q0.0, Q0.1, Q0.2, and Q0.3 support PTO at up to 100 kHz each. Outputs Q0.4 and Q0.5 are standard 24 V digital outputs without hardware pulse-train support. A signal board (SB 1222) adds Qa.0–Qa.3 at 20 kHz. Verify the assignment in TIA Portal under CPU Properties > Pulse generators (PTO/PWM).

What ramp-up time should be configured for a Nema 34 stepper at 30 mm/s with 1.5 mm/rev lead?

A Nema 34 PK296DW with a moderate load typically requires 0.2 s to 0.5 s of ramp time to traverse the mid-band resonance region. Start with 0.2 s and increase to 0.3 s or 0.5 s if visible stutter appears. The user's 0.1 s ramp is too short for 30 mm/s at this motor size and load configuration.

How can I confirm the failure is electrical and not mechanical?

Run a 5 mm move at 5 mm/s and measure the actual position. If the error is exactly one or more 1.875 mm increments (800 pulses/rev × 1.5 mm/rev = 1.875 mm/pulse), the cause is lost pulses and is electrical. If the error is variable and below one pulse, the cause is mechanical (backlash, leadscrew error). Repeat the test 50 times; a consistent 1–2 mm error with a single-pulse signature confirms the electrical diagnosis.

Back to blog