Introduction: D&D Dice Roller

My son the Dungeon Master tells me he often has to roll many dice at a time, and adding them all up is tedious and breaks the flow of the game. So, could I make him some sort of automatic dice roller with options for the number of dice and the number of faces on the dice? But of course!

Supplies

Arduino Nano

2 BCD (binary coded decimal) switches

3 digit 7 segment display (this one came out of a bathroom scale)

Push button

Piezo speaker (this one came out of a dishwasher)

One sided PCB stock (70x100mm)

Muriatic acid (from the hardware store)

Hydrogen peroxide (from the drug store)

Ultra fine point Sharpie marker

PETG filament

Step 1: Design the Circuit and Board

I used Fusion360 to design the PCB to mount everything to. The display is a common cathode seven segment display, and 22 ohm resistors are used on each segment. The BCD switches use the Nano's internal pullup resistors, except for the A6 and A7. It turns out that,documentation to the contrary notwithstanding, these have no internal resistors and must have an external 10k to 5V. The speaker output and the button input are accessed via a three pin header. Power is supplied by a USB connection to the Nano.

Fusion360 will allow you to draw up your circuit and generate a PCB layout. It is a powerful and useful tool!

Step 2: Make Your PCB

I could have done the project with jumpers to connect everything, but there would be a forest of wires to deal with. Instead, I used the method described by https://www.youtube.com/watch?v=sL0LZFcNaow, "Making PCB's the RepRap way!" Here you make a pen carriage for your 3D printer, use FlatCam to generate gcode, and draw your circuit on the PCB stock with a Sharpie. The Sharpie ink acts as a resist, and you can etch away the unwanted copper with 2 parts 3% Hydrogen peroxide and 1 part Muriatic Acid. Once the board was cleaned up, I used my Barbie & Ken tiny drill press to make holes for the components and soldered the whole thing up. You can see the resistors I added later when I came to find out I needed two external pullup resistors.

Step 3: Arduino Software

The software uses the Switch (https://www.avdweb.nl/arduino/hardware-interfacing/arduino-switch-button-library-with-short-long-press-double-click-and-beep) and SevSeg (https://github.com/DeanIsMe/SevSeg) libraries. The loop runs in two states, using SevSeg to display either the position of the two BCD switches or the result of the "roll." If there is a change in the switches, it shows the switch values, and if the button is pressed if shows a random series of numbers while playing a little beep-boop sound. When the button is released, the result of the roll is shown. The roll is calculated repeatedly while the button is down, summing a random value of the die faces as many times as there are dice. Thus, you can feel you are rolling as long as the button is pressed, and then letting go the dice when you let go the button.

Step 4: Package It Up

I used Fusion360 to design a box and cover, as well as two dials. The box has a grill for the speaker, a slot for a USB cable to power everything and supports for the cover. The cover has holes for the dials, the button and the display. There are also two little holes for 4-40 machine screws, which act as stops for the dials. Since I needed fewer than the 16 possible outputs of the BCD switches, I inset a groove for the screws to ride in as the dials turn, limiting the travel of the dials.

Role Playing Game Challenge

Participated in the
Role Playing Game Challenge