I'm only using the Rotary part of the encoder (without the push button switch) for 3 of them. The one connected in the schem does use the push button switch. The other 3 are remote (on a separate pcb). Thank you.Are the switches remote or close to the Teensy? If close the internal pullups will be enough, else add external pullups. Capacitors wouldn't help I don't think.
Yes, that's what I'm trying. Thank you. (I'll find out how it works tomorrow)If encoder is "mechanical", a small R-C filter helps remove the possible oscillations due to bouncing contacts.
The classic implementation is a pull-up on the contact side, followed by a R-C.
A good explanation I just found: https://www.dream-dimensions.de/2015/10/using-rotary-encoders/
What built-in filtering are you referring to?I've personally never had to worry about bounce on the T4 when using the hardware decoders, they have built-in filtering
What built-in filtering are you referring to?
Thank you.
You forget that a slow moving signal to a logic input may make dozens or hundreds of transitions anyway due to the high gain of an input buffer - the simplest way to handle the bouncing is poll the signals at a sensible rate like 1kHz - then high speed noise is ignored. You can use RC filter and then a proper hysteresis input gate to clean it up again, but its overkill really.If encoder is "mechanical", a small R-C filter helps remove the possible oscillations due to bouncing contacts.
The classic implementation is a pull-up on the contact side, followed by a R-C.
A good explanation I just found: https://www.dream-dimensions.de/2015/10/using-rotary-encoders/
Also using an RC filter places the input voltage in the forbidden region for significant periods which can drain a lot of power on a low power CMOS system. Though the T4 isn't very low power of course.You forget that a slow moving signal to a logic input may make dozens or hundreds of transitions anyway due to the high gain of an input buffer - the simplest way to handle the bouncing is poll the signals at a sensible rate like 1kHz - then high speed noise is ignored. You can use RC filter and then a proper hysteresis input gate to clean it up again, but its overkill really.
Thank you. It is mechanical, so I will be trying 10k pullups and 0.1uF caps. Using the implementation described here: https://www.build-electronic-circuits.com/arduino-rotary-encoder/If encoder is "mechanical", a small R-C filter helps remove the possible oscillations due to bouncing contacts.
The classic implementation is a pull-up on the contact side, followed by a R-C.
A good explanation I just found: https://www.dream-dimensions.de/2015/10/using-rotary-encoders/
Do you mean the P-Channel chip with the resistor and caps in my power input circuit? Thank you.More info on why its bad to slug CMOS inputs with an RC filter:
https://www.ti.com/lit/wp/slla364a/slla364a.pdf
Thank you for this info, I appreciate it very much.There are 3 separate cases:
1. You do NOT need any caps, if you are using hardware quadrature encoder inside NXP i.MX RT1062, as hardware does de-glitching for you. (RT1062 manual chapter 56)
2. You also do NOT need any caps, if you are using software debouncing in your code (by essentially implementing the same technique as hardware glitch filter - sampling multiple times and waiting for inputs to stabilise before detecting the edge)
3. You can use caps to form RC filter on input, if and only if your inputs are Schmitt trigger inputs, so they have hysteresis. NXP i.MX RT1062 has ability to configure its inputs as Schmitt triggers via PAD registers and HYS bit (see the NXP i.MX RT1062 manual Chapter: 12.4.2 GPIO pad structure, 12.4.2.1.1 Schmitt trigger ) or you could use external part like 74HC14
Inside Teensyduino code, in digital.c (https://github.com/PaulStoffregen/c...d8f615497eca2ee49/teensy4/digital.c#L162-L188 ) HYS bit is NOT set for INPUT mode, it is only set for INPUT_PULLUP and INPUT_PULLDOWN.
I'm using the Encoder library, would that automatically set the HYS bit? (Does the library put every encoder pin into INPUT_PULLUP, hysteresis included?)3. You can use caps to form RC filter on input, if and only if your inputs are Schmitt trigger inputs, so they have hysteresis. NXP i.MX RT1062 has ability to configure its inputs as Schmitt triggers via PAD registers and HYS bit (see the NXP i.MX RT1062 manual Chapter: 12.4.2 GPIO pad structure, 12.4.2.1.1 Schmitt trigger ) or you could use external part like 74HC14
Ok great. I am using INPUT_PULLUP. I appreciate your help on this, thank you.See the source:
if INPUT_PULLUP is defined it uses it.
You can also just call pinMode with INPUT_PULLUP yourself.