create new tag
view all tags

Rotary Encoder

The rotary encoder can be considered as 2 switches which periodically open and close as you turn the encoder shaft. It can be used e.g. to change the volume on a music system or, when connected to a motor shaft, to measure the motor speed or position.

We need 2 square wave signals in order to distinguish the encoder being turned left of right.

the rotary encoder
The encoder board has got 5 pins:
  • Vcc
  • Ground
  • sw
  • dt
  • clk
It contains two 10 kΩ resistors to limit the current when the switch is closed. The pulse train on the dt (data) pin with respect to the clk pin is shifted by 90 in such a way that, when turning right, after each transition of the clk signal the data signal is in opposite phase (when clk is high, dt is low and vice versa). When turning left, then the two signals are in phase.
rotaryRight.png rotaryLeft.png
pulse trains when turning right pulse trains when turning left
Finally the shaft can be pushed down to close a switch, similar to a simple push button. The state of this push button is seen on the sw pin.

-- Uli Raich - 2017-02-05


Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng rotaryEncoder.png r1 manage 32.7 K 2017-02-05 - 12:36 UnknownUser  
PNGpng rotaryLeft.png r1 manage 4.0 K 2017-02-05 - 15:54 UnknownUser  
PNGpng rotaryRight.png r1 manage 2.7 K 2017-02-05 - 15:49 UnknownUser  
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2017-02-05 - uli
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback