Difference between revisions of "STM32 Rotary Encoder"

From Stm32World Wiki
Jump to navigation Jump to search
Line 4: Line 4:
  
 
Typically they will have two outputs with the pulses out of phase.  By checking which pulse "comes first" the direction of the turn can be determined.  It is not overly complicated to handle this manually, for example by hooking the signals up to an external GPIO Interrupt.
 
Typically they will have two outputs with the pulses out of phase.  By checking which pulse "comes first" the direction of the turn can be determined.  It is not overly complicated to handle this manually, for example by hooking the signals up to an external GPIO Interrupt.
 +
 +
== Rotary encoder de-bouncing ==
 +
 +
Rotary encoders are build with mechanical contacts and they are prone to "bouncing" (one press generate more than one interrupt".  The "signals" can be cleaned up by implementing a low-pass filter like this:
 +
 +
[[File:rotary debounce.png|600px]]

Revision as of 09:27, 26 July 2021

Rotary Encoder w. debounce circuitry.jpg

Rotary Encoders are devices which will generate pulses when they are turned.

Typically they will have two outputs with the pulses out of phase. By checking which pulse "comes first" the direction of the turn can be determined. It is not overly complicated to handle this manually, for example by hooking the signals up to an external GPIO Interrupt.

Rotary encoder de-bouncing

Rotary encoders are build with mechanical contacts and they are prone to "bouncing" (one press generate more than one interrupt". The "signals" can be cleaned up by implementing a low-pass filter like this:

Rotary debounce.png