How many press buttons possible on Arduino?

Hi,
does anyone know how many press buttons can be connected and served with an Arduino?
I would like to use up to 20 to switch on and off an equal number of leds.
I am new to Arduino and Raspberry Pi and trying to determine which system is more suitable for my purpose. Hence my question to the experts..

Thank you + Regards

The Mega 2560 has 54 digital pins, whereas 15 supports PWM (Pulse Width Modulation), and 16 analog input pins, the most of any Arduino board

Which Arduino?

No problem with a Mega.

You could potentially service hundreds of button inputs using an Arduino with additional external hardware such as shift registers and hundreds of WS2812 LEDs would only require a single pin to control them

How many buttons do you envisage using in practice ?

I'm not familiar with a Pi so can't advise if it's suitable or not. An Arduino can easily do it.

Buttons can be arranged in a matrix so you only need 5x4 pins. Same for the LEDs. Be aware of current limitations of the processor.

Other solutions can involve port expanders (I2C or SPI) and shift registers (TPIC6B595 comes to mind to drive the LEDs).

Note that an Arduino is not a power supply; drawing 400mA from the 5V (20 LEDs at 20mA) is too much, definitely if you power it Via Vin or barrel).

You can use a matrix layout if you run out of pins.

For 20 buttons, 9 pins should suffice.

You can use 1 Arduino pin to decode 44 remote push buttons too, let your imagination run.

image

image

Hi,
It is also possible to use 20 buttons on a single pin.
Use an analog pin and build a resistor ladder.

I've connected a PS/2 keyboard to an Arduino. That's about 104 buttons...

A piece of cake, with the Keypad library for example. If they are toggle switches you need to add diodes to the switch matrix.

... or maybe use 1 button to control up to 225 LEDs

That will really depend on factors other than the keys it can support..

Hi, @jacktherabbit
Welcome to the forum.

Will you be pressing the buttons one a a time, or in combinations at once?

Port expanders could also be another solution.

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

Hi TomGeorge,
sorry for the late reply. The parts for my experiment arrived today.
The button pressing is one at a time only.
I will see if my board gets into trouble when connecting those buttons...

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