Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use Oled-Rotary-Encoder: Examples, Pinouts, and Specs

Image of Oled-Rotary-Encoder
Cirkit Designer LogoDesign with Oled-Rotary-Encoder in Cirkit Designer

Introduction

The OLED-Rotary-Encoder by SAMIROB (Part ID: Rotary Encoder) is a versatile device that combines an OLED display with a rotary encoder. This integration allows for both visual feedback and user input through rotation and pressing. The component is ideal for applications requiring compact user interfaces, such as menu navigation, parameter adjustment, and real-time data display.

Explore Projects Built with Oled-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!
STM32F103C8T6-Based Rotary Encoder with OLED Display
Image of winding: A project utilizing Oled-Rotary-Encoder in a practical application
This circuit features an STM32F103C8T6 microcontroller interfaced with an OLED display and a rotary encoder. The microcontroller reads the encoder's phase signals to detect rotational input and communicates with the OLED display via I2C to present information visually.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO-Based Interactive OLED Display with Pushbuttons and Rotary Encoder
Image of ARDUNIO: A project utilizing Oled-Rotary-Encoder in a practical application
This circuit features an Arduino UNO microcontroller interfaced with a 0.96" OLED display, a rotary encoder, and four pushbuttons. The Arduino reads inputs from the pushbuttons and rotary encoder, and displays information on the OLED screen, making it suitable for user input and display applications.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO-Based Rotary Encoder Interface
Image of encoder: A project utilizing Oled-Rotary-Encoder in a practical application
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.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino Nano Controlled OLED Display with Rotary Encoder and Button Input
Image of space impact: A project utilizing Oled-Rotary-Encoder in a practical application
This circuit features an Arduino Nano microcontroller interfaced with a 0.96" OLED display for visual output, a rotary encoder for input with position and button press detection, and an additional tactile switch for user input. The OLED communicates with the Arduino via I2C, while the encoder and switch provide interactive control, all powered by the Arduino's 5V supply.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with Oled-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 winding: A project utilizing Oled-Rotary-Encoder in a practical application
STM32F103C8T6-Based Rotary Encoder with OLED Display
This circuit features an STM32F103C8T6 microcontroller interfaced with an OLED display and a rotary encoder. The microcontroller reads the encoder's phase signals to detect rotational input and communicates with the OLED display via I2C to present information visually.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of ARDUNIO: A project utilizing Oled-Rotary-Encoder in a practical application
Arduino UNO-Based Interactive OLED Display with Pushbuttons and Rotary Encoder
This circuit features an Arduino UNO microcontroller interfaced with a 0.96" OLED display, a rotary encoder, and four pushbuttons. The Arduino reads inputs from the pushbuttons and rotary encoder, and displays information on the OLED screen, making it suitable for user input and display applications.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of encoder: A project utilizing Oled-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.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of space impact: A project utilizing Oled-Rotary-Encoder in a practical application
Arduino Nano Controlled OLED Display with Rotary Encoder and Button Input
This circuit features an Arduino Nano microcontroller interfaced with a 0.96" OLED display for visual output, a rotary encoder for input with position and button press detection, and an additional tactile switch for user input. The OLED communicates with the Arduino via I2C, while the encoder and switch provide interactive control, all powered by the Arduino's 5V supply.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • User interface for embedded systems
  • Menu navigation in microcontroller-based projects
  • Real-time data visualization
  • Volume or parameter control in audio and industrial systems
  • Compact control panels for IoT devices

Technical Specifications

Key Technical Details

Parameter Value
Manufacturer SAMIROB
Part ID Rotary Encoder
OLED Display Type 128x64 pixels, monochrome
OLED Interface I2C (Inter-Integrated Circuit)
Rotary Encoder Type Incremental
Encoder Resolution 20 steps per revolution
Push Button Integrated (momentary switch)
Operating Voltage 3.3V - 5V
Current Consumption ~20mA (OLED active)
Dimensions 30mm x 30mm x 15mm

Pin Configuration and Descriptions

OLED Display Pins

Pin Name Description Notes
VCC Power supply (3.3V - 5V) Connect to the power source
GND Ground Common ground for the circuit
SCL I2C Clock Line Connect to microcontroller SCL
SDA I2C Data Line Connect to microcontroller SDA

Rotary Encoder Pins

