Initial Idea
My previous dice project Radiant Dice used a Geiger Counter and a radioactive source to make true random numbers. It looks and works great, but it's a bit bulky. I wanted to make something handheld that would have a physical interaction to create the rolls.
I saw the 3D magnetometer on Adafruit, and I thought that might fit the bill for way to generate the numbers. I got a big cylinder magnet to give add to the physical interaction. I had some HDPL1414 displays that have been waiting for a project, and this seemed like a good choice.
With the initial mechanism in place, I started to prototype my way through the project.
Body Design
I went for a hi-fi aesthetic with the metal knob, wood body and acrylic plates. I did the CAD in Inventor. I did the 3D printing of prototypes on a Prusa i3 Mk3.9, and used a 60w Epilog laser cutter. I am going to cut the wood parts on my X-Carve router.
Electronics
For micro, I went with a ESP32 V2 Feather. It had the battery circuit built in, had a STEMMA QT port on top. Eventually, it would be nice to have an app collect the rolls so it could perhaps be used with a VTT or to share with the DM.
The HPDL1414 displays, they are alphanumeric which makes them more flexible than 7-segment displays. They are from the 90s, but not too hard to get a hold of currently. The encoder was also pretty straight forward to incorporate. I started using the Adafruit STEMMA QT Encoder breakout, but it didn't fit in the case, so I put the encoder directly on the board. I am not an electrical engineering, but I have been working with custom circuit boards to replace wires. I did not consider trace thickness or include passives (beyond the two resistors) that may be required.
Random Number Generation
I'm using the amount (distance) from the sensor and the polar angle values from the sensor multiplied by 100 to make them integers (keeping the precision) modded by the number of sides. I have done a couple thousand of readings, and them numbers were even though more testing is needed.
(((distance + polarAngle) * 100) % numberOfSides) + 1