My Arduino spins faster when Claude burns more tokens
2 days ago
- #Hardware Hacking
- #DIY Electronics
- #Desk Toy
- Author built a desk toy with a motor that spins faster based on Claude Code's token usage, responding to actual computer work.
- Hardware uses an Arduino Uno, L298N motor driver, and a DC motor with a flywheel salvaged from a broken Stirling-engine kit.
- Software includes a Python watcher on macOS that polls Claude's JSONL transcripts and maps token activity to motor speed via exponential decay.
- Screen lock/unlock notifications trigger a smart plug to cut power to the motor and a desk lamp, acting as a hardware fail-safe.
- Calibration involved empirical testing to determine minimum/maximum PWM duties and brake durations for responsive speed changes.
- Project repurposes broken hardware, highlighting a pattern of turning defective consumer items into functional tools.
- Future improvements could include wireless control with an ESP32 for flexibility, but USB tethering currently limits placement.