WorkerMouse

February 2, 2024

An AVR project for a simple DIY mouse jiggler, using a minimal number of parts and simple software.

WorkerMouse

About

The WorkerMouse was a project I did as an exercise in learning about USB and HID devices. It is a Mouse Jiggler that pretends to be a legitimate USB device.

Hardware

I began with an ESP32-S2 but quickly realized it was overkill for creating a simple mouse. I’m very familiar with the ATtiny85, but it doesn’t have a hardware USB peripheral. Luckily, I was able to stand on the shoulders of giants — the V-USB project was built to run on AVR MCUs. This software-only USB implementation allows the ATtiny85 to act as a low-speed USB 1.1 device, which is perfectly adequate for a HID mouse.

The V-USB site is also a treasure trove of information for building simple USB devices. It includes dozens of reference projects with both hardware and software documentation. The HIDKeys example was a perfect reference for the hardware side of this project, especially when combined with the Hardware section of their overview page.

Software

The software is open source and available at github.com/zbauman3/WorkerMouse.

With the hardware design and USB driver settled, all I needed to do was write some software to periodically move the mouse. I chose to write it using the AVR Toolchain (v3.7.0), which relies on the excellent avr-libc (v2.0.0). I took this approach as an exploration into using the toolchain developed by the hardware manufacturer, rather than a third-party abstraction like Arduino.

I wanted the mouse movements to feel somewhat realistic — mostly just for fun. This meant the only software I needed to write was a timer to periodically move the mouse, use a pseudo-random number generator to pick movement amounts and speeds, and a USB report generator. Altogether, that’s less than 200 lines of code (not including the USB device configuration such as name, VID/PID, etc).

Once the project was complete, I decided to explore officially registering the USB device. Since I didn’t want to pay the $6,000 required by the USB-IF to acquire my own Vendor ID, I went with pid.codes. They own the Vendor ID 1209 and allow any open-source project to register a Product ID under it. I registered the WorkerMouse as VID 1209, PID F480.

All in, the software ended up being 2636 bytes of ROM and 89 bytes of RAM.

Media

The assembled device
Top view of the circuit board
Bottom view of the circuit board
Side view of the circuit board
The KiCad schematic

Parts List

Downloads

3D Models

I used PETG for the case, and separate colors for the lettering / case. This was the video I followed for using two colors with one toolhead: https://www.youtube.com/watch?v=zk1vKVphE1M.

If you'd rather not use two colors, you can simply omit the letter models and the letters will be debossed.

Compiled Firmware

The compiled firmware can be downloaded from the Github repo at /firmware/compiled.