# AVR ATMega I/O pin overcurrent protection

I want protect I/O pin against overcurrent to make circuit more robust. Atmel's AVR040: EMC Design Considerations discusses internal overvoltage protection in General I/O Pin Protection paragraph. But I need protect case when a IC output pin is connected to a particular MCU and the MCU pin is configured unintentionally as output too because of firmware bug. And both pins are forced sometimes to opposite logic level.

Similar case when MCU pin is connected to a tactile button and pin is output at 5V.

Simple solution is adding simple serial resistor between these pins. Is it needed or MCU/IC should survive without protection?

Have a look here, page 303. It seems that Atmel does not include a short circuit protection in its I/O pins, so a protection might be needed.

In the case of another MCU you might avoid using resistors, but that would depend on the MCU and on your luck. With a button you need a resistor indeed, so here is how to calculate it.

On the same table you see various parameters such $V_{OH}$ and $V_{OL}$. They are the minimum guaranteed voltages when output is high, and the maximum when output is low. I would assume conservatively full output swing, i.e. you are connecting $V_{CC}$ to ground. Assuming 40mA is the maximum current your chip is capable of delivering you get: $$R_{min}=\frac{V_{CC}}{I_{max}}=125\Omega$$ for 5V and 40mA. Of course you can stick a bigger resistor and sleep safer nights, but why shouldn't you throw in some M$\Omega$s? That's because of speed. All pins have an input capacitance $C_{in}$, the time constant of the communication line is approximately $R\cdot C_{in}$ where R is the chosen protection resistor. If you need high speed communication you better keep that time costant as low as possible, you'd like something $R\cdot C_{in}<\frac{1}{10\omega}$ where $\omega=2\pi f$ and f is the frequency of the communication channel.

I'd go with $1\text{k}\Omega$ and play it safe.

• Is 10*f an arbitrary value? Also, what is typical input capacitance to a given IC, or does this parameter vary widely? I say this because I imagine designers which to keep this parameter particularly low during design, or are there some weird applications? Also, from where does this parasitic input capacitance arise? Jul 19 '14 at 19:07
• 10f is to keep the pole associated with that RC a decade after the highest frequency you want to see. that's pretty conservative. input capacitance may vary widely but for same kind of IC's it usually stays quite the same (read some datasheets). Yes, the lower the better, unless you are building a capacitor. You should ask a question about that, I'm not sure. They arise from various elements: pins, wires, input mos gates, protection diodes that are reverse biased... That's not something you can explore in a comment. Jul 19 '14 at 19:10
• Thanks you confirmed my suspicion. AFAIK 1k is used at Arduino board between 16u2 and 2560 MCUs on serial line. I'm going to use 150ohm not to demage edges too much.
– TMa
Jul 19 '14 at 19:55
• 1k5 is fair enough, input capacitance is in the range of 10s of pF so you get a frequency cap of about 10MHz Jul 19 '14 at 20:08

get smd resettable fuses, 10ma 5v Simplest answer of all to this question, if you can spend 11\$ per pin protection.

best is before putting in the ʯcont. just take multimeter and do a good inspection

• though they can be really hard to find
– Raj
Feb 2 '16 at 14:19