20-30 digital buttons on one board

Hi everyone,

I have made a project by using an arduino board and an ethernet shield. Its working well except that I need about 20-30 buttons connected to the board.

What is the best way to solve this problem? I have tried to look at shift registers but mostly have come across where they are used to control leds in tandom.

Any help would be much appreciated.

Thanks.

Have a look at the 74HC4067, a 16 channel multiplexer/demultiplexer. You'll need 6 pins on your Arduino (and a transistor) to drive 2 of them, giving you 32 inputs.

4 pins for the address
1 pin for chip select (using the transistor to invert to one enable pin & non-invert to the other enable pin.)
1 pin for input

Four 74165 parelell in srerial out shift registers daisy chained together will interface 32 switches using 3 pins. Latch the switch states and use shiftIn() to read the registers.

any pros and cons between using the 74HC4067 vs the 74165 approach mentioned above.

also are there any examples available for me to get a better understanding.

thanks.

rm65453:
any pros and cons between using the 74HC4067 vs the 74165 approach mentioned above.

Well, the 74HC165 x 4 (note: incorrectly quoted without the essential "HC") uses fewer pins on the Arduino, is simpler to program and probably cheaper, but requires four resistor arrays as pull-ups while the 74HC4067 requires only one resistor - or none if you use the internal pull-up on the Arduino. Resistors are trivial; go for the 74HC165.

ok, going to give this a shot today.

any tutorials that you think might help me understand the concept as I proceed ahead?

correct me if I am wrong http://i1217.photobucket.com/albums/dd396/womarts/20120111085034.jpg would this setup work? I dont think the pins on the mega would be connect to the internet.

any tutorials that you think might help me understand the concept as I proceed ahead?

You could get a Mega with 54 GPIO pins. No tutorials needed...

Once made a keypad with the TI-TCA8418-QFN keypad scanner.
Connect it with the I2C protocol and an interrupt.

Worked like a charm and can connect up to 64 buttons (8 rows X 8 columns).

PaulS:

any tutorials that you think might help me understand the concept as I proceed ahead?

You could get a Mega with 54 GPIO pins. No tutorials needed...

I have an Ethernet shield connected, so that is not an option unfortunately.

I have an Ethernet shield connected, so that is not an option unfortunately.

Why not? I have an Ethernet shield connected to a Mega. Works just fine. Still leaves 30+ pins free.

If you just need to press one button at a time(no two key roll over) you can use the extended charlieplexing. 25 buttons require 5 pins and 10 cheap diodes. The coding is a little bit more tricky but it should be possible if you give you some time to study this example: Extended Charlieplexing - LEDs and Multiplexing - Arduino Forum

PaulS:

I have an Ethernet shield connected, so that is not an option unfortunately.

Why not? I have an Ethernet shield connected to a Mega. Works just fine. Still leaves 30+ pins free.

would this setup work? http://i1217.photobucket.com/albums/dd396/womarts/20120111085034.jpg I was thinking that the pins on the mega would not be connected to the internet?

Can't use this method? - Scotty

would this setup work?

Does your Ethernet shield have the 6 pin ICSP connector on the bottom? If so, yes.

PaulS:

would this setup work?

Does your Ethernet shield have the 6 pin ICSP connector on the bottom? If so, yes.

If you mean like the one shown in the attached picture then yes.

If you mean like the one shown in the attached picture then yes.

I do. Your Ethernet shield will work just fine on a Mega.

PaulS:

If you mean like the one shown in the attached picture then yes.

I do. Your Ethernet shield will work just fine on a Mega.

Awesome. ordering one right now.

And all this time I thought that once you connect the ethernet shield the pins on the main board are rendered unusable.

Thanks for clarifying that for me.

So I do not have to do anything special to access those extra pins right? I am sending an http request with each push button.

I am sending an http request with each push button.

I can't imagine why you'd need 20 to 30 different requests, but it's not my project.

And all this time I thought that once you connect the ethernet shield the pins on the main board are rendered unusable.

Only the ones that the shield actually uses.

PaulS:

I am sending an http request with each push button.

I can't imagine why you'd need 20 to 30 different requests, but it's not my project.

And all this time I thought that once you connect the ethernet shield the pins on the main board are rendered unusable.

Only the ones that the shield actually uses.

Is there a better way to make it utilize less buttons? Am sure you may have a leaner solution.

Thanks

Is there a better way to make it utilize less buttons? Am sure you may have a leaner solution.

My first, somewhat smart-ass answer, was going to be chords. Of course, that would have probably confused you, so I won't do that.

Instead, I'll ask YOU to explain the purpose of the project.