# A pocket dice roller with a rotary knob and a 3D-printed shell

An Arduino sketch turns a Seeed XIAO RP2040 and a tiny OLED into a dice roller, coin flipper and life counter you spin with one knob.

- Category: Hardware (build)
- Made by: [Spirik](https://www.hackster.io/Spirik) on Hackster.io
- Original: https://www.hackster.io/Spirik/no-dice-957521
- On Afterware: https://afterware.xyz/p/a-pocket-dice-roller-with-a-rotary-knob-and-a-3d-printed-shell

## Can I build this?

- Difficulty: Intermediate
- AI-buildability: 4/5 (The firmware is an Arduino sketch with common libraries that AI tools can write easily, and the hands-on work is light soldering and printing a case from provided files.)
- Time: A weekend
- Cost: $25–45
- Parts: Seeed Studio XIAO RP2040, Grove Shield for XIAO, 0.96in 128x64 OLED SSD1306, Rotary encoder with push-button, 3.7V LiPo battery
- Tools: soldering iron, 3D printer, Arduino IDE

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

## Build sheet

- Controller: Seeed XIAO RP2040
- Display: 0.96in OLED SSD1306
- Input: Rotary encoder + push
- Language: Arduino C++

## Starter prompt

```
Based on "A pocket dice roller with a rotary knob and a 3D-printed shell" on Afterware: https://afterware.xyz/p/a-pocket-dice-roller-with-a-rotary-knob-and-a-3d-printed-shell

Write an Arduino sketch for a Seeed XIAO RP2040 driving a 128x64 SSD1306 I2C OLED and a rotary encoder with a push button. Build a menu that lets the user pick a D4, D6, D8, D10, D12, D20 or D100 die to roll, flip an animated coin, or adjust a life counter from -999 to 9999. Seed the random generator from an unused analog pin and the RP2040 temperature sensor. Use U8g2 for drawing and the Arduino-Pico core for the build.
```

## Story

Forget the phone. no_DICE is a handheld with one clickable rotary encoder and a 0.96-inch 128x64 OLED that rolls D4 through D100, flips an animated coin, and tracks life totals from -999 to 9999. Turn the knob to pick a die, press to throw it. The coin flips two to four times before landing, so you can't read the result off the first frame.

The firmware runs on a Seeed XIAO RP2040 with the Grove Shield for XIAO, which handles power management for a 3.7V LiPo. The menu is built with the GEM library and drawn with U8g2, and KeyDetector turns the encoder into a proper input device. The random seed mixes noise from an analog pin, the RP2040's temperature sensor and battery voltage. Battery monitoring needs a voltage divider made from two 100k resistors soldered to the shield.

The whole thing is free and open source, and the enclosure is 3D-printed from provided STL files, with Fusion (.f3d) and STEP files for editing. If you want a weekend project that also doubles as a 3D-printing exercise, this is a clean one. The sketch is also a usable reference for GEM menus, and the frame can house a different board entirely."

## Resources

- [Project page](https://www.hackster.io/Spirik/no-dice-957521)
- [GEM library](https://github.com/Spirik/GEM)
- [KeyDetector library](https://github.com/Spirik/KeyDetector)
- [Firmware sketch](https://github.com/Spirik/no_DICE/blob/main/src/no_DICE_gem-u8g2)
- [Frame enclosure files](https://github.com/Spirik/no_DICE/blob/main/hardware/enclosure/frame)

Tags: rp2040, oled, rotary encoder, 3d-printed, arduino, dice roller

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