[Mitxela] wanted to build a different kind of mouse, one that worked like an Etch-a-Sketch toy with one X knob and one Y knob. Armed with some rotary encoders and a microcontroller, that shouldn’t be hard. But when you use a pin-limited ATtiny85, you are going to need some tricks.
The encoders put out a two-bit Gray code and close a button when you depress them. Plus you need some pins for the V-USB stack to handle the USB interface. [Mitxela] decided to convert the encoders to output analog voltages using a simple resistor DAC. That would only require two analog inputs, and another anlaog input could read both switches.
One problem: there still wasn’t quite enough I/O. Of course, with AVRs you can always repurpose the reset pin as an analog pin, but you lose the ability to program the device at low voltage. And naturally, there’s a workaround for this too, allowing you to keep the reset pin and still read its analog value. You just have to make sure that value doesn’t go below about 2.5V so the device stays out of reset. Once that was in place, the rest went easy, as you can see in the video below.
A LASER-cut enclosure and knobs finishes the project off nicely. Honestly, we might have been tempted to just get a bigger CPU, but we have to admit this works. If it were a commercial project, we might be a bit worried about reducing noise immunity on the reset pin, but for a hacker project it works and it is a clever use of pins.