Electronic – arduino – AVR ATMega I/O pin overcurrent protection

arduinoatmegaavrprotection

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?

Best Answer

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.