Mouse jiggler alternatives to keep your computer awake
The most obvious alternative for keeping your computer awake is turning down your power settings. Another option is apps like Don’t Sleep for Windows and Taurine for macOS which can simulate activity to keep the OS awake.
Why a hardware solution to keep your computer awake?
Other than “because it’s there,” plugging in and removing a hardware device can be easier than remembering to turn on and off a setting or app. Just remember that this will also prevent your computer from locking itself, so don’t use in any scenario where that would be a problem.
You could get a physical mouse jiggler, but then you have to place your mouse on it. This project does away with the need for a mechanical mouse jiggler by plugging in a small Arduino like you have a second mouse plugged in, ever so slightly nudging the mouse every few CPU cycles (well, technically, every few cycles on the Arduino itself).
Components
- I’m using a DFROBOT Beetle as my Arduino, but any 32u4 or SAMD micro based board will support the Mouse functions.
- A cable to connect your computer’s USB port (USB-A or USB-C) to the Arduino (micro USB for all of my 32u4-compatible boards)
The Code
What’s this blinking stuff?
The blinkIfYoureRebooted
function is there in case there needs to be a reset of the device, I can get a signal with the five consecutively longer blinks that I successfully reset, since with the Beetle, I bridge a connection to reset instead of pressing a button.
Reset is sometimes necessary if you’ve been switching out dev computers and devices:
Couldn't find a Board on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload.

YouTube Short illustrating resetting the DFRobot Beetle and blinking
Mouse.move (the mouse jiggler)
The Mouse
functions on Arduino 32u4 and SAMD based boards allow the Arduino connected to behave like a mouse (there is also an equivalent Keyboard
set of functions). While these have some limitations (mine isn’t active on the FileVault login screen), for normal user mode, they work fine.
The random bits
The if(random(0,10090)==0)
code was just an arbitrarily large chance at moving the mouse, and then Mouse.move(random(0,5)-2, random(0,5)-2, 0)
just moves [-2,+2] pixels in the X and Y direction so that it moves “enough” to register as input, but not enough or frequently enough to prevent normal computer usage.