Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use EC11 Rotary Encoder: Examples, Pinouts, and Specs

Image of EC11 Rotary EncoderDesign with EC11 Rotary Encoder in Cirkit Designer

Introduction

The EC11 Rotary Encoder is a compact and versatile electromechanical device that converts the angular position or rotational movement of a shaft into an electrical signal. It is widely used in applications requiring precise user input, such as volume controls, menu navigation, and position sensing in industrial and consumer electronics. Unlike potentiometers, rotary encoders can provide infinite rotation and are capable of detecting both direction and speed of rotation.

Explore Projects Built with EC11 Rotary Encoder

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Arduino UNO-Based Rotary Encoder Interface: A project utilizing EC11 Rotary Encoder in a practical application
Arduino UNO-Based Rotary Encoder Interface

This circuit features a rotary encoder (로터리 엔코) interfaced with an Arduino UNO microcontroller. The encoder's outputs A and B are connected to digital pins D2 and D3 for rotation detection, while its push button is connected to D4, potentially for a user input function. The encoder, push button, and a switch are all debounced using resistors, and the microcontroller is set up to receive these signals for processing, although the provided code is empty and does not define specific behaviors.

Open Project in Cirkit Designer

Common Applications

Technical Specifications

Key Technical Details

Pin Configuration and Descriptions

The EC11 Rotary Encoder typically has 5 pins: three for the encoder and two for the push-button switch. Below is the pinout:

Pin Name Description Connection
GND Ground Connect to circuit ground
VCC Power supply (5V DC) Connect to 5V source
CLK (A) Channel A output signal Connect to microcontroller input pin
DT (B) Channel B output signal Connect to microcontroller input pin
SW Push-button switch output Connect to microcontroller input pin (with pull-up resistor)

Usage Instructions

How to Use the EC11 Rotary Encoder in a Circuit

  1. Wiring the Encoder:

    • Connect the GND pin to the ground of your circuit.
    • Connect the VCC pin to a 5V DC power source.
    • Connect the CLK (A) and DT (B) pins to digital input pins on your microcontroller.
    • Connect the SW pin to a digital input pin on your microcontroller, using a pull-up resistor if necessary.
  2. Reading the Encoder:

    • The EC11 outputs a quadrature signal on the CLK and DT pins. By monitoring the phase difference between these signals, you can determine the direction of rotation.
    • The push-button switch can be used for additional input functionality, such as selecting a menu item.
  3. Debouncing:

    • Both the rotary encoder and the push-button switch may produce noisy signals. Use hardware or software debouncing to ensure reliable operation.

Arduino UNO Example Code

Below is an example of how to use the EC11 Rotary Encoder with an Arduino UNO:

// EC11 Rotary Encoder Example Code for Arduino UNO
// Connect CLK to pin 2, DT to pin 3, and SW to pin 4

#define CLK 2  // Channel A (CLK) connected to digital pin 2
#define DT 3   // Channel B (DT) connected to digital pin 3
#define SW 4   // Push-button (SW) connected to digital pin 4

int lastStateCLK;  // To store the previous state of CLK
int currentStateCLK;  // To store the current state of CLK
int counter = 0;  // Counter to track rotation
bool buttonPressed = false;  // To track button press state

void setup() {
  pinMode(CLK, INPUT);
  pinMode(DT, INPUT);
  pinMode(SW, INPUT_PULLUP);  // Use internal pull-up resistor for SW
  Serial.begin(9600);

  // Initialize lastStateCLK with the initial state of CLK
  lastStateCLK = digitalRead(CLK);
}

void loop() {
  // Read the current state of CLK
  currentStateCLK = digitalRead(CLK);

  // Check if the state of CLK has changed
  if (currentStateCLK != lastStateCLK) {
    // Read the state of DT to determine rotation direction
    if (digitalRead(DT) != currentStateCLK) {
      counter++;  // Clockwise rotation
    } else {
      counter--;  // Counterclockwise rotation
    }

    // Print the counter value to the Serial Monitor
    Serial.print("Counter: ");
    Serial.println(counter);
  }

  // Update lastStateCLK to the current state
  lastStateCLK = currentStateCLK;

  // Check if the push-button is pressed
  if (digitalRead(SW) == LOW) {
    if (!buttonPressed) {
      Serial.println("Button Pressed!");
      buttonPressed = true;
    }
  } else {
    buttonPressed = false;
  }
}

Important Considerations and Best Practices

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Response from the Encoder:

    • Cause: Incorrect wiring or loose connections.
    • Solution: Double-check all connections and ensure proper wiring as per the pinout table.
  2. Erratic or Noisy Signals:

    • Cause: Signal noise or lack of debouncing.
    • Solution: Implement software or hardware debouncing to filter out noise.
  3. Push-Button Not Working:

    • Cause: Missing pull-up resistor or incorrect pin configuration.
    • Solution: Use an internal or external pull-up resistor and verify the SW pin connection.
  4. Incorrect Direction Detection:

    • Cause: Swapped CLK and DT connections.
    • Solution: Swap the CLK and DT connections and test again.

FAQs

Q: Can the EC11 Rotary Encoder detect absolute position?
A: No, the EC11 is an incremental encoder and only detects relative position changes. It does not provide absolute position information.

Q: How do I increase the resolution of the encoder?
A: The resolution is fixed at 20 pulses per revolution (PPR). However, you can use software to detect both rising and falling edges of the signals to effectively double the resolution.

Q: Can I use the EC11 with a 3.3V microcontroller?
A: Yes, but ensure the encoder operates reliably at 3.3V. If not, consider using a level shifter or a 5V power source.

Q: Is the EC11 suitable for high-speed applications?
A: The EC11 is designed for low-speed, manual input applications. For high-speed applications, consider using an optical or magnetic encoder.