r/arduino • u/Designer_Argument869 • 29d ago
Look what I made! no_DICE - Arduino-based dice throwing and coin flipping simulator with 3D-printed enclosure
Small weekend project for tinkerers and hobbyists I've created to showcase some of the GEM library features (multi-level menus, editable selects and number spinners, toggles, dynamic menu items, custom icons and callbacks as well as a possible solution for multi-language support).
About
In a nutshell, no_DICE is mainly two things (both are free and open-source):
- Arduino-based simulator of dice throws, coin flips, and a score counter (using U8g2 and GEM to draw the menu, and KeyDetector to hook up rotary encoder as an input device);
- optional 3D-printed customizable enclosure designed to fit Seeed Studio XIAO RP2040 board (with Grove Shield for XIAO for power management), 3.7V LiPo battery (in 902030 or 902040 form-factor), 0.96" 128x64 monochrome OLED I2C display, and a rotary encoder (with integrated push-button).
Equip an Arduino-compatible board of your choice with an I2C 128x64 display and a clickable rotary encoder, upload the provided sketch (modify it if necessary to better fit your setup), select an application to roll a die, flip a coin, or track your score with a click and a swing of the encoder. Optionally, add a battery and build an enclosure to take your no_DICE setup on the go! Of course, you can also upload your own sketches and customize an enclosure to your liking.
Features
- Dice throwing: choose from a wide variety of dice:
D4,D6,D8,D10,D12,D20,D100. Set default preferred die in settings. - Coin flipping: not really much to say about it, just press a button and coin will be flipped. With glorious sprite animation. Result of a coin toss is determined at a key press, but coin itself flips random amount of times (2-4) so that it is harder to predict an outcome by seeing the initial frame of animation.
- Life tracking: not just Life, really, but points in general. Turn the knob and number will increase (or decrease) at your will. Press the knob to reset the number to its initial starting value (adjustable in settings). Any value you desire is fine (as long as your desire falls within the range of -999 to 9999).
- Localization: English, Russian, German, and French languages are available to pick from in settings.
- Battery monitoring: can be enabled in settings. Requires additional hardware modification (in the form of a voltage divider comprised of two identical resistors soldered to Grove Shield).
- Random number generator: is seeded with multiple samples of the lowest bits of an analog pin as well as an internal temperature sensor of the RP2040 (on compatible boards) to pick up fluctuations in random noise, battery voltage, and temperature levels.
- Enclosure: you can 3D-print it: STL files are provided. You can modify it too: .f3d (Fusion) and STEP files are provided as well.
Simulator
Simulation of no_DICE is available on Wokwi (using Raspberry Pi RP2040 board). There are some limitations of simulation to be aware of (i.e. saving to EEPROM and seeding random number generator), refer to no_DICE project repository for more details.
Electronics and Enclosure
Parts list and full assembly guide are available on GitHub. Optional enclosure can be 3D-printed using provided STL files (designed with no overhangs, except for screw holes on the side of the main frame). Autodesk Fusion project file (.f3d) and STEP files are provided as well.
Spirik.