dfejza.com
All builds
Embedded

USB HID Input Automator

WIP· pre-alpha

Hardware modification on a Seeed Studio XIAO RP2040: the microcontroller wires directly to a mouse's switch contacts and emits clicks at randomised intervals — exploring USB HID timing, hardware-level event injection, and CircuitPython on RP2040.

CircuitPythonRP2040USB HIDHardware

AI-generated: this write-up was drafted by AI from the project's source code and may contain inaccuracies.

The USB HID Input Automator is a hardware modification on a Seeed Studio XIAO RP2040: instead of synthesising a virtual mouse over USB, the microcontroller is soldered directly to the switch contacts of a physical mouse and shorts them at randomised intervals, producing real clicks indistinguishable from a finger press. It is an in-progress learning project — a deliberately small build for understanding USB HID descriptors, hardware-level event injection, and embedded power management on the RP2040, not a finished product.

How it works

The two approaches to automating a click are emitting a USB HID report from a virtual device, or driving the host's real input hardware. This build takes the second route. The XIAO RP2040 is wired across the mouse's button switch contacts; toggling a GPIO line closes the same circuit the physical button does, so the click reaches the host through the mouse's own controller rather than as a separately enumerated HID device. An internal LiPo cell powers the board so it does not depend on the host for power.

  XIAO RP2040 (CircuitPython)

        │ GPIO toggles switch contact

  Mouse switch contacts ──► mouse controller ──► host (real HID click)
 
  internal LiPo ──► XIAO RP2040 (self-powered)

Timing

Clicks fire at randomised intervals rather than on a fixed schedule, so the cadence does not form an obvious periodic pattern. The intervals come from a PRNG seeded from analog floor noise — sampling the noise floor of an analog input gives a non-deterministic seed at startup, instead of relying on a fixed constant.

Status

This is prealpha and a work in progress. The intent is the learning, not a shippable tool: getting hands-on with USB HID descriptors, the mechanics of injecting input at the hardware layer, and running off an internal battery with CircuitPython on the RP2040. Treat it as a notebook entry on those topics rather than a maintained project.