Using current limiting resistors on AVR I/O pins

Today I want to talk about protecting digital Inputs of AVR or any other microcontroller from over-voltages. When you look at majority microcontroller circuits found on internet shared by the hobbyists you don’t find any input protection, some argue that in most cases this is not needed, or don’t understand how it works. Let’s see how simple resistor can save the day. Lets see at simplified version of digital input of AVR microcontroller. We can see there that input uses CMOS logic where the transistor is switched by voltage. According to AVR datasheet, the gate control voltage should stay within -0.5V to VCC+0.5V range. If we power our device with a 5V supply, we need to make sure that the pin input voltage stays in the range -0.5 to 5.5V. When the input voltage source is taken from the same power supply, then we don’t have to worry much about it. But what if AVR is accepting digital signals from other sources like sensors, other devices that are powered with their power supplies. Can we be sure that voltage will always be within safe limits? This is why there are two clamping diodes (sometimes called ESD protection diodes) used. They…

Continue reading