

The Alps Alpine STEC12E07 is a high-quality rotary encoder designed to convert the angular position or motion of a shaft into a digital signal. This electromechanical device is widely used in applications requiring precise position sensing, user input control, or rotational feedback. Its compact design and robust performance make it ideal for use in industrial equipment, consumer electronics, and robotics.








The following table outlines the key technical details of the STEC12E07 rotary encoder:
| Parameter | Specification |
|---|---|
| Manufacturer | Alps Alpine |
| Part Number | STEC12E07 |
| Operating Voltage | 5V DC |
| Maximum Current | 10 mA |
| Output Type | Quadrature (2-bit Gray Code) |
| Rotational Life | 30,000 cycles |
| Detent Positions | 30 |
| Pulses per Revolution | 15 |
| Operating Temperature | -30°C to +85°C |
| Shaft Length | 15 mm |
| Mounting Style | PCB Mount |
The STEC12E07 rotary encoder has five pins. The table below describes each pin:
| Pin Number | Pin Name | Description |
|---|---|---|
| 1 | GND | Ground connection |
| 2 | VCC | Power supply (typically 5V DC) |
| 3 | SW | Push-button switch output (active low) |
| 4 | DT | Data signal for quadrature output |
| 5 | CLK | Clock signal for quadrature output |
VCC pin to a 5V DC power source and the GND pin to ground.CLK and DT pins to digital input pins on your microcontroller. These pins provide the quadrature signals for detecting rotation direction and steps.SW pin to a digital input pin on your microcontroller. Use a pull-up resistor if necessary, as the switch output is active low.SW, CLK, and DT pins if your microcontroller does not have internal pull-ups enabled.CLK and DT signals carefully to determine the direction and number of steps. The quadrature output provides two signals that are 90° out of phase.Below is an example Arduino sketch to read the STEC12E07 rotary encoder and detect rotation direction and button presses:
// Pin definitions for the rotary encoder
#define CLK 2 // Clock pin connected to digital pin 2
#define DT 3 // Data pin connected to digital pin 3
#define SW 4 // Switch pin connected to digital pin 4
int lastStateCLK; // Variable to store the previous state of the CLK pin
int currentStateCLK; // Variable to store the current state of the CLK pin
int counter = 0; // Counter to track the encoder position
String direction; // Variable to store the rotation direction
void setup() {
pinMode(CLK, INPUT); // Set CLK pin as input
pinMode(DT, INPUT); // Set DT pin as input
pinMode(SW, INPUT_PULLUP); // Set SW pin as input with pull-up resistor
// Read the initial state of the CLK pin
lastStateCLK = digitalRead(CLK);
// Initialize serial communication for debugging
Serial.begin(9600);
}
void loop() {
// Read the current state of the CLK pin
currentStateCLK = digitalRead(CLK);
// If the state of the CLK pin has changed, a step has occurred
if (currentStateCLK != lastStateCLK) {
// Check the state of the DT pin to determine the direction
if (digitalRead(DT) != currentStateCLK) {
counter++; // Clockwise rotation
direction = "CW";
} else {
counter--; // Counterclockwise rotation
direction = "CCW";
}
// Print the direction and counter value to the serial monitor
Serial.print("Direction: ");
Serial.print(direction);
Serial.print(" | Counter: ");
Serial.println(counter);
}
// Update the last state of the CLK pin
lastStateCLK = currentStateCLK;
// Check if the push-button is pressed
if (digitalRead(SW) == LOW) {
Serial.println("Button Pressed!");
delay(200); // Debounce delay
}
}
No Signal Detected:
VCC and GND pins are properly connected.CLK and DT pins are connected to the correct microcontroller pins.Erratic or Noisy Readings:
CLK and GND pins and between the DT and GND pins to filter noise.Push-Button Not Working:
SW pin connection and ensure a pull-up resistor is used.Q: Can I use the STEC12E07 with a 3.3V microcontroller?
A: Yes, the STEC12E07 can work with 3.3V systems, but ensure the signal levels are compatible with your microcontroller.
Q: How do I increase the rotational life of the encoder?
A: Avoid applying excessive force to the shaft and ensure the encoder is mounted securely to prevent mechanical stress.
Q: What is the purpose of the detent positions?
A: Detent positions provide tactile feedback, making it easier to feel discrete steps during rotation.
Q: Can I use this encoder for high-speed applications?
A: The STEC12E07 is suitable for low to moderate-speed applications. For high-speed use, consider encoders designed specifically for such purposes.