AutomateDirectUSAMotion LibraryShop the parts catalog

How-to

Connecting a 5V Servo Encoder to 24V PLC Inputs

Sensors, encoders and machine vision on the machine Published 7 min read

Short answer

No interface can raise the PLC input's own frequency limit, so a 20 kHz optocoupler board does not make a slower high-speed input faster. Compute f = RPM × pulses per revolution ÷ 60 first; if it exceeds the input's documented maximum, use a faster counter input. If it fits, translate the 0-5 V signal through an optocoupler whose LED current, output topology and switching times all check out.

On this page
  1. The ceiling no converter removes
  2. Compute the pulse frequency at maximum speed
  3. Verify the optocoupler input current
  4. Match the output topology to the PLC input
  5. Check switching time against the pulse width
  6. Configure the counter and prove the chain
  7. The decision, case by case
  8. Questions asked

Yes, a 0-5 V encoder pulse output can drive 24 V PLC inputs — but only after two numbers clear: the pulse frequency at maximum speed against the PLC input's own documented limit, and the converter's electrical fit on both sides. A 20 kHz optocoupler board does not raise a slower high-speed input to its own rating; the lower of the two ratings sets the ceiling for the whole chain. So compute the frequency first, translate the level second. The checks below run in the order that wastes the least bench time, with the arithmetic shown for each.

The ceiling no converter removes #

The maximum count frequency belongs to the PLC input, not to whatever drives it. Ordinary 24 V DC inputs are built for pushbuttons and typically recognize only 10-100 Hz, which is useless for an encoder. High-speed inputs on compact fixed-I/O PLCs sit in the kilohertz class; the unit in this example is documented at 10 kHz, a figure you take from the high-speed I/O or electrical characteristics table of your own PLC. Counter modules reach far higher: Mitsubishi Electric documents its MELSEC iQ-R high-speed counter modules at up to 200 k pulse/s on DC inputs and 8 M pulse/s on differential inputs.

That number is a hard limit, and it decides the job before any wiring starts. If your computed pulse frequency exceeds the input's documented maximum, no level converter fixes it: use a counter input or module rated above your frequency, or lower the pulse rate at the drive's output. The electrical checks below only matter once the frequency fits.

Compute the pulse frequency at maximum speed #

Size the interface for the motor's maximum speed, not the speed you happen to bench-test at. For one channel:

f = RPM × pulses per revolution ÷ 60

Worked example, with the drive set to output 1024 pulses per revolution and a motor top speed of 3000 RPM:

f = 3000 × 1024 ÷ 60 = 3,072,000 ÷ 60 = 51,200 Hz = 51.2 kHz

That is a calculated example for those inputs, not a measurement, and it is already five times the input limit in this example. The decision for this case: the axis needs a counter input or module rated above 51.2 kHz, or a lower output rate from the drive. Scale the same axis to 250 pulses per revolution at 600 RPM and f = 600 × 250 ÷ 60 = 2,500 Hz, which fits under the input's limit with margin — then the converter checks decide the outcome.

If the drive outputs quadrature, channels A and B each run at f, and a counter evaluating four edges per cycle registers 4 × 51,200 = 204,800 counts per second in the example. Confirm the input's limit for the counting mode you actually configure, because the wire, the converter and the input must reproduce every edge the counter claims to evaluate.

Verify the optocoupler input current #

The 5 V output has to switch the coupler's LED, not just look like a level on a meter. Where the interface feeds the LED through a series resistor:

I_F = (V_high − V_F) ÷ R

with V_high the encoder's pulse high level (5 V), V_F the LED forward voltage from the coupler's datasheet, and R the series resistance from the board schematic. Calculated example for V_F = 1.2 V and R = 330 Ω:

I_F = (5 − 1.2) V ÷ 330 Ω = 3.8 ÷ 330 = 0.0115 A ≈ 11.5 mA

Three checks on that one number: it must exceed the coupler's guaranteed on-state current, it must stay below the encoder output's maximum source current from the drive manual, and the resistor dissipates I²R = 0.0115² × 330 ≈ 0.044 W, comfortably inside a 0.25 W part. If the board needs more LED current than a 5 V output can source, the board is wrong for this encoder — choose an interface specified for 5 V logic inputs.

Match the output topology to the PLC input #

The converter's output is an open-collector transistor, a push-pull driver or a relay contact, and a relay contact is ruled out at kilohertz rates immediately. An open-collector output does not generate 24 V — it only sinks current — so the 24 V supply, the PLC input terminal and the return path form one loop, and whether your input common is wired sinking or sourcing decides the connections. The sink-versus-source discipline is the same one behind wiring PNP proximity switches to optocoupler inputs; take the terminal detail from your PLC's wiring manual.

Wire with the machine powered down and locked out, and keep the 5 V and 24 V sides connected only through the coupler — tie the commons together and the isolation you chose the part for is gone.

Check switching time against the pulse width #

At the input limit of this example one full cycle lasts 100 µs — 50 µs per state at equal duty; at 20 kHz the cycle is 50 µs and each state 25 µs. Every microsecond of optocoupler turn-on delay, turn-off delay and PLC input filtering is subtracted from those states. Phototransistor couplers are asymmetric, with turn-off the long delay, and unequal edge delays distort the duty cycle until the input stops recognizing the short state — the channel's indicator can still blink while the pulses at the terminal are unusable.

