Guy Dupont's Clever Mouse Hack Plays a Mean Game of Pong — Entirely in Its Own Firmware

The addition of an RP2040 and some clever coding gives this optical mouse a secret game, displaying "sprites" through persistence of vision.

ghalfacree
about 1 month ago Games / HW101

Maker Guy Dupont has built a Pong-like game of electronic tennis that runs entirely within the firmware of an optical mouse, using rapid cursor movement as simulated "sprites."

"Did you know that if you move a mouse cursor fast enough, you can get persistence of vision," Dupont rhetorically asks by way of introduction to his latest project, "and, say… run a game of Pong inside your mouse's firmware. They tried to shut me down with some sophisticated anti-hacking tech. (Having power/ground mislabeled on their production PCBs??)"

Blink and you'll miss it: this game of Pong operates entirely within the firmware of a USB mouse. (📹: Guy Dupont)

Dupont's unusual gaming project uses an off-the-shelf Hewlett-Packard optical mouse, enhanced through the addition of a Seeed Studio XIAO RP2040 microcontroller board — sitting between the mouse and the host computer, intercepting the USB traffic and modifying it on-request to perform the impossible.

"This firmware emulates an absolute positioning mouse and quickly moves the mouse cursor between points of interest," Dupont explains. "It moves fast enough that the cursor (kinda) appears in all positions at once and gives the impression that it is in multiple places at once. I have implemented a simple game of Pong to run in the firmware, and set the cursor's points of interest to be the two paddles and the ball while the game is active. So the game runs completely inside the mouse!"

A Seeed XIAO RP2040 is hidden inside the mouse's housing, intercepting its USB connection to the host PC. (📷: Guy Dupont)

The game's "display" is the monitor of the connected computer, with the cursor moving rapidly enough that it appears to be visible in both player positions as well as a moving "ball" between the two. The game is triggered by pushing the mouse wheel in; otherwise, the mouse retains its original relative-positioning functionality. A lately-added idle mode reproduces the "DVD screensaver" effect, drifting the cursor around the screen and bouncing off the edges.

More information is available on Dupont's Mastodon thread, while the project source code has been published to GitHub under the permissive MIT license.

ghalfacree

Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.

Latest Articles