Omron E6B2-CWZ6C incremental encoder (A/B/Z) with ESP32

Supply 5-24 V Bus GPIO Measures rotation, position, speed
BROWNBLUEBLACKWHITEORANGESHIELD

Pins and ESP32 wiring

PinRoleESP32 pinNotes
BROWNPower3V3Supply +. Needs 5 to 24 V: use VIN (5 V)
BLUEGroundGND0 V
BLACKOutput (the part drives it)D25Phase A. NPN open collector: use INPUT_PULLUP or 4.7 kΩ to 3V3, never to the supply
WHITEOutput (the part drives it)D26Phase B. NPN open collector: pull-up to 3V3 only
ORANGEOutput (the part drives it)D27Phase Z (one pulse per turn). NPN open collector: pull-up to 3V3 only
SHIELDNot wired to the ESP32—Leave unconnected or tie to GND

Suggested wiring for the 30-pin ESP32 DevKit, avoiding flash, input-only and strapping pins. BoardPilot checks it for you as you wire.

Starter code (Arduino)

void setup() {
  Serial.begin(115200);
  pinMode(25, INPUT);  // BLACK
}

void loop() {
  Serial.println(digitalRead(25));
  delay(100);
}

Sources

Try it in 3D in BoardPilot

BoardPilot Part data (JSON)

Related parts

Part data: CC BY 4.0, free to reuse with credit to BoardPilot.