2
\$\begingroup\$

I'm using a low pass filter and a Schmitt trigger buffer to filter the output of a rotary encoder. I have included the manufacturer's suggested circuit as well as my copy of it for sake of referencing components. My two questions are:

  1. When calculating the cut-off frequency of this circuit, must you combine the two resistances? I.e. \$\small 1/((R_1+R_3)\cdot C_2)\$ and \$\small 1/((R_2+R_4)\cdot C_1)\$ as opposed to \$\small 1/(R_3\cdot C_2)\$ and \$\small 1/(R_4\cdot C_1)\$.

  2. Is it even necessary to use two resistors? Could I get rid of \$\small R_3\$ and \$\small R_4\$? The current would still be limited into the switch when it closes, and it would still be a low-pass filter when the switch is opened, no?

Mfg suggested circuit

My circuit

\$\endgroup\$
5
  • 3
    \$\begingroup\$ The rising edge and falling edge time constants are going to be different. Falling it is 10k * 0.01u. Rising is 20k * 0.01 u. I don't think there is any simpler way to look at it. In other words, the falling edge time constant is 100 us, and the rising edge time constant is 200 us. \$\endgroup\$
    – user57037
    Aug 15, 2022 at 2:06
  • 3
    \$\begingroup\$ Without R3 and R4, the current would NOT be limited to the encoder when it is pulling down. It would be directly discharging the 0.01uF ceramic capacitors. Whether that is OK or not depends on the details of the encoder. Perhaps you could replace R3 and R4 with smaller resistors, like 100 Ohm or 1000 Ohm. Or maybe it is fine the way it is. 0.01 uF is a pretty small resistor and it is conceivable that the encoder can repeatedly discharge it over and over without damage. But I can't say for sure. It may fail prematurely if you do that. \$\endgroup\$
    – user57037
    Aug 15, 2022 at 2:13
  • \$\begingroup\$ Small typo: "0.01 uF is a pretty small resistor..." (*capacitor) \$\endgroup\$
    – Velvet
    Aug 15, 2022 at 7:12
  • \$\begingroup\$ I am integrating one of these right now. No guarantee that yours is the same, but FYI... Mine is quadrature encoded with mechanical wipers. The signals are labelled "CLK" and "DT". If the DT signal is low at the falling edge of the CLK signal, you are rotating CW. It has mechanical detents, and at the detents the signals are both high. With no caps, the most bounce that I have captured on a scope is 100 us (circuit specified by your vendor should work on mine). (cont)... \$\endgroup\$
    – Mattman944
    Aug 15, 2022 at 8:13
  • \$\begingroup\$ (cont) I am going to debounce in S/W. I believe that I have it working now, but it was more difficult than I expected. Debounce code written for a single switch won't necessarily work, the DT signal can change as soon as 2 ms after the CLK falling edge. So, you must find the edge (and sample the DT signal) within this time. Also, when there is a count detected, I am going to update an LCD (relatively slow process), I needed to be sure to resync my edge detector after the update. \$\endgroup\$
    – Mattman944
    Aug 15, 2022 at 8:20

1 Answer 1

4
\$\begingroup\$

You cannot analyze the circuit the same way when the switch (in the encoder) is open vs closed. It is really two different circuits. When the encoder is pulling down, then R1 (and R2) have no effect on the voltage. Assuming R1 = R2 = R3 = R4 = 10000 ohms, and C1 = C2 = 0.01 uF, in that case you have a cutoff frequency of 2 x pi / (10000 Ohms x 0.01 uF).

But when the encoder is NOT pulling down, then you have R1 and R3 in series, so the cutoff frequency is 2 x pi / (20000 Ohms x 0.01 uF).

If you get rid of R3 and R4, you will still have a low pass filter when the encoder output is open. However the frequency will be set by R1 and C1 only. In this case, the DC current the encoder sees will be limited by R1. But there will still be a poorly limited current as C1 is discharged by the encoder when it pulls down. This current will not be infinite because the capacitor has some effective series resistance and the encoder will have some series resistance too. So it might be OK to get rid of R3 and R4. But it is just possible that repeatedly discharging C1 directly, with no series resistance, will eventually cause the encoder to fail prematurely. To me it seems prudent to keep R3 and R4. But they probably don't need to be 10 k. They could be quite a bit smaller. The datasheet for the encoder may provide more guidelines or details on this topic.

Whatever value they are, though, the circuit will always have two time constants and two cutoff frequencies. Which cutoff frequency is operative will depend on the state of the encoder output.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.