How to wire a rotary encoder fit in a matrix?

So I have this rotary encoder -> It has 5 pins - CLK, DT, SW, + and GND. From what I understand, I can plug CLK and DT on any pin, plug + to VCC and GND to Ground. For the switch part, I really have no idea on this. In QMK, I need to provide the row and column pins but this only has 1 more pin. Also, how do I include the encoder, at least the switch part, on the switch matrix?

1 Like

my guess is that they wire the button like this
so it would cost you a whole pin just for this button

I think it would be better to use the encoder “raw”. You will need 2 pins for reading the encoder, the “button” can be wired as other switch.
I wire the encoder like this (image from google)
(this includes hardware debouncer)
it works flawlessly.

Thanks for the reply.
I got one “raw” encoder. I am using the BDN9 firmware from and wired it up. I got the mute working but cannot get the volume up/down working. Wired it to D0 and D1 and also tried it to F5 and F6 with no success. I directly wired it to the pro micro though. Do I need resistors?

yes you need resistor.

R = resistor, 10k ohm.
read more:

about volume up/down, I’m not sure how BDN9 firmware read the encoder value, do they use QMK? with QMK, you need a slight delay between registering keyup / keydown. (source:

Yes, the BDN9 uses qmk. Its a macropad by It has 2 rotary encoders that uses the D0 and D1 for the volume control and F5 and F6 for page up and page down.

Turns out my wiring is correct the first time. It was the code. I compiled it just now and it’s working now. I got the previous hex through QMK Configurator.