🚧 Under construction — VoTechWorks is being built. A free tech program — complimentary, as our commitment to get America working.
voTechWorksGrade 13 · a vocational technology learning center, by urbanicity
newSchoolWorks.com › VoTechWorks › Manufacturing & Marine › Robotics / Mechatronics › Industrial Sensors and Signal Conditioning for Mechatronics › Lesson 8
MFG-MECH15-04 · Lesson 8 · 14.5 clock hours · lab

Encoders and Position Sensors

Objective. Students wire incremental and absolute encoders to a PLC high-speed counter module, configure the counter, and calculate position and velocity from pulse data.

⚠ Pending professional review

This lesson, its worked examples and its practice questions has not yet been verified by a licensed engineer or certified journey-level tradesperson or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.

VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.

Encoders and Position Sensors

Why Position Feedback Matters

Automated machines must know where moving parts are at every moment. A conveyor, robotic arm, or lead-screw axis that loses position can crash tooling, damage product, or injure workers. Encoders convert mechanical motion into electrical pulses or digital words that a PLC or motion controller can read, count, and act on in real time.

Safety First

Before wiring or handling any encoder or motor shaft, apply OSHA 29 CFR 1910.147 lockout/tagout (LOTO). De-energize the motor drive, verify absence of voltage with a calibrated multimeter, and apply personal lock and tag before making or breaking any connection. Rotating shafts are a mechanical hazard — keep hands, hair, and loose clothing clear even during jog moves. Wear appropriate PPE (safety glasses minimum). Electrical connections at low voltage (5 V, 12 V, 24 V DC) still present short-circuit risk; handle wiring with power removed unless the specific step explicitly requires live observation of signals. Follow NFPA 70E principles: treat any exposed conductor as energized until verified otherwise.

Incremental Encoders

An incremental encoder generates a stream of pulses as its shaft rotates. The most common type uses a slotted disk (code wheel) and photodetectors to produce two square-wave output channels, labeled A and B, offset from each other by 90 electrical degrees — this is called quadrature encoding. A third channel, Z (index), produces one pulse per full revolution and is used to establish a reference home position.

Direction sensing from quadrature: When the shaft turns clockwise, channel A leads channel B (A rises before B). Counter-clockwise rotation reverses the relationship — B leads A. The PLC high-speed counter (HSC) module monitors which channel leads to determine direction and counts accordingly (up for one direction, down for the other).

Resolution is specified in lines per revolution (LPR) or pulses per revolution (PPR). A quadrature decoder counts all four edges of each A/B cycle, so the effective count per revolution is 4 × LPR. For example, a 500-LPR encoder yields 2,000 counts per revolution in quadrature mode (often called ×4 decoding).

Critical limitation: Incremental encoders have no memory of position. If power is lost or the counter overflows, position is lost and the machine must re-home before resuming automatic operation.

Absolute Encoders

An absolute encoder outputs a unique digital code for every shaft position. Even after a power loss, the correct position is available the instant power returns — no homing cycle required. This is essential on axes where re-homing is dangerous or time-consuming (large CNC machines, robotic joints, overhead cranes).

The SSI (Synchronous Serial Interface) protocol is a common absolute encoder interface. The controller sends a clock signal; the encoder shifts its position word out one bit at a time, MSB first, synchronized to that clock. Resolution is expressed in bits: a 13-bit encoder has 2¹³ = 8,192 distinct positions per revolution; a 25-bit multi-turn encoder can track both position and turn count.

High-Speed Counter (HSC) Modules

Standard PLC discrete input modules cannot keep up with fast encoder pulses — they are scanned once per program cycle (typically 1–20 ms), which is far too slow for a 1,000-LPR encoder spinning at 3,000 RPM (50,000 pulses per second). An HSC module contains dedicated hardware counters that latch every edge independently of the PLC scan. You configure the HSC for:

Linear Position from a Lead Screw

If an encoder is coupled to a lead screw, rotary encoder counts convert directly to linear distance using the lead of the screw (distance traveled per one revolution).

> Linear position = (Encoder counts / Counts per revolution) × Lead

For example: 500-LPR encoder, ×4 decoding = 2,000 counts/rev; lead = 5 mm/rev. Reading 6,000 counts means the carriage moved (6,000 / 2,000) × 5 mm = 15 mm.

Velocity Calculation

Shaft speed (RPM) can be calculated from time-stamped HSC reads:

> RPM = (ΔCounts / Counts per revolution) × (60 / Δt)

where Δt is the elapsed time in seconds between two HSC reads and ΔCounts is the change in count over that interval.

Wiring Notes

Incremental encoders typically use 5 V or 24 V DC supply, differential (RS-422) or single-ended (push-pull/NPN/PNP) outputs. Match the HSC input type to the encoder output type. Keep encoder cables shielded, route away from power wiring, and ground the shield at one end only to prevent ground loops. Check the encoder datasheet for maximum cable length and pull-up resistor requirements.

Key terms8

Incremental encoderA rotary sensor that generates a pulse for each unit of angular motion; it has no absolute position memory and requires a counter and a home reference to determine position.
Quadrature encodingA two-channel (A and B) output scheme where the channels are 90° out of phase; the phase relationship reveals direction of rotation and allows ×4 edge counting.
Lines per revolution (LPR)The number of complete pulse cycles an incremental encoder produces for one full shaft revolution; effective counts per revolution equals 4 × LPR in quadrature mode.
Absolute encoderA position sensor that outputs a unique digital code for every shaft angle; position is retained without power and no homing cycle is needed after a restart.
SSI (Synchronous Serial Interface)A clock-based serial protocol used by many absolute encoders; the controller pulses a clock line and the encoder shifts its position word out one bit per clock cycle.
High-speed counter (HSC) moduleA PLC module with dedicated hardware counters that capture encoder pulses independently of the PLC scan cycle, enabling accurate counting at high pulse rates.
Lead (lead screw)The linear distance a nut or carriage travels for each complete revolution of the lead screw; used with encoder counts to calculate linear position.
Index pulse (Z channel)A once-per-revolution reference pulse from an incremental encoder used to establish or verify the home position of an axis.

