Marcio Cunha

Incremental encoder freezing? How to filter noise on AB signals

Learn why incremental encoders lose steps on the factory floor and how to design hardware RC filters to eliminate phantom pulses effectively.

Marcio Cunha•4 min
Also available in:PortuguêsEspañol
Summary
  • Hardware RC filters combine resistors and capacitors to attenuate high-frequency surges before they reach the microcontroller.
  • Long unshielded cables act as antennas, capturing electromagnetic interference from neighboring frequency inverters and motors.
  • The filter time constant must be precisely calculated to block noise without distorting legitimate signal edges at high RPM.
  • Preventive maintenance in electrical panels includes verifying proper grounding of equipment chassis and signal cable shields.
  • Integrating software diagnostics complements physical protection, ensuring accurate counting even in severe industrial environments.

Why does your incremental encoder keep losing steps on the machine?

Anyone working in industrial automation has faced the frustration of watching a stepper or servo motor lose its home position for no apparent reason, even when everything looks mechanically sound. In the vast majority of cases, the silent culprit is electrical noise interfering with the signal cables of an incremental encoder. In practice, this device measures rotation and position by sending electrical pulses through two channels phase-shifted by ninety degrees, known as channels A and B. If a spark generated by a nearby relay or the heavy switching of a frequency inverter injects unwanted electricity into these wires, the system registers movements that never actually occurred.

To grasp the severity of the problem, imagine that each electrical pulse acts like a step the machine climbs or descends. When electromagnetic noise creates rapid and chaotic voltage spikes, the central controller thinks the shaft spun hundreds of turns in just a few microseconds. This erratic behavior causes the system to freeze due to counting errors, trigger safety alarms, or simply misalign the entire production process. Understanding the physical origin of this phenomenon is the first step toward shielding equipment against intermittent failures.

The hidden danger of long cables and frequency inverters

The factory floor is an electrically harsh environment, full of high-power motors operating under rapid PWM switching. When an encoder signal cable runs parallel to motor power cables for several meters, it turns into an antenna receiving electromagnetic interference. This phenomenon is known as capacitive and inductive coupling, where energy from the power cable jumps to the signal cable without any direct physical contact. It is the exact same principle that causes an AM radio to hiss when you pass near a high-voltage power line.

To mitigate part of this issue in the physical infrastructure, engineers use shielded cables with braided mesh, a technique similar to what we discussed when analyzing how to diagnose instabilities in computer networks. However, in complex installations, external shielding alone is sometimes not enough to eliminate so-called phantom pulses. When noise manages to bypass the cable barrier, it reaches the input pins of the PLC or microcontroller directly, demanding a direct intervention in the electronic circuit through analog filtering.

How to design a hardware RC filter in practice

The most robust and elegant solution to eliminate high-frequency noise before it corrupts digital logic is implementing a passive RC filter. This is a simple combination of a resistor connected in series with the signal line and a capacitor connected in parallel with ground. In practice, this pairing acts as a selective sieve: the abrupt and extremely rapid variations of noise find a clear path to ground through the capacitor, while the legitimate square wave of the encoder passes through the resistor with minimal attenuation.

The secret to success in designing this circuit lies in the correct calculation of the time constant, given by the formula tau equals R times C. If the capacitor is too large, it will round off the square wave edges so much that the microcontroller can no longer identify the exact moment the signal changed state, creating unacceptable delays at high speeds. If it is too small, noise will pass right through. Balancing the encoder's maximum operating frequency with the required attenuation is a bench design challenge just as critical as assessing damaged semiconductor components in power electronics.

Calculating components and testing the circuit on the oscilloscope

To build a functional RC filter for a medium-speed encoder signal, engineers typically use a resistor from one hundred and fifty ohms to one kiloohm in series, combined with a ceramic capacitor from ten to one hundred nanofarads between the input pin and common ground. Before soldering any permanent components onto a printed board, validation with a bench oscilloscope is mandatory. Connect the probe to the circuit input and observe the waveform of channel A while turning the motor shaft slowly by hand.

If you notice the wave is heavily distorted or flattened, gradually reduce the capacitor value until the transitions are clean and sharp. It is also worth remembering that freezing issues do not always originate from the sensor; sometimes, the power supply itself suffers severe voltage drops under load, a classic symptom akin to inexplicable hardware freezes diagnosed in embedded systems. Ensuring a clean and stable power supply is a basic requirement for any analog filter to perform its role effectively.

Conclusion and best practices for industrial environments

Eliminating freezes caused by noise in incremental encoders requires a multidisciplinary approach ranging from choosing the right shielded cables to fine-tuning hardware RC filters. By understanding how electromagnetic transients affect A and B pulses, the technician gains fast and assertive diagnostic capability, avoiding the unnecessary replacement of expensive industrial components. Combining robust physical protections, well-executed grounding, and proper analog filtering ensures operational reliability and puts an end to unplanned factory downtime.

In short, reliability engineering in automation lies in small design details that prevent invisible interference from sabotaging the system. Investing time in correctly modeling input circuits and organizing the electrical panel saves precious hours of troubleshooting in the future. With these guidelines applied, your motors and positioning systems will operate in a fully deterministic and phantom-pulse-free manner.