Interface a rotary encoder with Atmel AVR (interrupt style)

When I wanted to gently interface an incremental rotary encoder with an 8-bit Atmel AVR microcontroller, I couldn’t find a nice example. That’s why I wrote this little text. Many other howtos, manuals and descriptions are fuzzy, incomplete or too complicated to do the (easy) job.

This article describes three things: the hardware (just the minimal hardware) and two pieces of code. The first is just a simple interrupt based program and the other uses timers to make bigger steps when you turn faster.

I use Atmel AVR studio as IDE and the Through hole USBprog to program the microcontroller.

Continue reading