Button Box Matrix Switches and Rotary Encoders

Hello everyone,

So i have an arduino pro micro board with which i planned to build a button box with On/Off and On/Off/On
Switches and Rotary Encoders. (I hope i'm in the correct section of the Forum...)
I use this image as a template for what i want to do: https://i.imgur.com/rLLBpZ2.jpg
Now if i'd use momentary pushbuttons/switches, this layout would work, right? My question is, if i use Switches, that stay in the on position, would this work too? Can i use more than 1 at the same time, or do i have to make another layout/matrix?
What kind of Layout works with (non-momentary) On/Off and On/Off/On Switches and Rotary Encoders?

Thanks in advance
Adrian

Momentary push buttons will work in a matrix for detecting the push of a single button at one time.

Buttons which index on/off will not work like that. In that case you need either a lot of arduino pins or you use a port expander such as the PCF8574 or similar.

I'm not sure what you are going to do about rotary encoders. These usually require 2 dedicated pins and have to be read quite fast.

So i can use a port expander to connect the switches directly and seperately from each other. Can i connect more than 1 port expander to the Pro Micro and how many ports will they require on the Pro Micro? And as i unterstood so far it's better if i connect the rotary encoders directly to the board instead of via the port expander?

With, for example, a port expander of the type PCF8574, you can connect up to 8 to an Arduino Pro Micro. These all share the same I2C bus, so you need only 2 pins (A4 and A5) for them all. There are tricks also if you need to add more port expanders to the same bus.

As to your question about the rotary encoders, say how many and of what type. In the mean time, you can do a Google search on the phrase: arduino multiple rotary encoders

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.

Ops image;

rLLBpZ2.jpg

Thanks.. Tom.. :slight_smile:

rLLBpZ2.jpg

Thank you for your responds. So my rotary encoder's type is "KY-040" and i planned to connect 4 of them. I did a Google search on "arduino multiple rotary encoders" but i really didn't understand a lot because i couldn't find one that isn't that complicated.

And thank you Tom for the advice, i'll note that.

On-off switches will work in a matrix if you put a diode in series with each button or switch. The pushbuttons integrated with those encoders can be wired as part of your matrix also.

But the encoders themselves can be tricky to use, because it can be very easy to miss changes in the signals if they are turned even moderately quickly. Using interrupts may be a good idea with them, but pro micro has only 2 interrupt pins. With this particular type of encoder, you may only need one interrupt pin and one ordinary digital pin per encoder. Maybe using a pin change interrupt library would help, I never tried to connect more than one encoder so far.