AutomateDirectUSAMotion LibraryIndustrial monitors & PCs

Explainer

Adding an Encoder to a Mini Servo: Measure the Joint Output

Sensors, encoders and machine vision on the machine Published 7 min read By AutomateDirectUSA engineering team

Short answer

An optical disk encoder can be fitted to a mini RC-style servo when the output shaft or hub has room for the disk and the housing can carry a stationary reader. Put it at the joint output, not the motor shaft, use two phase-shifted channels plus a reference, and leave the servo's internal sensor running its own loop.

On this page
  1. Where the encoder goes and what it measures
  2. Why one pulse channel is not enough
  3. Resolution arithmetic for a disk you can make
  4. Mechanical checks before you cut the case
  5. The control loop question
  6. Decision
  7. Questions asked

Yes, you can mount an encoder on a mini servo. The practical way is a slotted optical disk on the servo's output shaft, read by a slotted optocoupler fixed to the housing or the arm structure. What decides whether the measurement is useful is where you put it: a disk on the motor shaft, before the reduction gears, counts motor motion and cannot see gear backlash or any slip downstream of the gears. For a teach-mode robot arm you want the joint angle, so the encoder belongs at the joint output. The servo's internal sensor stays inside its own control loop and is not involved.

Where the encoder goes and what it measures #

An RC-style positional servo is a motor, a reduction gear train, an internal position sensor (usually a potentiometer) and control electronics in one case. The command on its input asks for a position; the internal loop drives the motor until the internal sensor matches. That sensor is normally not brought out to the connector, which is why an external measurement has to be added.

There are three places feedback can come from, and they answer different questions:

Approach What it measures Deciding constraint What the controller gets
Optical disk on the servo output shaft Output rotation relative to the servo housing Axial room on the output shaft or hub for the disk, radial room for the reader True joint angle, independent of the internal loop
Optical disk on the motor shaft Motor rotation before the gears Access inside the case, before the gear train Motor motion times an assumed gear ratio, blind to backlash
Encoder on the arm joint itself Joint rotation relative to the arm structure Space and a coupling at the joint; must not add side load to the servo output Includes the servo horn or linkage compliance between servo and link

For a teaching arm, choose the first or the third. The first is the least work; the third is worth it when the servo drives the link through a linkage with measurable play.

Why one pulse channel is not enough #

A single channel of pulses from one reader tells the controller how far the joint moved but not which way. That breaks down exactly where a teach arm lives: during teaching, the operator moves the joint by hand in either direction, with no commanded direction to compare against.

The fix is quadrature: two readers on the same disk, offset so their channels are phase-shifted by a quarter of one slot pitch. The controller decodes direction from the sequence of transitions between the two channels, and it also gets four decoded counts per slot instead of one. Both the direction information and the multiplied resolution come from the decoding, not from extra slots.

Incremental counts still need a zero. Add one wider or separate slot on the disk and a third reader for an index pulse, or home each joint against a mechanical stop or reference sensor at startup. After any power loss the controller must find that reference again before counts mean angle. An absolute sensor avoids the homing move; a home-built disk does not give you that.

Resolution arithmetic for a disk you can make #

Published hobby retrofits get around 45 pulses per revolution from a hand-made disk; that is a realistic target for a disk printed or cut for a mini servo, where the usable disk diameter is small.

Worked example. Take a 45-slot disk and two phase-shifted channels:

  • Slots on the disk: 45
  • Decoded counts per revolution, C = 4 × 45 = 180 counts/rev (quadrature decoding)
  • Nominal angular increment = 360° / C = 360° / 180 = 2° per count

That increment is granularity, not accuracy. Disk eccentricity, reader alignment, gear backlash between the disk and the arm link, and arm deflection under load are separate errors on top of it. For a first teach-mode arm that replays poses, 2° is workable; if you need finer, more slots need a larger disk and a smaller optical gap between disk and reader, which a mini servo's output shaft rarely has room for.

Count rate is the other limit. With C decoded counts per revolution and joint speed n in revolutions per second, the decoded count rate is C × n. At the same 180 counts/rev and a fast teach move of 0.5 rev/s: 180 × 0.5 = 90 counts/s. That is trivial for any counter input, but do not feed it to ordinary scanned PLC inputs, which can miss short pulses; use a hardware counter. If you later quadruple the slots, the rate quadruples with them.

Mechanical checks before you cut the case #

The retrofit fits only if the output side of the servo gives you three things. Measure them on the actual servo, not on a drawing:

  • Shaft or hub room: the output shaft or spline needs enough free axial length to carry the disk with the reader clearing the housing. A disk glued to the servo horn instead of the shaft also works, and it measures after the horn's own meshing.
  • Radial clearance: the reader and its bracket must clear the case, the arm link and the cable throughout the full travel, with a few tenths of a millimetre of optical gap between disk and reader held stable by a bracket fixed to the housing or the structure, never hanging on its wires.
  • No side load: the disk runs concentric on the rotating part; the reader never touches it. A rubbing reader loads the output bearing and shows up as servo chatter.

