TransWikia.com

Does EC11 Incremental Encoder need hardware debouncing and VCC for encoder?

Electrical Engineering Asked on December 22, 2021

I’m implementing an EC11E rotary encoder which has 3 pins + 2 pins for a switch. It seems like most of the projects I’ve seen online wire A/B and GND to the microcontroller, which to me, makes sense.

However, at the same time, I’ve seen a few references to schematics which include debouncing capacitors and resistors like below.

enter image description here

However, I don’t understand why this is actually necessary. From what I understand, since the quadrature encoding effectively presents itself as a square wave, it shouldn’t need debouncing, given the contacts either touch or don’t touch.

Do I actually need these debouncing capacitors and resistors in my circuit?

As well, it seems like most breakout boards for encoders include a VCC line for pull-up. However, the MCU I’m using [AT90USB646] already includes internal pull-ups on all its GPIO pins. WIll I still need a pull up line then?

3 Answers

I have been currently using a EC11 rotary encoder, which I have assembled just like described in the datasheet with no debouncing methods, and it works just fine as stated in the datasheet. No matter how fast I would switch through states, they've never bounced and it works very well. You can check that on an oscilloscope, as you move it in the clockwise direction you'll see one of the pins switching from either 0 to 1 or 1 to 0 (depending on the initial state) in $approx 40,ms$ ahead of the other. When moving counterclockwise, you'll face the same event with the moving pin order reversed though.

Answered by Iron Maiden on December 22, 2021

Those rotary switches are nothing more than mechanical switches. And like all mechanical switches, these will have contact bounce. The contacts either touch, or don't, and they do that many times rapidly during the transition, and due to oxidation there always a state where the contacts have a bad connection so it can be indeterminate if the signal is high or low.

Some other rotary encoder manufacturers (Bourns) clearly state a default application circuit which includes pull-up resistor, a capacitor, and a series resistor, and also include default values for them.

The pull-up resistance is selected to provide at least the minimum specified wetting current to keep the contacts clean. The series resistor will limit the current below maximum rating so that the contacts do not just short the fully charged capacitor directly. And then the capacitor is there to act as a low pass filter for the contact bounce.

The pull-up resistance must be low enough value to make sharp enough rising edges. Internal pull-ups in MCUs are quite high in value and thus can result in slow edges, especially if you have the capacitor there.

As the capacitor makes the edge rate slower, in some applications a Schmitt trigger buffer is useful to add hysteresis and square up the signal again to have sharp edges as in some applications the slow edges can be a problem.

So, the parts are not necessary, and you may not need any of these external components. The software just needs to cope with whatever garbage happens on the encoder lines, which means more complex software debouncing, dead time between detecting interrupts etc. And if the pull-ups don't provide enough current, the encoder contacts may oxidize and bounce even more over time.

Answered by Justme on December 22, 2021

No, you don't need them. You do need to cover the bounce period as specified in the datasheet using firmware methods (or equivalent if you are using an FPGA).

Fast (enough) sampling using a periodic ISR works well.

They do not actually debounce reliably unless you have Schmidt trigger inputs. They help with possible ESD through the metal shaft.

Personally, I like to see some series resistance on any inputs, and the internal pullups on most MCUs are a bit high resistance for my preference (for noise immunity with the switch in the open state, especially on a one or two layer board), but you can certainly use the internal pullups if you want.

Answered by Spehro Pefhany on December 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP