protection for external input?

i want to expose a digital pin input as an external jack connection

the digital pin has its internal pullup to 5v so it will detect a signal when grounded. This may come from a mechanical switch shorting the jack's tip to ground, or an applied voltage at tip (from another device)

i am already placing a 1k resistor for current protection, a 5v1 zener diode for voltage protection.

I am wondering about the situation when a 5v is applied at this input, and the chip is unpowered. Does it also needs some kind of protection? In that case, i think a bjt transistor as a buffer would keep the pin safe?

please comment on protection for damages in this situations


From data sheet processor can handle voltage on any Pin except RESET
with respect to Ground …-0.5V to VCC+0.5V

Instead of using a 5v zener you could use the ancient tradition of diode clamp to VCC and GND. Most folks use a standard diode like 1N4148 whihc you can get anywhere, but the forward voltage drop could slightly overstress the IO pin.

The forward voltage of diode will be low enough if you use Schottky such as 1N5817 which stays under 0.5 v all the way up to 1amp. Your 1k resistor would drop 1000V and break down before that. A smaller diode like BAT46 would keep the drop to 0.41 V up to 10 mA which would be 10V on the other side of your 1k resistor. The 1N5817 and BAT46 are available from DigiKey.

In reality your limiting resistor alone is probably sufficient as the IO pin will break down and conduct at about 0.5 v beyond either rail. As long as the current is limited to a few mA its not gonna permanently damage the IO pin.

To be even safer with no diodes at all, just increase the resistors. The internal pullup IIRC is about 20k but you could disable that in software and use an external pullup as high as 1Meg.

Input Leakage
Current I/O Pin
VCC = 5.5V, pin low
(absolute value)
1 [ch956]A
Input Leakage
Current I/O Pin
VCC = 5.5V, pin high
(absolute value)
1 [ch956]A

With the rated leakage your 1 Meg pullup would get the input up to at least 4v when open. You could now use a series resistor of 100k to your jack, which you could probably connect directly to 120v wall socket without damage.

Funny story, on first job was given a data bus receiver built with 5 op amps, designed by the resident ubergeek. The boss was quite happy when I showed him my breadboard version using only 3 op amps. It had 100k resistors in series with inputs and 1N4148 clamps to the rails. In those days analog rails were +15V and -15V. The boss came back later and said someone (the ubergeek) complained my design had not enough input protection. I looked silently down at the breadboard a minute then took a chance. I pulled the pins for data input out of the data source and poked them into a power socket on the bench. The boss gasped. I wiggled the pins around in the power socket, then reversed the polarity and wiggled them around some more. Then I poked the pins back into the data source and (to my relief) data began to flow again. The boss grinned and left me in peace.

I’m NOT suggesting you put 120 VAC thru a 100k resistor to your Arduino, but it would “probably” survive. Just saying that simple circuit protection can be quite effective.

Good luck with your project !

My experience is that the processor will RUN if you apply 5v to a pin on an otherwise unpowered atmega. I haven't seen this do any harm but it's hardly ever what I want!

Interesting, thanks bill2009 !

Actually, the data sheet in section 13.1 does show the internal protection diodes, the ATmega's low power requirement must allow it to run off one of these.

Wouldnt work with a Pentium, tho... ;D