Code‑and.Coffee

Rotary Encoder with RGB LED Ring

PCB Thumbnail I like rotary encoders, but I hate that there is no direct feedback or indicator showing the position like with potentiometers. This post is about a custom PCB for rotary encoders with RGB LED rings I am working on.

Why?

I want rotary encoders (“knobs”) with a ring of LEDs around them, and I want a lot of them! There are a few breakout boards like this one on Sparkfun, but I wanted to try something else.

So what’s the problem?

ALPS STEC12E08 Each rotary encoder requires two input pins which have to be checked all the time to register the knob movement. So to use a lot of rotary encoders at once you also need a lot of input pins. Unless the controller has a lot of interrupt-enabled pins it would also mean that a lot of processing power is wasted on checking the status of all rotary encoders all the time.

That’s impractical - which led me to the idea of having a PCB with a cheap controller dedicated to checking the encoder state and updating the LEDs accordingly. Using a TWI/I2C bus any other controller should be able to get and set the position of the knobs.

The Hardware

I used the Atmel Product Selector for Microcontrollers to find a small ATtiny with enough interrupt pins and ended up using the ATtiny20, which is a low-end microcontroller that fits my requirements:

  • 2kB flash
  • 128b SRAM
  • 12 I/O pins
  • 12 ext. interrupt sources (all 12 pins)
  • TWI/I2C slave interface


For the LEDs I am using 5050 RGB LEDs with integrated WS2812B controller and the rotary encoders are ALPS STEC12E08 with 24 pulses and integrated switch.

The PCB

This is the PCB that I designed in KiCAD. It features two rotary encoders, each with a ring of 10 LEDs.
PCB with components

The Front Panel

Update: I got the first front panel prototype

Based on the PCB outline I made a vector graphic for several different front panels with variations in size and engraving.
First I exported the PCB layers as *.dxf files, opened those in LibreCAD and saved the required layers as *.svg. I then opened the file in Inkscape and changed the colors and line widths.
I am getting the file laser cut out of 3mm white translucent acrylic, hoping that it’ll look good with the LEDs underneath.
Front panel graphic for laser cutting

Next steps

I ordered all the components, the PCB and the front panel and am waiting for everything to arrive. In the meantime I will start writing the software for the ATtiny20.