Incremental Rotary Encoder with Push Switch
$8.50 / unit · Datasheet PDF · Add to cart
Product image: AXRT-24E encoder — top and angled views showing D-shaft, body, and 5-pin through-hole leads
The AXRT-24E is a 24 PPR mechanical incremental rotary encoder with an integrated push-to-select switch. It generates quadrature (90° phase-shifted) pulses on channels A and B, allowing host logic to determine both position and rotational direction from a single interrupt source.
Output lines use open-collector (NPN) topology. Internal pull-up resistors are not provided; connect 10 kΩ resistors from OUT_A, OUT_B, and SW to VCC, or enable MCU internal pull-ups. The integrated switch activates on axial shaft depression and is rated for 50 mA at 12 V.
Note: Compatible with 3.3 V and 5 V logic without level-shifting. Most MCU internal pull-ups (20–50 kΩ) are adequate for hand-operated encoders at typical rotation speeds.
| Parameter | Min | Typ | Max | Unit |
|---|---|---|---|---|
| Supply voltage (VCC) | 3.0 | 3.3 / 5.0 | 5.5 | V |
| Quiescent current | — | 0.4 | 1.0 | mA |
| Output sink current (OUT_A/B) | — | — | 10 | mA |
| Output low voltage (VOL) | — | 0.1 | 0.4 | V |
| Output rise/fall time | — | 2 | 5 | µs |
| Switch rating | — | — | 50 mA @ 12 V | — |
| Switch contact resistance | — | 100 | 500 | mΩ |
| Switch bounce time | — | 3 | 8 | ms |
| Parameter | Value | Unit |
|---|---|---|
| Pulses per revolution | 24 | PPR |
| Detents per revolution | 24 | — |
| Mechanical life (rotation) | 50,000 | cycles |
| Switch actuation force | 6 typ, 8 max | N |
| Switch mechanical life | 30,000 | cycles |
| Shaft diameter | 6 (D-cut) | mm |
| Shaft height above housing | 20 | mm |
| Body dimensions (L×W×H) | 12 × 12 × 7 | mm |
| Pin pitch | 2.54 | mm |
| Operating temperature | −30 to +85 | °C |
| Storage temperature | −40 to +100 | °C |
| Weight | 2.1 | g |
Pin diagram: 5-pin through-hole footprint, top view — pins 1–5 left to right, 2.54 mm pitch, with body outline and shaft centre marked
| Pin | Symbol | Type | Description |
|---|---|---|---|
| 1 | GND | Power | Common ground reference |
| 2 | VCC | Power | Supply voltage, 3.3 V – 5 V |
| 3 | OUT_A | Output | Phase A — quadrature channel A |
| 4 | OUT_B | Output | Phase B — quadrature channel B, 90° offset |
| 5 | SW | Output | Push switch, active low — requires pull-up |
| Step | A | B | Direction note |
|---|---|---|---|
| 0 | 0 | 0 | CW: 0 → 1 → 2 → 3 → 0 |
| 1 | 1 | 0 | CCW: 0 → 3 → 2 → 1 → 0 |
| 2 | 1 | 1 | — |
| 3 | 0 | 1 | — |
const byte PIN_A = 2; // interrupt-capable pin
const byte PIN_B = 3; // interrupt-capable pin
const byte PIN_SW = 4;
volatile int32_t position = 0;
volatile bool pressed = false;
void onEdge() {
bool a = digitalRead(PIN_A);
bool b = digitalRead(PIN_B);
position += (a ^ b) ? -1 : 1;
}
void onPress() { pressed = true; }
void setup() {
pinMode(PIN_A, INPUT_PULLUP);
pinMode(PIN_B, INPUT_PULLUP);
pinMode(PIN_SW, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(PIN_A), onEdge, CHANGE);
attachInterrupt(digitalPinToInterrupt(PIN_B), onEdge, CHANGE);
attachInterrupt(digitalPinToInterrupt(PIN_SW), onPress, FALLING);
Serial.begin(115200);
}
void loop() {
if (pressed) {
Serial.println("switch pressed");
pressed = false;
}
Serial.println(position);
delay(50);
}
from machine import Pin
from time import sleep_ms
pin_a = Pin(2, Pin.IN, Pin.PULL_UP)
pin_b = Pin(3, Pin.IN, Pin.PULL_UP)
pin_sw = Pin(4, Pin.IN, Pin.PULL_UP)
position = 0
last_a = pin_a.value()
while True:
a = pin_a.value()
if a != last_a:
b = pin_b.value()
position += 1 if a != b else -1
last_a = a
print(f"pos={position}")
if not pin_sw.value():
print(f"switch pressed, pos={position}")
sleep_ms(20) # debounce
sleep_ms(1)
Tip: For interrupt-driven reading, attach to CHANGE edges on both A and B for full 4× resolution (96 counts/revolution). For hand-operated use, polling at ≥ 1 kHz is sufficient — practical max rotation is ≈ 5 RPS.