"Spin" This Charlieplexed ATtiny10 Electronic Die
Wilko Lunenburg's Wheel of Fortune-inspired pseudorandom device spins LED numbers with the press of a button.
Electronic dice are simple enough in operation: press a button, get a psuedorandom number via a series of LEDs. Making one, according to Wilko Lunenburg, was a popular build in the 1980s. Now in 2020, after having many years to consider it, he decided to design his own using an ATtiny10 on a printed circuit board.
When the single interface button on it is pressed, the device lights up each LED sequentially, creating a sort of “Wheel of Fortune” style output, which slows and eventually stops on a printed number from 1 to 6. This spinning effect uses the length of time that someone presses the button to generate randomness, employed rather than a programmatic number generator to conserve the ATtiny10's very limited flash and RAM resources.
To make do with the ATtiny10’s limited IO — three dedicated pins plus a reset — Lunnenburg used Charlieplexing to control the a half-dozen LEDs with three outputs. To sense the input button, an output is switched to an input quickly enough that one doesn’t notice the effect. It utilizes only about 1mA of current when running, and a few µA in sleep mode, so the dice should be able to run for quite some time on its CR2032 battery.