Arduino wiring for a button box

I'm very new to Arduino's and still learning the basics. I am planning to build a button box for a flight simulator. I have attached a picture of the wiring diagram. I am not sure if this will work or not. The switches are wired in a 5x5 matrix with the 2 columns going to digital input 2 and 3. The five rows are going to analog inputs A0 A1 A2 A3 A4. The two rotary switches have one connecting wire going to ground and another 5 digital input connections per switch. Do I still need to ground the switches or will this layout work ?

I think it will work as long as you don't have more than two toggle switches on at a time. For example, if the 1st and 3rd switches on one row are both closed, closing either the first or third switch in the other row would act like both were closed. You can fix that by putting diodes in series with each switch.

You can save a bunch of pins by treating the two 5-way switches as just two more rows of the matrix (4x5 instead of 2x5). That would free up pins 6 through 13 (using 4 and 5 for the two new 'rows').

Thanks a lot for your reply. So the rotary switch would have connection 1 (out of the 5 connections) going to digital output 4 and the other 4 positions would go to 4 different analog outputs and the same with the second rotary switch ?

Take care when you move the rotary switch from position to position, there is a gap between each position where there is NO connection.

You need diodes, but each rotary switch requires only one diode in the common. :grin:

Your diagram shows 6 connections to each switch. The COMMON pin, instead of going to Ground, goes to an Arduino pin. The five positions go to the five columns of your matrix.

Thank you that clears all my confusions.

This saved me a lot of time. Thanks.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.