Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!

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.

Gareth Halfacree
5 months agoGames / 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!"

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.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles