# A smackable duck that fires PC macros

A blocky yellow duck with a tactile switch under its head. Smack it once, twice or hold it, and it fires a different keyboard shortcut depending on which app has focus.

- Category: Hardware (build)
- Made by: [Makestreme](https://www.hackster.io/makestreme) on Hackster.io
- Original: https://github.com/Makestreme/macroduck
- On Afterware: https://afterware.xyz/p/a-smackable-duck-that-fires-pc-macros

## Can I build this?

- Difficulty: Intermediate
- AI-buildability: 4/5 (The firmware and the Python focus-aware macro app are easy for AI to write, while the two-wire soldering, 3D printing and sponge-and-plunger assembly are light hands-on work.)
- Time: A weekend
- Cost: $8–20
- Parts: Seeed Studio XIAO ESP32C3, SparkFun 12mm pushbutton switch
- Tools: soldering iron, 3D printer, superglue, double-sided tape

Estimates based on the original write-up. How the AI-buildability score works: https://afterware.xyz/ai-buildability

## Build sheet

- Controller: XIAO ESP32-C3
- Input: Miniature tactile switch
- Body: 3D-printed PLA
- Software: Arduino firmware + Python app

## Starter prompt

```
Based on "A smackable duck that fires PC macros" on Afterware: https://afterware.xyz/p/a-smackable-duck-that-fires-pc-macros

Write Arduino firmware for a Seeed XIAO ESP32-C3 wired to a momentary tactile button on GPIO 4 and GND. Debounce the switch and classify presses as single tap, double tap or long hold, sending TAP_1, TAP_2 or TAP_HOLD over USB serial. Then write a Python app on Windows that reads those serial messages and sends a keyboard shortcut based on the focused window.
```

## Story

The trick is the sponge. A miniature tactile switch has about 0.25 mm of travel, so the build wedges a 2 cm square of kitchen sponge between the head and the button. Off-center smacks stop tilting the head or jamming the plunger, and every hit gets a snappy rebound.

Inside, a Seeed XIAO ESP32-C3 sits on double-sided tape with two wires soldered to GND and GPIO 4. The firmware debounces the switch and times the hit: a single smack, a double smack or a long hold goes over USB as TAP_1, TAP_2 or TAP_HOLD. A Python companion app on the PC checks the focused window and fires the shortcut mapped to that program, so the same smack can play or pause Spotify, delete a word in Word or minimize Chrome.

Worth stealing: the parts are small, blocky and printable without supports in PLA, and the firmware flashes from a browser with no IDE. Swap in any tactile switch and the same sponge-and-plunger trick works for any soft-button enclosure.

## Resources

- [GitHub repository](https://github.com/Makestreme/macroduck)
- [MacroDuck Web Flasher](https://makestreme.github.io/macroduck/)
- [Body STL](https://hacksterio.s3.amazonaws.com/uploads/attachments/2021418/body_OdkHb9lWiT.stl)
- [Head STL](https://hacksterio.s3.amazonaws.com/uploads/attachments/2021419/head_yyZsYsytRK.stl)

Tags: macro pad, 3d printed, xiao esp32-c3, tactile switch, python, desk toy

AI assistants can search all Afterware builds through the MCP server at https://afterware.xyz/mcp (setup: https://afterware.xyz/agents).