Calculated example: a coupler documented at 25 µs turn-off under its test load leaves 25 µs of each 50 µs state at that rate before the PLC's own filter takes a share, and leaves nothing at 20 kHz. A converter sold as 20 kHz holds that rating only at its documented load, supply voltage and temperature, so compare those against your wiring and read the switching times of the exact coupler fitted. When the documented delays approach a quarter of the period, move to a coupler family documented for that frequency.

Configure the counter and prove the chain #

  1. Configure the PLC's hardware high-speed counter for the real signal format — single-phase, pulse-and-direction, or quadrature with its edge multiplier. Ordinary input instructions read once per scan will lose pulses even with a perfect waveform; the counting logic itself is covered in counting encoder pulses on a PLC without losing position.
  2. Scope both sides at maximum speed: encoder side and PLC terminal side, checking high and low levels, pulse width, duty cycle, edge delay and, for quadrature, the 90° spacing between channels.
  3. Run a count test: mark or command a whole number of motor revolutions, predict revolutions × pulses per revolution × edge multiplier, and compare the counter's value, in both directions.
  4. Read the hardware counter directly during the test. A number your logic latched once per scan proves nothing about the input, and pulses handed to remote I/O are not counted by a PC poll — that is why PC-polled remote I/O cannot count encoder pulses.
Symptom Cheapest checks first Confirming check
No counts at any speed Polarity, sink/source wiring, missing common, LED current below the coupler's guarantee, normal input used instead of the high-speed counter Scope shows the terminal swinging fully between 0 V and 24 V
Correct at low speed, error grows with speed Turn-off delay against pulse width, input filter setting, duty distortion Scope at maximum speed and watch the short state shrink
Constant proportional error, such as exactly 4x Quadrature or edge-mode mismatch, drive output scaling Recompute expected counts with the actual multiplier
One channel dead That channel's LED current and wiring Scope the encoder side of that channel alone

The decision, case by case #

  • Computed frequency above the input's documented maximum — 51.2 kHz against the input limit in this example: stop. Use a counter input or module rated above your edge rate, or cut the pulse rate at the drive output. A faster converter changes nothing.
  • Computed frequency below the limit with margin — 2.5 kHz in this example: the optocoupler interface works once LED current, output topology and switching time pass the checks above.
  • No counts at any speed: wiring, polarity, common or LED current. Fix that before suspecting speed.
  • Counts correct at low speed and drifting as speed rises: timing margin. Scope at maximum speed; if the short state collapses, change the coupler or lower the frequency.

Questions asked

Can a 20 kHz optocoupler board overcome a slower PLC input limit?

No. The converter translates voltage levels; it does not change how fast the input can recognize edges. The ceiling is the lower of the converter's rating and the input's documented maximum, and the converter's own rating only holds at its documented load and supply conditions. Above the input's limit you need a faster counter input, not a faster converter.

Can I use a transistor level shifter instead of an optocoupler?

Yes, when you do not need isolation. A small switching transistor driving the same 24 V input loop translates 5 V to 24 V, and a logic transistor's documented switching times are typically far shorter than a phototransistor coupler's. You lose galvanic separation between drive and PLC, so only take this path when both sides share a common reference and the drive manual permits it.

How much frequency margin should I leave below the input's maximum?

A common rule of thumb is to run at or below half the documented maximum. The margin absorbs coupler turn-off delay, PLC input filtering and any duty distortion that shortens one state. At half the limit the shortest state is still several times the delays you are carrying, which is exactly the condition the scope check confirms.

Do both quadrature channels need the same converter treatment?

Yes. Each channel needs the full current, topology and timing check, and both channels should use identical converters so their delays match. Quadrature decoding depends on the 90° spacing: at 51.2 kHz a quarter cycle is 1 ÷ 51,200 ÷ 4, about 4.9 µs, so a few microseconds of channel-to-channel delay difference can consume the phase relationship the counter decodes.

Keep reading

  • How-to

    Counting Encoder Pulses on a PLC Without Losing Position

    Count encoder pulses with a hardware high-speed counter input wired for quadrature, never with a count instruction in the scan. At 214 rpm and 75 pulses per revolution the encoder delivers 267.5 pulses per second, one every 3.7 ms, while a 10 ms scan cannot guarantee seeing even one in three. Zero the counter at a reference switch and treat every target as counts from that switch.

    Sensors, encoders and machine vision on the machine

  • How-to

    Sizing a Spindle Encoder Input for Servo Feed Control

    A 2000 PPR quadrature encoder on a 250 RPM spindle produces 33,333 counts/s, which fits a 50 kHz counter but overruns a 10 kHz variant; the most resolution that counter family allows is 3000 PPR. Scale feed per revolution to motor RPM through screw lead and gear ratio, then keep command pulses per revolution low enough that rapid speed stays under the 100 kHz pulse-output ceiling.

    Sensors, encoders and machine vision on the machine

  • How-to

    Measuring RPM With a Proximity Switch on a Pulley

    One bolt pass per revolution at 6,000 RPM is a 100 Hz signal any standard inductive proximity switch can produce and a scanned PLC input cannot reliably count, so route it to a high-speed input and verify the ON pulse clears the input's documented minimum — 100 µs on the DL05's X0–X2 inputs — with a scope at full speed.

    Sensors, encoders and machine vision on the machine