Possible damage when using Arduino's internal pull up resistors?

Hello,

I have been reading online that generally an external pull up resistor for an arduino is not neccesary as interal pull up resistors are avaiable. Simple enough, right?

I wonder though, since these resistors seem to be activated via code, and usually during the setup function, isn't there a small chance that one could short out the pin of the putton if they had the button pressed before the setup function had time to run in full?

Also, I am curious if the pull up resistors stay activated after the device powers down.

The internal pullup resistor is very weak, about 50k or so. Therefor in many cases an external pullup resistor is needed.

When the internal pullup is enabled, the Arduino pin changes from input to input + pullup. It will never short to something.

When the device powers down. All the pins have protection diodes to GND and 5V. However those internal protection diodes can only have 1mA. You should have a circuit that does not push too much current into a pin, not even when powered down.

byteofthat:
I wonder though, since these resistors seem to be activated via code, and usually during the setup function, isn't there a small chance that one could short out the pin of the button if they had the button pressed before the setup function had time to run in full?

What do you mean "short out the pin of the button"? On powering up the device, all pins default to inputs (and LOW), so there is no source of current.

The only problem you could have with a button, is to set it as an output and HIGH, in which case you would be grossly overloading the output when you pressed the button. Internal pull-ups are enabled when the pin is set HIGH but set as an input. If you never set it as an output, it will always be an input.

byteofthat:
Also, I am curious if the pull up resistors stay activated after the device powers down.

What do you mean "powers down"? The only "power down" is putting it into sleep mode, and yes, the internal pull-ups (equivalent as I understand, to a 10k resistor) will stay active if they have been enabled.

Paul__B:
What do you mean "powers down"? The only "power down" is putting it into sleep mode, and yes, the internal pull-ups (equivalent as I understand, to a 10k resistor) will stay active if they have been enabled.

As in, when I remove the power from the arduino, and the device turns off. So I guess I mean to say, do these stay active after the device has turned off, meaning that they will be enabled when the device turns on and before any further code is executed.

do these stay active after the device has turned off

No

byteofthat:
As in, when I remove the power from the arduino, and the device turns off. So I guess I mean to say, do these stay active after the device has turned off, meaning that they will be enabled when the device turns on and before any further code is executed.

That's why I explained:

Paul__B:
On powering up the device, all pins default to inputs (and LOW),

You turn the power off, it turns off. You turn the power on, it starts afresh.

jremington:

do these stay active after the device has turned off

No

They are really MOSFETs anyway, which happen to have lots of resistance, because in a
VLSI device real resistors are far larger than FETs with long channels. They are spec'd
as between 20k and 50k, so cannot carry enough current to damage anything.