On day to day basis I'm more of a high level programmer, with little electronics knowledge, apologies in advance if I lack some nomenclature or basics. I communicate with my Arduino Mega via firmata, so won't really bother with code as I believe my issue is 100% hardware issue (if proven wrong I'll share details surely)

I'm creating a 'keyboard' with 60 arcade style push buttons (2pin), and I distinguish them by different resistance when circuit closes with A0-A9 (10 analog pins, 6 buttons each), and I need the rest of the pins for other functionalities.

I've created a circuit similar to this fritzting schema: enter image description here

So my issue is: when press button A0/button 1, pins A1 & A2 also read the same value. If I press A0/button 2, I get a different value and can determine which button in A0 was pressed, but again - A1 & A2 also read this, even though I didn't press them.

I suspect I might've taken a different approach or even out of the box "keyboard" chips, but this is the route I've taken.

enter image description here

How do I make it so when I press A0/button 1, A1/A2 doesn't read the value? Do I need separate V5? Or I simply need to put the wires differently somehow?

Update: as per chrisl comment

I've updated the circuit by adding a resistor for each button group:

enter image description here

And that has solved my issue.

  • why are you using analog inputs?
    – jsotola
    Commented Oct 14, 2022 at 20:31
  • To be able to use a single pin for multiple button press detection, and I do it so by reading analog value. Each button will show different value upon press because it has a different amount of resistors. Overall very similar to this: youtube.com/watch?v=Y23vMfynUJ0&ab_channel=MichaelKlements
    – wopolow
    Commented Oct 14, 2022 at 20:41
  • your approach does not allow multiple buttons to be pressed simultaneously
    – jsotola
    Commented Oct 14, 2022 at 20:43
  • yes, I'm aware of that caveat but this is not a concern for me, I don't really need this functionality
    – wopolow
    Commented Oct 14, 2022 at 20:46

1 Answer 1


Of course all three analog inputs show the same value. You have literally connected them to each other. Each green wire is connected to a red wire, which leads to the resistor at the bottom. Thus all three inputs are tied together.

You can fix this by using one bottom resistor for each group of 2 buttons, each connected between 5V and the analog input/button system.

And when using analog inputs for multiple buttons the binary resistor latter is an interesting concept, which might give you more buttons per analog input (depending on the noise in your environment). Though the typical way to read so many buttons would be using an additional chip/microcontroller to scan the buttons in a matrix style arrangement. With your current circuit you still need 30 analog inputs.

  • I'll try to add a resistor between each analog input and 5v as suggested - thanks! This is where my lack of knowledge peaks. Will come back later and update. The fritzting circuit is simplified - I have 6 buttons connected to each analog input, and I'm using 10 of those - so I would expect to cover 60 (10x6)? Or is that not the case? And thanks for sharing the usual go-to way of handling those kind of challenges.
    – wopolow
    Commented Oct 14, 2022 at 18:51
  • I've updated my answer with the latest fritzting / source file as well. I pontetially missed the point or have some other issue, but even with resistor in between each of A0-A2 and 5V the result is still the same. Appreciate your time nonetheless.
    – wopolow
    Commented Oct 14, 2022 at 20:05
  • @wopolow Your circuit looks correct, except for the rightmost two buttons. They aren't connected as the others. Are you sure, that your real life circuit is correct? And have you tested if measuring on analog input via firmata works as expected? You could use a multimeter to test the voltage on each analog input manually to check, if the circuit works as expected. Maybe it would be good to first build a test circuit on a breadboard instead of directly going to the real project setup.
    – chrisl
    Commented Oct 14, 2022 at 21:16
  • Thanks, I did, I just failed at execution on a later stage. Having separate resistors was the answer to my question. Thank you sir.
    – wopolow
    Commented Oct 15, 2022 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.