There are applications you can download for your smartphone that can “roll” an arbitrary number of dice with whatever number of sides you could possibly want. It’s faster and easier than throwing physical dice around, and you don’t have to worry about any of them rolling under the couch. No matter how you look at it, it’s really a task better performed by software than hardware. All that being said, there’s something undeniably appealing about the physical aspect of die rolling when playing a game.
Luckily, [Paul Klinger] thinks he has the solution to the problem. His design combines the flexibility of software number generation with the small form factor of a physical die. The end result is a tiny gadget that can emulate anything from a 2 to 64 sided die with just 6 LEDs while remaining as easy to operate as possible. No need to tap on your smartphone screen with Cheetos-stained hands when you’ve got to make an intelligence check, just squeeze the Universal Electronic Die and off you go. Granted you’ll need to do some binary math in your head, but if you’re the kind of person playing D&D with DIY electronic dice, we think you’ll probably be able to manage.
The 3D printed case that [Paul] came up with for his digital die is very clever, though it did take him awhile to nail it down. As shown in the video after the break, it took seven iterations before he got the various features such as the integrated button “flaps” right. There’s also a printed knob to go on the central potentiometer, to make it easier to select how many sides your virtual die will have.
In terms of the electronics, the design is actually quite simple. All that lives on the custom PCB is a ATtiny1614 microcontroller, the aforementioned LEDs, and a couple of passive components. A CR2032 coin cell powers the whole operation, and it should provide enough juice for plenty of games as it’s only turned on when the user is actively “rolling”.
[Tim]’s Dice10 is an exercise in minimalism. Building an electronic dice using an ATtiny10 with code that fits within 1kB is not too difficult. Charlieplexing the LED’s would have used three of the four available GPIO pins. [Tim] upped the game by using just two GPIO pins to drive the seven LED’s for the dice. A third GPIO is used as a touch button input. Besides the ATtiny and the LED’s, the only other component used is a capacitor across the supply inputs.
The LED’s are grouped in three pairs of two LED’s and a single centre LED. Usually, Charlieplexed LED’s are connected across pairs of GPIO pins. But his scheme includes connections to the 5V and GND terminals, besides the two GPIO pins. Building a truth table makes it easy to figure out what’s going on.
STATE PB2 PB0 LED's
1 Z Z --
2 L Z LED 1/2
3 H Z LED 3/4
4 Z L LED 5/6
5 Z H --
6 H L LED9
7 L H --
8 H H --
9 L L --
Only the logic states used are listed in the table. It’s possible to add two more LED’s between PB0 and GND and one more anti-parallel with LED9, making a total of 10 LED’s driven by two pins. That’s quite a hack. The important thing here is to have two LED’s in series in the arms that connect to either 5V or GND.
[Tim] has posted the code and hardware source files on his Github repo, and his blog post has some additional details on how he solved the problem.
If you’re looking for more inspirations on minimal dice designs, check this “PIC powered pair of electronic dice” which uses a PIC 12F629 with five outputs driving a pair of 7 pips to make a dual dice.
If you have a cool project in mind, there is still plenty of time to enter the 1 kB Challenge! Deadline is January 5, so check it out and fire up your assemblers!
[Will] likes his board games but can’t seem to keep from loosing the dice. He’s been using a dice-rolling smartphone app for a while now and decided that it was time to make a dedicated microcontroller dice roller.
The brain behind the dice roller is a chipKIT uC32 microcontroller. Seven output pins are connected to 7 appropriately-arragned LEDs in the top of the dice. There is only one more electrical component, a momentary switch, that is used to re-roll. When the button is pushed, a random number between 1 and 6 is generated and then displayed via the LEDs in true dice fashion. [Will] wrote his own code for this project and makes it available for anyone to download. The case is 3D printed and was designed in Tinkercad, the files of which are also available. The chipKIT is attached to the 3D printed base by a pair of zUNO clips. Find a short video of this thing in action after the break….
Digging the randomness of the roll but miss the realness of the dice? Check out this real dice roller. Need two electronic dice? Check these.
A pair of 6-sided electric dice (original in Dutch, here’s the Google Translate link) was sent in on the tip line for our ATtiny hacks theme. We really appreciate the simplicity of the circuit; it really shows how the complexity of discrete components can be cut down with a simple microcontroller.
The circuit is very simple – An ATtiny26 serves as the core of the project. Fourteen LEDs are connected to fourteen pins on the micro. The tiny26 might be a bit overkill. With Charlieplexing, we suspect this build could have been completed with an 8-pin micro like an ATtiny25. The code for the build (written in BASIC with BASCOM-AVR), board files and schematics have all been posted.
We’ve seen a few electronic dice builds before. this build uses an ATmega328 in a hugely overwrought circuit. Compared to what can be done with a 555, the ATtiny26 build provides a very nice middle ground.