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…

Continue reading

IR remote control signal receiver using AVR microcontroller

IR remote control is a device you can find everywhere to find a TV, VCR, or home theatre. Why not use one of them for controlling your own devices like light, air conditioning, etc. As we know, remote control devices use IR light. This is invisible light of about 950nm wavelength. One most significant problem in using IR light is that there many other sources of it like the sun, light bulbs, fire. To exclude other sources, the IR signal is modulated by some frequency. The receiver has to be tuned for this frequency. Mostly remote controls transmit IR signals using 36kHz frequency signals. Transmitting and coding is one part that can be done more efficiently than receiving and decoding. Decoding is usually performed by using microcontrollers. First of all, the receiver has to get rid of the 36kHz carrier frequency. This is not a simple task to demodulate the signal; this is why particular IR receiver IC’s are produced. One of them is TSOP1736:

Continue reading