Pin Name Description Notes
CLK Clock signal output Connect to microcontroller pin
DT Data signal output Connect to microcontroller pin
SW Push button signal output Connect to microcontroller pin
GND Ground Common ground for the circuit
VCC Power supply (3.3V - 5V) Connect to the power source

Usage Instructions

How to Use the Component in a Circuit

  1. Power Connections: Connect the VCC and GND pins of both the OLED and rotary encoder to the power supply (3.3V or 5V).
  2. I2C Communication: Connect the OLED's SDA and SCL pins to the corresponding I2C pins on your microcontroller (e.g., Arduino UNO: A4 for SDA, A5 for SCL).
  3. Rotary Encoder Connections:
    • Connect the CLK and DT pins to digital input pins on the microcontroller.
    • Connect the SW pin to another digital input pin for push-button functionality.
  4. Pull-Up Resistors: Use pull-up resistors (typically 10kΩ) on the SDA, SCL, and SW lines if not already integrated.
  5. Code Implementation: Use libraries for I2C OLED displays (e.g., Adafruit SSD1306) and rotary encoders to simplify programming.

Important Considerations and Best Practices

  • Ensure the power supply voltage matches the component's operating range (3.3V - 5V).
  • Avoid excessive mechanical force on the rotary encoder to prevent damage.
  • Use debounce techniques in software to handle rotary encoder and push-button signals.
  • Verify the I2C address of the OLED display (default: 0x3C) and adjust in the code if necessary.

Example Code for Arduino UNO

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Encoder.h>

// OLED display dimensions
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64

// I2C address for the OLED display
#define OLED_ADDR 0x3C

// Initialize OLED display
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

// Rotary encoder pins
#define ENCODER_CLK 2
#define ENCODER_DT 3
#define ENCODER_SW 4

// Initialize rotary encoder
Encoder myEnc(ENCODER_CLK, ENCODER_DT);

void setup() {
  // Initialize serial communication
  Serial.begin(9600);

  // Initialize OLED display
  if (!display.begin(SSD1306_I2C_ADDRESS, OLED_ADDR)) {
    Serial.println(F("OLED initialization failed!"));
    while (true); // Halt execution if OLED fails
  }
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0, 0);
  display.println(F("OLED-Rotary-Encoder"));
  display.display();

  // Configure rotary encoder button pin
  pinMode(ENCODER_SW, INPUT_PULLUP);
}

void loop() {
  // Read rotary encoder position
  static long oldPosition = -999;
  long newPosition = myEnc.read() / 4; // Adjust for encoder resolution
  if (newPosition != oldPosition) {
    oldPosition = newPosition;
    display.clearDisplay();
    display.setCursor(0, 0);
    display.print(F("Position: "));
    display.println(newPosition);
    display.display();
  }

  // Check if the button is pressed
  if (digitalRead(ENCODER_SW) == LOW) {
    display.setCursor(0, 20);
    display.println(F("Button Pressed!"));
    display.display();
    delay(200); // Debounce delay
  }
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. OLED Display Not Turning On:

    • Verify the power connections (VCC and GND).
    • Check the I2C address (default: 0x3C) and update the code if necessary.
    • Ensure the OLED library is correctly installed.
  2. Rotary Encoder Not Responding:

    • Confirm the CLK and DT pins are connected to the correct microcontroller pins.
    • Check for loose connections or damaged wires.
    • Implement software debouncing to handle noisy signals.
  3. Push Button Not Working:

    • Ensure the SW pin is connected to a digital input pin with a pull-up resistor.
    • Verify the button press logic in the code (LOW indicates a press).
  4. Flickering or Unstable Display:

    • Use a stable power supply to avoid voltage fluctuations.
    • Add decoupling capacitors (e.g., 0.1µF) near the VCC and GND pins.

FAQs

Q: Can I use this component with a 3.3V microcontroller like ESP32?
A: Yes, the OLED-Rotary-Encoder supports both 3.3V and 5V logic levels.

Q: What is the default I2C address of the OLED display?
A: The default I2C address is 0x3C. Check the datasheet or use an I2C scanner if unsure.

Q: How do I handle noisy signals from the rotary encoder?
A: Use software debouncing techniques or external capacitors (e.g., 10nF) on the CLK and DT lines.

Q: Can I change the OLED display's text size?
A: Yes, use the setTextSize() function in the Adafruit SSD1306 library to adjust the text size.