- Python 64.1%
- C++ 35.9%
|
|
||
|---|---|---|
| mouse_jiggler | ||
| patch_usb.py | ||
| README.md | ||
Digispark Mouse Jiggler
Keeps your computer awake by simulating natural human mouse movement.
No clicks. No keyboard input. Identified by the OS as a PixArt USB Optical Mouse.
Original concept and code: James Franklin for Air-Gap (2019)
Human-like movement rewrite: Bézier curves, state machine, easing (2026)
What you need
- A Digispark ATtiny85 USB dongle (~$2–5)
- A Mac running macOS on Apple Silicon (M1 or later) — these instructions cover that setup
Step 1 — Install dependencies (Apple Silicon Macs)
The Digispark toolchain (avr-gcc, micronucleus) is made of Intel (x86_64) binaries.
Even with a native ARM Arduino IDE, two things are required:
- Rosetta 2 — to run Intel binaries on Apple Silicon
- libusb-compat x86_64 — the upload tool
micronucleusdynamically links to it and needs the Intel version specifically
Installing
libusb-compatvia the standard ARM Homebrew (/opt/homebrew) won't work — it produces an ARM64 library, whichmicronucleus(x86_64) refuses to load. You need the Intel Homebrew (/usr/local) to get the right architecture.
Open Terminal and run:
# Rosetta 2 — lets Intel binaries run on Apple Silicon
softwareupdate --install-rosetta --agree-to-license
# Intel Homebrew — installs to /usr/local and produces x86_64 binaries
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install libusb-compat in x86_64 via Intel Homebrew
# This places libusb-0.1.4.dylib exactly where micronucleus expects it
arch -x86_64 /usr/local/bin/brew install libusb-compat
The Intel Homebrew installation takes a few minutes and will ask for your password. It coexists without conflict alongside the ARM Homebrew in /opt/homebrew.
Step 2 — Install Arduino IDE
- Go to arduino.cc/en/software
- Download Arduino IDE 2 — choose macOS (Apple Silicon)
The filename should bearduino-ide_x.x.x_macOS_arm64.dmg - Open the
.dmg, drag the app to Applications - Launch Arduino IDE
Step 3 — Add the Digistump board package
- Open Arduino IDE → Preferences (
Cmd + ,) - Find the field "Additional boards manager URLs"
- Clear the field entirely, then paste this URL
(digistump.com is defunct — this is the actively maintained fork):https://raw.githubusercontent.com/ArminJo/DigistumpArduino/master/package_digistump_index.json - Click OK
Step 4 — Install Digistump AVR Boards
- Go to Tools → Board → Boards Manager
- Search for Digistump
- Install Digistump AVR Boards
- Wait for installation to complete, then close Arduino IDE
Step 5 — Patch the USB identifiers
This makes the dongle identify as a Logitech M100 instead of a generic Digispark.
Run this once after step 4, from a Terminal in this project folder:
python3 patch_usb.py
Expected output:
Found: /Users/.../digistump/.../usbconfig.h
Backup: /Users/.../usbconfig.h.bak
patched: USB_CFG_VENDOR_ID
patched: USB_CFG_DEVICE_ID
patched: USB_CFG_VENDOR_NAME
patched: USB_CFG_VENDOR_NAME_LEN
patched: USB_CFG_DEVICE_NAME
patched: USB_CFG_DEVICE_NAME_LEN
Done — 6 substitutions applied.
Restart Arduino IDE before uploading the sketch.
The original
usbconfig.his backed up asusbconfig.h.bakautomatically.
To revert: replace the patched file with the.bak.
Step 6 — Open the sketch
- Reopen Arduino IDE
- File → Open
- Navigate to this project folder and open
mouse_jiggler/mouse_jiggler.ino
Step 7 — Select the board
Tools → Board → Digistump AVR Boards → Digispark (Default - 16.5mhz)
Step 8 — Upload
The Digispark upload flow is the reverse of normal Arduino: plug in the dongle after clicking Upload, not before.
- Make sure the Digispark is unplugged
- Click the Upload button (→) in Arduino IDE
- Wait until you see:
Plug in device now... (will timeout in 60 seconds) - Plug the Digispark into a USB port
- Upload completes — the onboard LED blinks, the dongle is ready
First connection — authorization prompt: macOS Ventura and later (including Tahoe) show an "Allow accessory to connect?" dialog the first time any new USB device is plugged in. Click Allow — macOS remembers the VID/PID and won't ask again. This is normal behavior for any new USB mouse, not specific to this device.
Troubleshooting — Device search timed out:
- Plug in the dongle within 2–3 seconds of seeing the "Please plug in" message — the bootloader window is only 5 seconds
- Try a different USB cable (many micro-USB cables are charge-only with no data lines)
- Try a different port, directly on the Mac rather than through a hub
- Check System Settings → Privacy & Security for a blocked device notification
- To verify macOS sees the dongle, open Terminal right after plugging in and run:
If nothing appears, the issue is USB (cable, port, driver). If something appears, the issue is micronucleus.system_profiler SPUSBDataType | grep -A5 -i "digispark\|micronucleus\|16c0\|05df"Troubleshooting — USB identifiers appear stale after reflashing:
- macOS caches USB device information (VID, PID, serial number) in memory until the next reboot
- If System Information still shows old values after a successful flash, reboot the Mac, then unplug and replug the dongle — the correct values will appear
Troubleshooting — Compiler warnings:
- Warnings about
invalid conversion from 'const unsigned char*'come from the DigiMouse library, not your sketchpatch_usb.pyfixes them automatically — if they persist after running the script, make a trivial edit to the sketch (add a space, save) to force Arduino IDE to clear its build cache and recompile
Customization
At the top of mouse_jiggler.ino, two values control the rhythm between activity cycles:
unsigned int LowerCycleTime = 800; // minimum pause between gestures (ms)
unsigned int UpperCycleTime = 4000; // maximum pause between gestures (ms)
Increase both for a more relaxed cadence, decrease for more continuous movement.
How it works
Each cycle follows a three-phase sequence:
- Transit — cursor moves to a new area along a quadratic Bézier curve with easing
- Work — small irregular movements in the zone, like reading or editing (75% of cycles)
- Pause — idle hand tremor (~33%) or complete stillness
The onboard LED on pin 1 lights up during movement.