un programme à flasher sur une mini Arduino qui se branche sur le port usb d'un ordinateur et envoie des signaux régulier pour empêcher la mise en veille
  • Python 64.1%
  • C++ 35.9%
Find a file
2026-05-24 11:45:34 +02:00
mouse_jiggler fix: délai USB après begin() pour compatibilité clones 2026-05-23 17:52:25 +02:00
patch_usb.py fix: numéro de série plus plausible (PA + date + code hex lot) 2026-05-24 10:45:48 +02:00
README.md docs: correction identifiant USB — PixArt USB Optical Mouse, pas Logitech M100 2026-05-24 11:44:17 +02:00

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 (~$25)
  • 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 micronucleus dynamically links to it and needs the Intel version specifically

Installing libusb-compat via the standard ARM Homebrew (/opt/homebrew) won't work — it produces an ARM64 library, which micronucleus (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

  1. Go to arduino.cc/en/software
  2. Download Arduino IDE 2 — choose macOS (Apple Silicon)
    The filename should be arduino-ide_x.x.x_macOS_arm64.dmg
  3. Open the .dmg, drag the app to Applications
  4. Launch Arduino IDE

Step 3 — Add the Digistump board package

  1. Open Arduino IDE → Preferences (Cmd + ,)
  2. Find the field "Additional boards manager URLs"
  3. 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
    
  4. Click OK

Step 4 — Install Digistump AVR Boards

  1. Go to Tools → Board → Boards Manager
  2. Search for Digistump
  3. Install Digistump AVR Boards
  4. 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.h is backed up as usbconfig.h.bak automatically.
To revert: replace the patched file with the .bak.


Step 6 — Open the sketch

  1. Reopen Arduino IDE
  2. File → Open
  3. 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.

  1. Make sure the Digispark is unplugged
  2. Click the Upload button (→) in Arduino IDE
  3. Wait until you see:
    Plug in device now... (will timeout in 60 seconds)
    
  4. Plug the Digispark into a USB port
  5. 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 23 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:
    system_profiler SPUSBDataType | grep -A5 -i "digispark\|micronucleus\|16c0\|05df"
    
    If nothing appears, the issue is USB (cable, port, driver). If something appears, the issue is micronucleus.

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 sketch
  • patch_usb.py fixes 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:

  1. Transit — cursor moves to a new area along a quadratic Bézier curve with easing
  2. Work — small irregular movements in the zone, like reading or editing (75% of cycles)
  3. Pause — idle hand tremor (~33%) or complete stillness

The onboard LED on pin 1 lights up during movement.