USB Etch-a-Sketch-Style Mouse Is More Analog Than You’d Think

[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.

We love crazy ideas about saving pins. Once you have an Etch-a-Sketch mouse on your desk, you might as well build a clock to go with it.

15 thoughts on “USB Etch-a-Sketch-Style Mouse Is More Analog Than You’d Think

  1. If you have two quadrature encoders (same thing as 2-bit Gray code), and two pushbuttons, that’s exactly the same inputs as a two-button mouse — you know, the old-fashioned kind with a rubber-coated steel ball. So gut one of those, and you get a preprogrammed MCU that does exactly what you need.

    1. Look at the process, not the end result. If you just wanted an etch-a-sketch mouse, that’d be fine, but (i’m guessing) he wanted to learn how to make this work, and pulling a chip from an old mouse and soldering a couple of encoders to it doesn’t teach you all that much.

    1. The pots are going to limit you to one rotation, or, at best, a maximum number of rotations. The grey-code encoder lets you know position AND direction of movement. That way, you can infinitely move the mouse.

      He converts it to analog for pin-saving purposes.

    2. He is using analog to read the digital which is different than reading a pot. A pot would go, say, 0-5V continuously. His scheme is 00=0V 01=2V 10=3V 11=4V (or something like that, I didn’t go back to look up the actual voltages).

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.