Reading a button array with 3 analog pins (PCB design assistance)

I've seen this done before and to save pins on the wearable computer I decided to try it.

PCB design pros: Is anything wrong with this? Are my traces too noisy or too long? (You're looking at the green lines going to I/O pins 1, 2, and 3.)

Electrical engineers: Are the internal resistances of the buttons going to cause any issues when doing an analogRead() on them?

The extra mounting holes are for a rotary encoder and a joystick that I didn't feel like integrating into the PCB.

EDIT - I just realized how low-res this picture is. I/O pins 1, 2, and 3 are the top 3 pins on the I/O header. 3 is at the top, and it counts down to 1. Below that is GND and the bottom pin is VCC to power this board. The grey text above some mounting holes is there because of a settings error.

I wouldn't worry about the noise since you are almost at DC. But I am concerned with the buttons. First, what buttons are you using? All of the (inexpensive) square buttons I've seen connect diagonally. Also, it looks like you have traces going through the holes for the buttons.

I'm just using 6mm pushbuttons. They connect like this:
Push Button/Tactile Switch Pinout Connections, Uses, Dimensions & Datasheet

And yes, I have traces going through the THT holes because I want the buttons all connected in a row.

EDIT - I want everything hooked up like this but without one column:

...and then converted to this for analog "multiplexing":

No, the diagonal thing is for those who can't remember (and don't want to lookup or check) which pins are commoned!!

1 Like

I trace mine diagonally so that the orientation doesn't matter.

1 Like

That will depend on the quality of the buttons.

Since you do not anticipate detecting multipl button presses, why choose three analog inputs rather than one?

1 Like

I switched to Kailh Pro mechanical switches in the final design so I think that issue has been solved.

EDIT - As for the second thing, it's because someone already wrote code and there's less likelihood of error (IMO).

That's what the doubled pins are for, it's called feedthrough.

As you already have the code, why not just try it?

The Kailhs don't have those...

It costs me money (which I don't have much of) and JLCPCB shipping takes >2 weeks. We are moving soon so I have to wait until we are established to ship it.

That means that I have a lot of time to revise the board to make sure it works.

Why are the traces so thin ?

I’ll bet you have room for 35 to 50 mil traces.

They are just logic lines. Maybe I'll beef up the 5V and GND lines though.

Thicker traces are more robust, especially when it comes to people new to electronics/soldering.

True. I'll make them 0.4mm or something.

Why .4mm ?

Use 50mil and make the thru holes for the switches 80mil.

1 Like


If you used a $3.00 IR remote then all you need is one Arduino pin.

A laminated overlay with numbers can be attached to the top.


Or a 44 button remote :astonished:


Fully aware. But I want my mechanical key switches and hacking those onto an IR remote sounds like a giant pain.

No, it is really simple.

Both remotes are NEC.

Remotes switches are snap action.


//17 button Keypad
const byte buttonCode[18] = {
  0x43,0x15,0x00, //0X00 is not defined
}; //END of buttonCode Array

const byte ASCIIcode[18] = {
  // ^    <   New line  
  // >    v  nul 
  // 1    2    3 
  // 4    5    6 
  // 7    8    9 
  // *    0    # 
}; //END of ASCIIcode Array