Drive LED or Opto-isolators with AVR

This might seem very simple to many of you, but I still get questions about simple microcontroller interfacing. So I will put a thread of notes about interfacing AVR microcontrollers to devices like LED’s, relays, I2C, etc. As you might know, Diodes require a pretty small current. This current depends on diode type and can be from 3mA up to 20mA and more. Working voltage is from 1.5 to 4V. One AVR pin can sink up to 20mA of current; it is convenient to connect the diode directly to it with a current limiting resistor. Never connect the diode to the pin without a resistor – you may damage your AVR as your current may exceed the 20mA limit!

Continue reading