As added FYI. The T4 HW Quad Encoder does have a glitch filter that gives you some leeway for false signals. For more info on the Quad encoder you can check chapter 55 of the IMXRT1062 Reference Manual. A couple of examples in the lib give examples of using the filter settings:
Code:
/* Filter for PHASEA, PHASEB, INDEX and HOME. */
/* Input Filter Sample Count. This value should be chosen to reduce the probability of noisy samples causing an incorrect transition to be recognized. The value represent the number of consecutive samples that must agree prior to the input filter accepting an input transition. A value of 0x0 represents 3 samples. A value of 0x7 represents 10 samples. The Available range is 0 - 7. */
uint16_t filterCount;
/* Input Filter Sample Period. This value should be set such that the sampling period is larger than the period of the expected noise. This value represents the sampling period (in IPBus clock cycles) of the decoder input signals. The available range is 0 - 255. */
uint16_t filterSamplePeriod;
However, with that said if you really have runaway counts you will probably have to do what was suggested in post #2. I have used several encoders on robots including ones built into the motors themselves without an issue. I did see a couple places of using capacitors across the motor terminal terminals:
Code:
You should always put a capacitor across the motor terminals even if your circuit is not affected, because brush arcing creates rf noise that can interfere with other equipment (eg. AM radios). The usual recommendation is to install two 0.1uF ceramic capacitors, one connected from each motor terminal to the case. This 'grounds' the case to rf without the danger of having an exposed DC connection.
ref: https://electronics.stackexchange.co...dc-motor-noise. This is usually for 12v type electric motors.