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 most microcontroller circuits found on the internet shared by hobbyists, you don’t find any input protection. Some argue that this is not needed or don’t understand in most cases how it works. Let’s see how a 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 the AVR datasheet, the gate control voltage should stay within the -0.5V to VCC+0.5V range. If we power our device with a 5V supply, we need to ensure that the pin input voltage stays in the range of -0.5 to 5.5V. When the input voltage source is taken from the same power supply, we don’t have to worry much about it. But what if AVR is accepting digital signals from other sources like sensors, other devices powered by 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…