RGB Rotary Encoder

An RGB Rotary encoder is similar to a normal rotary encoder but it has the addition of Red, Green and Blue LEDs that shine through the clear stalk of the encoder.

The individual LED have a common VCC but separate ground pins, so can be driven separately. There is no built in resistor for each LED so you need to supply the required resistors in the circuit.

The pinouts of the RGB Rotary encoder can be seen in the diagram below.

The diagram also shows how to wire it up to the Gotek. This setup has the following features:

  • Select button - Since this connects to the common VCC pin, this has go through a PNP transistor to drive the JA select pin to ground.

  • Blue LED for power status.

  • Red LED is driven by the L4 LED anode pin, which is the activity status. Thus, when there is activity the Red LED comes on, which turns the RGB rotary encoder Purple because it is mixed with the Blue LED. Note: the existing Green status LED on the Gotek needs to be removed.


This shows how the clear knob of the RGB rotary encoder is coloured by the LEDs.

Here is a circuit simulation to show how the LED are driven by the Gotek. Click on the Button switch and and the STM32 Pin 14 status (H or L) to see the effects.

The code for this circuit diagram is:

$ 1 0.000005 10.20027730826997 52 5 50

R 176 352 304 352 0 0 40 5 0 0 0.5

L 416 96 576 96 0 1 true 3.3 0

162 48 160 96 160 2 default-led 0 1 0 0.01

x 24 85 49 88 4 14 Red

x 506 68 680 71 4 14 STM32\sPin\s14\s(PA0-WKUP)

b -123 399 158 62 0

b 411 108 420 91 0

x 360 133 475 136 4 14 L4\sLED\sAnode\sPin

g 272 288 304 288 0

162 48 288 96 288 2 default-led 0 0 1 0.01

r 256 96 176 96 0 1000

x 26 274 54 277 4 14 Blue

w 256 96 416 96 0

s 48 224 112 224 0 1 true

w 176 352 16 352 0

g 416 240 416 304 0

w 304 240 416 240 0

r 272 224 176 224 0 1000

w 304 208 416 208 2

t 272 224 304 224 0 1 -3.1806298946641602 0.11937009513583852 100

x 397 258 463 261 4 14 JA\sGround

x 409 188 425 191 4 14 JA

b 413 215 422 198 0

b 412 247 421 230 0

w 16 96 16 160 0

x 25 207 65 210 4 14 Button

R 544 208 592 208 0 0 40 3.3 0 0 0.5

r 464 208 544 208 0 1000

b 139 123 180 74 0

b 139 184 180 135 0

b 138 248 179 199 0

b 138 313 179 264 0

b 139 382 180 333 0

w 16 160 48 160 0

w 16 160 16 224 0

w 16 224 16 288 0

w 16 288 48 288 0

w 96 160 176 160 0

w 16 224 48 224 0

w 112 224 176 224 0

w 96 288 176 288 0

162 48 96 96 96 2 default-led 1 0 0 0.01

w 16 288 16 352 0

w 16 96 48 96 0

w 96 96 176 96 0

r 272 288 176 288 0 1000

s -64 128 -64 224 0 1 true

s -64 224 -64 320 0 1 true

b -147 152 -106 103 0

b -146 247 -105 198 0

b -145 347 -104 298 0

w -64 224 -128 224 0

w -64 128 -128 128 0

w -64 320 -128 320 0

w -128 224 -192 224 0

w -128 128 -192 128 0

w -128 320 -192 320 0

x 188 81 195 84 4 14 5

x 188 142 195 145 4 14 4

x 188 206 195 209 4 14 3

x 185 278 192 281 4 14 2

x 186 337 193 340 4 14 1

x -144 365 -135 368 4 14 A

x -146 266 -136 269 4 14 C

x -146 171 -137 174 4 14 B

x 883 409 1070 412 4 20 RGB\sRotary\sEncoder

x -61 424 126 427 4 20 RGB\sRotary\sEncoder

x 23 145 61 148 4 14 Green

w 416 208 464 208 0

b 447 240 616 175 0

g -192 224 -240 224 0

w -272 128 -192 128 0

w -272 320 -192 320 0

b -282 136 -273 119 0

b -281 330 -272 313 0

x -334 131 -284 134 4 14 J7\sPin\s1

x 1090 115 1140 118 4 14 J7\sPin\s1

x 1154 115 1204 118 4 14 J7\sPin\s1

x -343 327 -293 330 4 14 J7\sPin\s2