do i need a external pull up resitor per button?

I am using a mega 2506. I will be using 16 digital inputs. I will be using exteral pull up resistors of 10K. Do I need a resistor per button (so 16 resistors)? Or can I use 1 resistor to put al the 16 inputs high? what is best practice here?

You can't use one resistor for all, then all pins are just linked. Make a drawing and see for yourself.

But any reason why you don't simply use the internal pull up resistors? Saves you a lot or work :)

you are right about that pins would be linked! stupid of me :-) I would use external resistors because some sources say its better.

bennyvw: you are right about that pins would be linked! stupid of me :-) I would use external resistors because some sources say its better.

Who said that? For something as simple as a button, there's no need for external pull-up/-down resistors, just use the internal ones.

Pieter

It is only better if the internal pull up resistor is not strong enough. That only matters if you are getting problems with consistent readings due to interference pick up. You should not use an external pull up as a first resort unless you have strong suspicions they will not be good enough.

Whether you use an external pullup resistor or not depends on the type of button you have. If its designed to switch high voltage/high current (i.e. 120V/5A) then for sure the minimum load it can switch would be much higher than an internal pullup would provide (at 5V, its only about 0.2 to 0.5 mA).

The switch would require a certain whetting current. Contact material and wiping action play a role as to what this would be. Could be 1-20mA but I’ve seen some switches specify 100mA.

In general, if it isn’t a small tactile button or switch designed for low level signals, an external resistor should be used (may need to go as low as 1K for 5mA). Could alternatively use a 0.1µF (100nF) capacitor across the contacts along with the internal pullup.

EDIT: Other factors that influence whats needed are wiring length and humidity.