PLC Simulator
All 151 components

sensors · rotary model

Rotary encoder

A PLC rotary encoder converts shaft rotation into electrical pulses. An incremental quadrature encoder provides channels A and B ninety electrical degrees apart, letting a high-speed counter determine direction as well as movement. The program turns accumulated counts into position, speed or travelled distance using pulses per revolution, mechanical ratio and a defined reference point.

2 I/O points1 snap portsPLC-driven state

Start with the public scenario; create a free account when you want to save progress.

Isolated component viewPROP_RotaryEncoder_ROOT

Explore Rotary encoder in 3D

Load the interactive model when you are ready to rotate, inspect and operate it. Deferring WebGL keeps the reference page fast.

Motion and state

Its rotary state can be driven from a PLC output so speed and direction remain visible during a scan.

PLC control pattern

Commission it by proving active feedback before accepting enable.

Fault practice

Inject stuck-on, stuck-off, misaligned states and require the PLC sequence to detect, stop and recover deliberately.

PLC integration guide

How to use a rotary encoder with a PLC

Use the high-speed counter path

Encoder pulses can change faster than the normal PLC scan can sample. Wire the channels to inputs and instructions specifically rated for the required frequency, then configure the counter mode for A/B quadrature and the desired multiplication. A normal contact instruction may miss edges even though it appears to work at hand-turned speed. Shielding, grounding and differential signalling matter as cable length and electrical noise increase.

Convert counts into engineering units explicitly

Document the encoder resolution, whether the counter uses one, two or four edges per cycle, gearbox ratio, wheel circumference and sign convention. Position is accumulated counts divided by counts per engineering unit. Speed is count change over a stable sample interval. Avoid burying these constants across rungs; keep them together and expose raw count, scaled value and status for diagnosis.

Plan reference, rollover and loss detection

An incremental encoder does not inherently know absolute position after power loss. Use a home sensor, index pulse or retained position strategy that matches the machine. Handle counter rollover and reverse motion mathematically. When motion is commanded, compare the expected count change with a timeout or following-error band so a broken coupling, damaged cable or stalled shaft becomes a meaningful fault.

Learn the physical principle first

The reference above focuses on PLC integration. The interactive school lesson shows the device, signal or mechanism before you write the control sequence.

Open the quadrature encoder signal lab

Signal map

I/O you can reason about

PLC output Enable; PLC input Active feedback

SignalPLC directionType / range
Enable
enable
outputbool
Active feedback
active
inputbool

Field checklist

Commissioning sequence

  1. 01Confirm output electrical type, supply, pulses per revolution, maximum frequency and PLC high-speed-input compatibility.
  2. 02Turn the shaft slowly in the positive direction and verify A/B direction and count sign.
  3. 03Rotate one known revolution and compare the count change with the configured edge multiplier.
  4. 04Scale counts into the real distance or angle, then validate across several known positions.
  5. 05Disconnect one channel and simulate stalled feedback to prove channel and no-motion diagnostics.

Fault finding

Symptoms and first checks

SymptomCheck
Count direction is reversedSwap A and B only if permitted by the wiring design, or change the configured direction convention consistently.
Counts are missed at speedCheck input frequency rating, filter time, high-speed-counter configuration, cable shielding and signal level.
Position is correct near zero but drifts with travelVerify pulses per revolution, edge multiplier, gearing, circumference and mechanical slip.

Fault and recovery exercise

Make abnormal states part of the sequence

Inject stuck-on, stuck-off, misaligned states and require the PLC sequence to detect, stop and recover deliberately.

stuck-onstuck-offmisaligned

Engineering boundary

The model teaches PLC sequence behaviour and diagnosis. Confirm ratings, wiring, guarding, process calculations and commissioning limits against the real manufacturer documentation and site design.

Plain-English answers

Rotary encoder FAQ

Why are encoder channels A and B offset?

Their phase relationship reveals direction. The sequence of A and B edges changes when the shaft reverses.

What does encoder PPR mean?

Pulses per revolution describes the base signal cycles. A quadrature counter may count multiple edges per cycle, so configured counts per revolution can be higher than the stated PPR.

Does an incremental encoder retain position?

The encoder provides relative movement. Absolute machine position normally requires homing, an index strategy, retained state with validation, or an absolute encoder.

Free first success

Put the rotary encoder into a working control sequence

Open a related browser scenario, run the PLC logic and see the component state respond. Start without installing software or entering a card.

No installNo credit cardImmediate pass/fail feedback