Multiple encoders with ATmega

I want to build MIDI controller something like KORG nanoKey Studio, probably smaller. That means I have to use multiple encoders in this project.

There is no relayable way of reading values from encoders connected directly to GPIO. Best is tu use interrupts, but AVR disables interrupts when ISR is working so it may lose some pulses when rotating few at once.  I know, that shouldn't be issue in such device, but also I do not want to sue so many pins...

I figured out, that I could use ATtiny45 as encoder interrupt. They are perfect for tasks like that. Unfortunately they do not have I2C, so I decidet to use serial communication + chip enalbe line.
Schematic from PaintCAD:
I could send some command through serial to get data only from specified ATtiny, but I wanted simplest solution: when certain's ATtiny CE line is going low it sends value. Voila.

Too many GPIO needed! Continuation with pure serial comunication.
I based on sketch from Wandering Engineer's blog. I optimised it for my requirements (and may be I'll try setup based ony on serial: no CE).
My code's here, on github.
You'll need to add ATtiny to Arduino IDE's boards here's github page of suitable project and manual.

Comments