# Protecting Inputs in Digital Electronics

Calculating the value of the current limiting resistor connected to GND when switch is pressed.(1k resistor in the schematic)
One important considerations about the wire is its longer than 25 cms and about a foot long. How RC must be calculated such that:
a) High resistance but strong enough such that arduino reads a LOW on the pin
b) Internal INPUT_PULLUP is used
c) High voltages spikes in case of shortening of wires arduino don't kill it. Burns out yet saves the arduino. ( No space for schhottky or TVS and the probability of HOT wire touching the input wire isn't high)
d) Wire length is in and around 30cms.
e) It's not a push button switch. So its says connected to ground until pressed again to pull it back up.
Is current through a 1M ohm resistor (5/1000000)=5uA read as Ground? And adding a 100nF cap or a 1nF cap sufficient for decoupling?

I think you're overthinking things (for a simple switch on a 30cm wire).
Digital inputs of an MCU have 0.3/0.6*VCC switch points.
Things (local interference) have to get really bad before upsetting the MCU.
Just use the internal pullup resistor with pinMode(INPUT_PULLUP), and connect the switch between pin and ground.
Use shielded wire in a "dirty" environment.
Protection, like you have drawn, could be needed if you feed e.g. a voltage into the MCU.
You

There is a long and involved SAE standard on this for automotive use. That's pretty much the most extreme fault conditions you're likely to see in most Arduino projects.

It seems like you've done a good job of enumerating the faults and the protections for each of those faults.

I like to put a BAT54S diode pair on each of my inputs, but that really doesn't do much more than what the internal diodes already do.

If you are protecting from really high voltage, such as lightning strikes, then you really can't do much more than make sure the rest of the box doesn't burn when the protection circuit operates. But some careful design will allow you to take care of near-hits.

In short, it depends upon your environment which you have not told us about.

Wawa:
I think you're overthinking things (for a simple switch on a 30cm wire).
Digital inputs of an MCU have 0.3/0.6*VCC switch points.
Things (local interference) have to get really bad before upsetting the MCU.

Anything that makes sparks, like an internal combustion engine or brushed motor, is going to splatter EMI all over the place. They are nasty.