For transmissive readers, emitter and receiver sit on opposite sides of the disk; for reflective readers, the sensor faces the patterned face. Follow the reader's datasheet for its sensing gap and slot width, and make the slot width at least as wide as the sensor aperture. One more design choice belongs here: if the servo's own motion specs are marginal and you are fabricating an encoder mount anyway, compare that work against fitting the joint with flexible shaft couplings to a separate encoder on a supported shaft, which removes the disk alignment problem from the servo output.

The control loop question #

An external encoder reports what the joint actually did to your robot controller. It does not become the feedback the servo's internal loop uses; replacing that loop's sensor means rewiring the servo's electronics and redesigning its controller, which a fitted disk alone does not do. For teaching, that separation is exactly what you want: the servo holds a commanded position while your controller records measured angles.

Two practical consequences for teach mode:

  • Commanded position and measured position are different numbers; always store the measured one.
  • A powered positional servo resists being pushed. Teach with the servo unpowered or with its output mechanically disengaged; forcing a holding servo through its travel can strip the gears or the disk mount.

How your controller consumes the two channels and the index depends on its counter hardware and decoding configuration; the quadrature interface details in the quadrature encoder interfacing guide cover the signal conditioning and counting side. On the drive side, the same channel naming and level questions come up when you match encoder signal names between motor and servo drive; the resolution you settle on decides what the robot can later resolve, the trade covered in robot joint encoder resolution.

Decision #

  • Mini RC-style servo, room on the output shaft or horn, teach-mode arm: fit a transmissive disk with about 45 slots, two readers in quadrature and one index slot; expect a 2° increment and home each joint at startup.
  • No room on the output, linkage-driven joint: put the encoder on the joint itself, with its own bearings, coupled to the link; do not side-load the servo.
  • Need position at power-up without a homing move: an incremental disk cannot give it; use an absolute encoder or a smart bus servo that reports position, which is a different actuator choice, not a retrofit.
  • Disk only fits on the motor shaft: it will not measure the joint; expect the gear backlash to sit between your measurement and the arm, and use it only for velocity, not position.

Questions asked

Can I read the servo's internal potentiometer instead of adding a disk?

Electrically you often can, by tapping the internal position sensor's signal, but you are then reading a component the maker did not route to the connector, with no documented output level or linearity. It works for bench experiments; for an arm you will reuse, an external encoder at the joint output gives you a documented, replaceable measurement.

What angular resolution does a 45-slot disk actually give?

With quadrature decoding, a 45-slot disk with two channels gives 180 decoded counts per revolution, so the nominal increment is 360° / 180 = 2°. That is coarse for precise positioning but fine for a teach-mode arm that replays positions to a few degrees.

Do I need the reference pulse if I never move the arm while powered off?

Yes, keep it. A supply dip, a connector knock or a controller reset wipes incremental counts, and without a reference the controller cannot recover the angle without guessing. A single slot and a third reader cost almost nothing compared with re-teaching every joint.

Will the added disk slow or load the servo?

A thin plastic disk with a slot optocoupler adds negligible friction and inertia compared with the servo's own output gear train, so the position loop will not notice it. What does load the output is a poorly aligned reader bracket that rubs the disk; check for contact through the full travel before closing the case.

Keep reading

  • How-to

    How to Identify Geared Resolver and Encoder Feedback on Old Servos

    Treat the resolver plus its geared 1:4 and 1:80 channels as one integrated coarse-and-fine, multi-turn position package: the resolver reads absolute angle within one shaft revolution, and the geared channels count revolutions above it. Identify each channel by resistance checks, ratio counting and waveform capture before choosing a replacement drive, because the resolver model number alone establishes neither commutation nor multi-turn position recovery.

    Sensors, encoders and machine vision on the machine

  • Comparison

    Absolute joint encoders for a stepper robot arm without homing

    Fit a single-turn magnetic absolute encoder to the output side of each joint, after the gearbox: it reads the joint angle the moment the arm powers up, so no homing move or switch is needed. A 14-bit part resolves about 0.022 degrees per count, roughly 0.12 millimetres at the tip of a 300 millimetre link.

    Sensors, encoders and machine vision on the machine

  • Selection guide

    Brushed DC Servo Robot Arm Retrofit: Keep or Convert to Steppers

    Keep the brushed DC servos and chain mechanics wherever they are serviceable: they are the measured proof of the torque and speed every joint needs. Replace damaged encoders matched by shaft size and line count, and run the motors from brushed-servo drives that accept step and direction commands. Convert a joint to steppers only after its measured load proves torque at speed on the candidate's own curve.

    Servo and stepper motion