EC11 Rotary Encoder

A rotary or "shaft" encoder is an angular measuring device. It is used to precisely measure rotation of motors or to create wheel controllers (knobs) that can turn infinitely (with no end stop like a potentiometer has). Some of them are also equipped with a pushbutton when you press on the axis (like the ones used for navigation on many music controllers). 

Quick Spec

  • Click Positions : 20 
  • Shaft Length : 15mm
  • Rotation : 360 Degree
  • Mount: Vertical PCB
  • Built in Push Button : Yes
  • Shaft: Round with Flat edge

Code Example

// Rotary encoder example.
// Author: Nick Gammon
// Date:   24th May 2011

// Wiring: Connect common pin of encoder to ground.
// Connect pins A and B (the outer ones) to pins 2 and 3 (which can generate interrupts)

volatile boolean fired = false;
volatile long rotaryCount = 0;

// Interrupt Service Routine
void isr ()
{
  
static boolean ready;
static unsigned long lastFiredTime;
static byte pinA, pinB;  

// wait for main program to process it
  if (fired)
    return;
    
  byte newPinA = digitalRead (2);
  byte newPinB = digitalRead (3);
  
  // Forward is: LH/HH or HL/LL
  // Reverse is: HL/HH or LH/LL
  
  // so we only record a turn on both the same (HH or LL)
  
  if (newPinA == newPinB)
    {
    if (ready)
      {
      long increment = 1;
        
      // if they turn the encoder faster, make the count go up more
      // (use for humans, not for measuring ticks on a machine)
      unsigned long now = millis ();
      unsigned long interval = now - lastFiredTime;
      lastFiredTime = now;
      
      if (interval < 10)
        increment = 5;
      else if (interval < 20)
        increment = 3;
      else if (interval < 50)
        increment = 2;
         
      if (newPinA == HIGH)  // must be HH now
        {
        if (pinA == LOW)
          rotaryCount += increment;
        else
          rotaryCount -= increment;
        }
      else
        {                  // must be LL now
        if (pinA == LOW)  
          rotaryCount -= increment;
        else
          rotaryCount += increment;        
        }
      fired = true;
      ready = false;
      }  // end of being ready
    }  // end of completed click
  else
    ready = true;
    
  pinA = newPinA;
  pinB = newPinB;
}  // end of isr


void setup ()
{
  digitalWrite (2, HIGH);   // activate pull-up resistors
  digitalWrite (3, HIGH); 
  
  attachInterrupt (0, isr, CHANGE);   // pin 2
  attachInterrupt (1, isr, CHANGE);   // pin 3

  Serial.begin (115200);
}  // end of setup

void loop ()
{

  if (fired)
    {
    Serial.print ("Count = ");  
    Serial.println (rotaryCount);
    fired = false;
  }  // end if fired

}  // end of loop

read more here

Shipping List

  • 1 x EC11 Rotary Encoder


EC11 Rotary Encoder

  • Brand: Generic
  • Product Code: EC11-VER-15-SP
  • Weight: 0.005kg
  • Stock

    Warehouse Stock Status Location
    Centurion No Stock
    Stellenbosch No Stock

    We ship free of charge between branches to complete your order.

  • R14.85 (Inc Tax: R17.08)


Related Products

Rotary Encoder Module - Breadboard Ready

Rotary Encoder Module - Breadboard Ready

Rotary Encoder Module - Breadboard Ready (Threaded) The KY-040 rotary encoder is a rotary input device (as in knob) that provides an indication of how much the knob has been rotated AND what directio..

Centurion
Stellenbosch
Part No: ROT-ENC-TH

R20.00 (Inc Tax: R23.00)

Absolute Encoder - Bourns

Absolute Encoder - Bourns

Absolute Encoder - Bourns The Bourns Absolute Encoder is a digital control knob that provides 128 unique results evenly spaced around a full circle. It is designed as a control panel knob but can b..

Centurion
Stellenbosch
Part No: COM-15036

R158.00 (Inc Tax: R181.70)

Rotary Encoder Round PCB - SIL Conn

Rotary Encoder Round PCB - SIL Conn

Rotary Encoder Round PCB - SIL Connector This is an incremental rotary encoder that encodes the rotation by electronic pulse, each output encodes clockwise and counterclockwise with 20 pulses per c..

Centurion
Stellenbosch
Part No: ROT-ENC-BR

R28.00 (Inc Tax: R32.20)

22mm Rotary Potentiometer - 10K

22mm Rotary Potentiometer - 10K

22mm Rotary Potentiometer - 10K This is a single turn IP65 10K potentiometer which is made to fit a 22mm pushbutton control station, making it great to use as an indicating knob and dial to control..

Centurion
Stellenbosch
Part No: LA42DWQ-22-10K

R49.00 (Inc Tax: R56.35)

22mm Rotary Potentiometer - 1K

22mm Rotary Potentiometer - 1K

22mm Rotary Potentiometer - 1K This is a single turn IP65 1K potentiometer which is made to fit a 22mm pushbutton control station, making it great to use as an indicating knob and dial to control a..

Centurion
Stellenbosch
Part No: LA42DWQ-22-1K

R75.00 (Inc Tax: R86.25)

EC11 Vertical Encoder - 15mm

EC11 Vertical Encoder - 15mm

EC11 Vertical Encoder - 15mm Rotary encoders has full rotation without limits. They output grey code so that you can tell how much and in which direction the encoder has been turned. Pressing down ..

Centurion
Stellenbosch
Part No: EC11-VS-15

R9.00 (Inc Tax: R10.35)

DF Robot Encoder Module - Vertical

DF Robot Encoder Module - Vertical

DF Robot Encoder Module - Vertical This is an 8421 absolute position encoder(Vertical) with 16-gear code(0-F). The mechanical position determines the uniqueness of each position of the encoder. Com..

Centurion
Stellenbosch
Part No: DFR0721

R79.00 (Inc Tax: R90.85)

DF Robot Encoder Module - Horizontal

DF Robot Encoder Module - Horizontal

DF Robot Encoder Module - Horizontal This is an 8421 absolute position encoder (Horizontal) with 16-gear code(0-F). The mechanical position determines the uniqueness of each position of the encoder..

Centurion
Stellenbosch
Part No: DFR0722

R78.00 (Inc Tax: R89.70)

Tags: rotary encoder, ec11, rotary, encoder, shaft encoder, 15mm