How to control the 7 LEDs of a die with only 2 GPIO
- a miniaturized electronic die based on ATtiny10.

Similar projects worth following
Another electronic die? Boring! But wait - this is an attempt at an absolutely minimized implementation using an ATtiny10. It makes use of a very efficient multiplexing scheme to drive the 7 LEDs of an electronic die with only two I/O pins. (For reference: Charlieplexing would need three pins!)

The third free pin of the ATtiny10 is used as a touch button input. Apart from the LED and a decoupling capacitor, no additional external components are used.

The magic of how to drive 7 LEDs with just 2 GPIO is shown on the right in the schematics. Please see here for a detailed description.

PB1, the remaining free IO pin, is used for the touch button.

The entire board is about the size of a real die. (which I did not have for size comparison, but the coins should do).


A gif animation showing the dice in action.

Graphics Interchange Format - 8.60 MB - 11/26/2016 at 19:35


sch - 58.43 kB - 11/26/2016 at 13:35


brd - 36.53 kB - 11/26/2016 at 13:35


  • 1 × ATtiny10
  • 7 × SMD LED 0603
  • 1 × SMD Capacitor 100n 0805

  • Implementation

    Tim11/26/2016 at 13:06 0 comments

    The implementation into hardware is quite straightforward. I mananged to squeeze all components into a PCB that is ony 13 mm x 19 mm. One notable trick was to use an edge connector for the SPI/TPI interface. Using a normal 6 pin header could have easily doubled the size of the board.

    The software uses a timer interrupt to multiplex the 7 LEDs. The main routine calls the TinyTouchLib to poll the touchbutton. If a button press is detected, the value of the die is increased.

    It turns out, that due to the small physical size, the touchbutton is somewhat unreliable and detects multiple touches when pressed. So I am using this in lieu of a random number generator...

    Compiler output:

    	Program Memory Usage 	:	644 bytes   62.9 % Full
    	Data Memory Usage	:	7 bytes   21.9 % Full

    Still some space left.

  • Design considerations

    Tim11/26/2016 at 10:45 0 comments

    This is an attempt at an absolutely minimized electronics dice implementation. An entry for the Hackaday 1kb competition. Using an ATtiny10 as a MCU automatically limits the code size to 1kb, so the code size competition is automatically met.

    The ATtiny10 only has three I/O lines - we need to control 7 LEDs in total. How?

    This implementation manages to control all 7 LEDs using only two I/Os. See here for a description of the multiplexing scheme:

    Why no series resistors? Well, turns out you can get away with that when you minimize the duty cycle of the LEDs. Since the scheme required multiplexing anyways, this is automatically given.

    The remaining I/O pin is used for a touch button to activate the dice. No push button is needed. I am using my TinyTouchLib for this, which also works on an ATtiny10.

View all 2 project logs

Enjoy this project?



Malik Enes Şafak wrote 12/28/2017 at 18:57 point

i made a slightly different version of this board. 15mmx15mm pcb with same schematic. I can share kicad and gerber files if anyone interesting. Really good job Tim

  Are you sure? yes | no

Eric Hertz wrote 12/01/2016 at 11:12 point

Hard to beat Charlieplexing, looks like you figured it out!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates