Keypad_Matrix
Keypad_Matrix copied to clipboard
Encoders In Matrix
Hi Nick,
Thanks for putting this out there. I'm just learning about using a matrix for inputs while I build custom Sim Racing wheels and button boxes. I personally HATE matrix wiring large arrays of buttons especially for prototyping where you might have to change or move buttons around. So I learned Kicad and prototyped a 6x6 button matrix breakout board with diodes.
It seems to work well with your code. My next goal is to allow Rotary Encoders to be put on the matrix. Right now most arduino button box implementation require 2 pins per rotary encoder. So 5 encoders take up 10 pins.
I've searched around and it definitely seems possible to get encoders working in a matrix. There's a board made by a company called Leo Bodnar that supports it as well as a number of diy keyboard firmware builders like QMK. I'd like to do a lot of other things not supported by these so they don't suit my needs.
But I believe both work by putting the common of the encoders on rows, and the A/B signals each on a column. In this way a Rotary Encoder takes the place of 2 buttons.
During the matrix scan the buttons are read, skipping those noted as encoders. Then a second scan is done to get the state of the encoders and do the necessary state table logic to determine if they have moved clockwise or ccw.
But that's about as far as my limited knowledge has taken me. I've started looking through your code and it's a bit over my head but I'd like to add the encoder functionality.
If you had any ideas or guidance I'd appreciate it.
Thanks, Brian