Ramanu rotary encoder · Genuine Bourns PEC12R · Hardware debounced
Menu skips, value counts twice? That’s contact bounce, not your code.
Every mechanical encoder bounces for a few milliseconds on each click. This module filters it out in hardware, on A, B and the push switch, so your microcontroller sees one clean edge per click. Connect 5 wires and write simple code.
Your demo shouldn’t fail because of a knob.
Real logic-analyzer captures from our bench, 3.3 V supply. Not an illustration.
Fixes the encoder problems makers hit every day
If the knob behaves differently every time you turn it, the signal is the suspect, not your code.
🔄 Counts twice per click
Volume jumps by 2, value skips a step
Fixed: RC filter removes the bounce edges
📋 Menu jumps or goes backwards
OLED / LCD menus on Arduino and ESP32
Fixed: one clean edge, correct direction
🖰️ Button press registers twice
Select opens and closes in one press
Fixed: the push switch is debounced too
❌ Button does nothing
Switch pull-up missing on many low-cost modules
Fixed: 10k pull-ups on A, B and SW
🔧 Gets scratchy after a few months
Unbranded encoders with no rated life
Fixed: Bourns PEC12R, 30,000 rotations minimum
📏 Shaft too short for the box
Front panels, 3D-printed enclosures
Fixed: 30 mm shaft, 23.9 mm above the body
Connect it in a minute
What bounce is really costing you
Cheaper than one failed demo.
A menu that jumps in front of an examiner or a customer costs far more than the right part.
No delay() hacks.
Software debounce adds delays that can miss steps when your code is busy. Fix it before it reaches the pin.
Cheaper than an evening of debugging.
Stop rewriting your encoder code for a problem that comes from the contacts.
Already have a KY-040 style module?
It’s fine for a first experiment. It wasn’t built for a project that has to work every time.
| What matters | Typical low-cost module | Ramanu encoder module |
|---|---|---|
| Encoder | Unbranded, no datasheet | Genuine Bourns PEC12R-4230F-S0024 |
| Debounce | None: you fix it in software | 10k + 0.1 µF RC filter on A, B and SW |
| Pull-ups | Switch pull-up often missing | 10k on A, B and SW |
| Rated life | Not specified | 30,000 rotations, 20,000 presses (minimum) |
| Shaft | Short | 30 mm insulated 6 mm D-shaft |
| Temperature | Not specified | −30 to +70 °C |
| Proof | None | Measured captures on this page |
Ramanu values from the Bourns PEC12R datasheet and our board design.
What’s on the board, and why
Genuine Bourns PEC12R
24 detents, 24 pulses per turn, push switch. Rated 30,000 rotations and 20,000 presses. Not an unbranded clone.
RC debounce on A, B and SW
10k series resistor and 0.1 µF capacitor on every line. We tested lower values on the bench and still saw bounce, so we chose 0.1 µF.
10k pull-ups on all three lines
Defined high level on A, B and the switch. No INPUT_PULLUP dependence, no floating button.
Supply decoupling
On-board capacitor across VCC and GND keeps the pull-up rail quiet.
30 mm insulated D-shaft
23.9 mm above the encoder body, 12 mm flat. Turn it directly or fit any standard 6 mm D-shaft knob.
5-pin 2.54 mm header
SW, B, A, GND, VCC, in the order printed on the board. Jumper wires or breadboard.
Buy more, pay less
All prices include 18% GST. The discount applies automatically in the cart.
Need more than 20 for a lab, a class or a product? Ask for a quote →
Quick-start Arduino code
Wiring: A to D2, B to D3, SW to D4, VCC to 5V, GND to GND. For ESP32, change the pin numbers to 32, 33 and 25 and power VCC from 3V3.
const int CLK = 2; // A
const int DT = 3; // B
const int SW = 4; // push switch
volatile int counter = 0;
void setup() {
pinMode(CLK, INPUT); // pull-ups are on the module
pinMode(DT, INPUT);
pinMode(SW, INPUT);
Serial.begin(9600);
attachInterrupt(digitalPinToInterrupt(CLK), readEncoder, RISING);
}
void readEncoder() {
counter += (digitalRead(DT) != digitalRead(CLK)) ? 1 : -1;
}
void loop() {
static int last = 0;
if (counter != last) {
Serial.print("Position: ");
Serial.println(counter);
last = counter;
}
if (digitalRead(SW) == LOW) {
Serial.println("Button pressed");
while (digitalRead(SW) == LOW) {} // wait for release
}
}
Full technical specifications
| Encoder | Bourns PEC12R-4230F-S0024 (genuine) |
| Output | Incremental quadrature A and B, plus push switch (active LOW) |
| Resolution | 24 pulses per revolution, 24 detents |
| Rotation | 360° continuous, no end stops |
| Rotational life | 30,000 cycles minimum |
| Switch life | 20,000 cycles minimum |
| Contact bounce (encoder) | 2.0 ms maximum at 15 RPM (Bourns datasheet) |
| Debounce filter | 10kΩ series + 0.1 µF on A, B and SW |
| Pull-ups | 10kΩ to VCC on A, B and SW |
| Supply | 3.3 V to 5 V; outputs swing to VCC |
| Shaft | Insulated 6 mm D-shaft, 4.5 mm across flat; 30.0 mm from mounting surface, 12.0 mm flat |
| Mounting | PCB mount, no threaded bushing (no panel nut) |
| Operating temperature | −30 °C to +70 °C |
| Connector | 5-pin 2.54 mm header: SW, B, A, GND, VCC |
| Compliance | RoHS |
| SKU | REM-PECR-24 |
Common questions
Is a knob included?
No. The 30 mm shaft is long enough to turn directly, and any standard 6 mm D-shaft knob fits.Does it work with ESP32 and Pico?
Yes. Power VCC from 3.3 V so the outputs are 3.3 V.Can I mount it on a panel with a nut?
No. This encoder has no threaded bushing. Mount the board behind the panel on standoffs and pass the shaft through.Do I still need software debounce?
No. Simple interrupt code like the example above is enough.Proof, not promises
Everything we claim, you can check.
Your demo shouldn’t fail because of a knob.
Genuine Bourns encoder, debounced in hardware. 1 click = 1 count.
Add encoder module to cart → Buy now






Reviews
There are no reviews yet.