Rust-Powered Graduation Cap Lights Up When Tassel Is Moved
#Rust

Rust-Powered Graduation Cap Lights Up When Tassel Is Moved

AI & ML Reporter
2 min read

Computer science student creates custom LED-embedded graduation cap that detects tassel movement using Rust on microcontroller, though ultimately decides against wearing it to ceremony.

Eric Park, a graduating computer science student, recently undertook an ambitious project to enhance his graduation experience with a custom LED-embedded cap that lights up when the tassel is moved from right to left. The project, while not ultimately used during the actual ceremony, demonstrates an interesting application of Rust programming on embedded hardware.

The motivation for the project came from Park's frustration with the traditional graduation ceremony and the expense of renting academic regalia. "I've never graduated before. So all the cap and gown stuff is new to me," Park wrote in his blog post. "You rent your cap and gown in the US. You have to return them. And they're expensive, too! I paid $94 just for the privilege of renting mine, which is insane because they probably cost way less than that to manufacture."

The technical implementation involved several components:

  • Digispark ATtiny85 microcontroller
  • 48 WS2812B LEDs
  • Reed switch and magnet to detect tassel movement
  • USB-C Power Delivery trigger board
  • Power bank with USB-C cable

The software development presented some challenges, particularly when working with Rust on the ATtiny85 platform. "Writing the code took about 2 hours, mostly because avr-hal and ws2812-avr do not support the ATtiny85 out of the box, at least not without a couple of tweaks," Park explained. "I had to fork them and dirty-patch a couple of things, including setting the default clock speed to 16 MHz. It probably would've been easier if I didn't use Rust and just used the Arduino libraries, or if I used a different board."

Park noted that the hardware development took significantly longer than the coding portion. "The hardware side took the longest, at 3+ hours. If anybody tells you hardware is easy they're wrong or they're lying and have never worked on a custom hardware project!"

Despite completing the functional device, Park decided against wearing it during the actual graduation ceremony. "Heck no. I thought about it but decided it looks pretty tacky. It looks like what kids would think of as a gaming PC and what boomers would think of as a seizure," Park wrote.

The project, while not used as intended, serves as an interesting case study in embedded systems development using Rust, a language not commonly associated with microcontroller programming. The code has been made available on GitHub for those interested in the implementation details.

Featured image

This project highlights the growing trend of using Rust in embedded systems, despite the language's reputation for being more suited to application development. The challenges Park faced in adapting existing Rust libraries for the ATtiny85 demonstrate both the potential and the current limitations of using Rust in resource-constrained environments.

Comments

Loading comments...