Worked examples4

1. An incremental encoder rated at 1,000 LPR is connected to a PLC HSC module configured for ×4 quadrature decoding. The operator jogs the motor shaft through exactly 3.5 revolutions. How many counts should the HSC register?
  1. Step 1 — Counts per revolution in ×4 mode: 4 × 1,000 LPR = 4,000 counts/rev.
  2. Step 2 — Total counts for 3.5 revolutions: 3.5 rev × 4,000 counts/rev = 14,000 counts.
Answer: The HSC should register 14,000 counts.
2. The same 1,000-LPR encoder (×4 decoding, 4,000 counts/rev) drives a lead screw with a pitch of 8 mm per revolution. The HSC reads 22,000 counts from the home position. What is the linear carriage position in millimeters?
  1. Step 1 — Convert counts to revolutions: 22,000 counts ÷ 4,000 counts/rev = 5.5 revolutions.
  2. Step 2 — Convert revolutions to linear distance: 5.5 rev × 8 mm/rev = 44 mm.
Answer: The carriage is 44 mm from the home position.
3. A student reads the HSC at time T1 and again at T2 = T1 + 0.5 seconds. The count changed from 8,000 to 14,000. The encoder is 500 LPR with ×4 decoding (2,000 counts/rev). What is the shaft speed in RPM?
  1. Step 1 — Find ΔCounts: 14,000 − 8,000 = 6,000 counts.
  2. Step 2 — Convert ΔCounts to revolutions: 6,000 ÷ 2,000 counts/rev = 3.0 revolutions.
  3. Step 3 — Convert to RPM: (3.0 rev / 0.5 s) × 60 s/min = 360 RPM.
Answer: The shaft is rotating at 360 RPM.
4. A tachometer reads 355 RPM on the same shaft. The student calculated 360 RPM from encoder data. What is the percentage error, and does it fall within the ±5% lab acceptance criterion?
  1. Step 1 — Find the absolute difference: |360 − 355| = 5 RPM.
  2. Step 2 — Calculate percentage error relative to the tachometer reference: (5 ÷ 355) × 100 ≈ 1.4%.
  3. Step 3 — Compare to criterion: 1.4% is less than 5%, so the result is acceptable.
Answer: Percentage error ≈ 1.4%; the result passes the ±5% acceptance criterion.

The math in this lesson2

Learners convert encoder counts to revolutions, lead-screw travel in mm, and shaft RPM from count rates.
6.RP.37.RP.3
Brush up in the math halls at newSchoolWorks.com:
In class: Incremental encoder lab: students wire a quadrature incremental encoder to a PLC HSC input, jog a small servo or stepper motor shaft a known number of revolutions, and verify pulse count against the encoder's lines-per-revolution specification; calculate linear position given a known lead-screw pitch. · Absolute encoder comparison: instructor demonstrates an SSI absolute encoder output; students read the position value through a PLC display at five shaft positions and confirm no position loss after a power cycle. · Velocity calculation exercise: students use the PLC's time-stamped pulse counts to calculate shaft RPM and compare to a tachometer reading; document the calculation method and error percentage.
Materials: Incremental quadrature encoder, absolute SSI encoder, PLC HSC module, small servo or stepper motor with shaft, lead-screw demo fixture, tachometer, multimeter, oscilloscope (optional), lab worksheet.
Check: Pulse count verified by instructor within ±1 count of theoretical; velocity calculation within ±5% of tachometer; student can explain quadrature direction sensing verbally.

Practice check8

Answer each question, then check it. Nothing is recorded; this is your own practice.

Siemens SMSCP L1 — Digital Fundamentals and PLCs / PMMI Programmable Logic Controllers
1. A 1,200-LPR incremental encoder is used with ×4 quadrature decoding. How many counts does the HSC register for exactly two full shaft revolutions?
Siemens SMSCP L1 — Digital Fundamentals and PLCs / PMMI Programmable Logic Controllers
2. What is the primary advantage of an absolute encoder over an incremental encoder when the machine loses power unexpectedly?
PMMI Programmable Logic Controllers / Siemens SMSCP L1 — Digital Fundamentals
3. In a quadrature encoder, how does the PLC determine the direction of shaft rotation?
PMMI Programmable Logic Controllers
4. Why must a standard PLC discrete input module NOT be used to count pulses from a 1,000-LPR encoder spinning at 2,000 RPM?
PMMI Mechanical Components / Siemens SMSCP L1 — Mechanical Components
5. A lead screw has a pitch of 5 mm per revolution. An encoder with 500 LPR and ×4 decoding is coupled to the screw. The HSC reads 10,000 counts. What is the carriage's linear position from home?
FANUC CERT safety / Siemens SMSCP L1 safety / PMMI all domains
6. Before wiring an encoder to a running motor shaft assembly, which OSHA standard requires you to de-energize the equipment, lock it out, and verify zero energy?
PMMI Programmable Logic Controllers / Motor and Motor Controls
7. A student samples the HSC at two points 1.0 second apart and records counts of 5,000 and 11,000 on a 500-LPR encoder with ×4 decoding. What is the calculated shaft speed in RPM?
Siemens SMSCP L1 — Digital Fundamentals and PLCs / PMMI Programmable Logic Controllers
8. Which SSI encoder characteristic most directly distinguishes it from an incremental encoder output on the PLC input wiring?
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.