# Encoder Module with Button

**Type:** Product page · **SKU:** CE09436 · **Brand:** [Core Electronics](https://core-electronics.com.au/brands/core-electronics-australia)
**Page:** https://core-electronics.com.au/encoder-module-with-button.html ([markdown](https://core-electronics.com.au/encoder-module-with-button.html.md))

Round and round - measure rotational inputs with ease!

## Pricing

- **Price:** $4.45 (inc GST) — $4.05 AUD, exc GST
- **Quantity discounts:** 25+ $3.85 (exc GST) · 50+ $3.64 (exc GST) · 100+ $3.44 (exc GST)

## Availability & dispatch

- In stock, ships same business day if ordered before 2PM (Australia/Sydney).
- We can dispatch 48 today; more stock is typically available with a 8–12 day lead time.

## Description

Add an easy-to-use continuous rotation input to your project, perfect for navigating through a menu, controlling volume, or connecting to a motor.

Skip adding pull-ups and debounce filters, the module includes these quality-of-life components on the underside,

Connect the module to your favourite microcontroller (ensuring you match the power supply voltage to the IO voltage).

These encoders feature the standard T18 spline and include hardware to be panel mounted like most common potentiometers. We stock a [range of colourful knobs of different styles](https://core-electronics.com.au/components/potentiometers/knobs.html) that will fit.

Check [out our guide ](https://core-electronics.com.au/guides/how-to-use-rotary-encoders/)on the theory behind encoders.

### Pinout

 | Pin function | Module label |
|---|---|
| Power input | Labelled as 5V (Also works at 3.3V) |
| Button output | Key |
| Encoder A | S2 |
| Encoder B | S1 |
| Ground | GND |

### Specifications

- 20 Pulses per revolution
- PEC11R Encoder module ([Datasheet](https://core-electronics.com.au/attachments/uploads/CE09436.pdf))
 
### Shipping List

- Encoder module
- Knob (Can ship in a range of colours)

### Examples

**Raspberry Pi Pico - Micropython**

```
from machine import Pin
from utime import sleep

# Create pins for encoder lines and the onboard button

enc_btn = Pin(0, Pin.IN, Pin.PULL_UP)
enc_a = Pin(12, Pin.IN)
enc_b = Pin(13, Pin.IN)

count = 0

# Define a handler function for encoder line A
def encoder_a_IRQ(pin):
    global count
    if enc_a.value() == enc_b.value():
        count += 1
    else:
        count -= 1

# Initialise the interupt to fire on rising edges
enc_a.irq(trigger=Pin.IRQ_RISING, handler=encoder_a_IRQ)

while True:
    print(count)
    if enc_btn.value() == 0:
        print("Button pressed")
    sleep(1)
```

## Guides for this product

- [Getting Started with Rotary Encoders \| Examples with Raspberry Pi Pico](https://core-electronics.com.au/guides/digital-electronics/getting-started-with-rotary-encoders-examples-with-raspberry-pi-pico/)

## Videos for this product

- [Getting Started with Rotary Encoders \| Examples with Raspberry Pi Pico](https://core-electronics.com.au/videos/getting-started-with-rotary-encoders-examples-with-raspberry-pi-pico)

## Images

- [Product image 1](https://core-electronics.com.au/media/catalog/product/e/n/enc.jpg)
