ATtiny13 dice

Jet another ATtiny13 dice but with one small difference: it uses charlieplexing. It means that only 3 output pins drive all needed LEDs and there's enough for two more! (may be for RPG some dices)
here's photo and schematic:


 
I made it on stripboard for speeding things up (I wanted to make it yesterday but I have some issues with programmer... Remember to always plug a cap between power lines s0omething in range from 100n to 1u should work nicely. BTW I made old STK500 clone (FT232 and ATmega8) work with Atmel Studio 7 without avrdude cheat, I'll probably post it some day).
So, here's how  it works: pressing button starts counter, unpressing (is there such a word as unpressing?) reads it's value, than divide modulo by six and displays result. Quite simple, isn't it?
LEDs are numbered only from 1 to 4 because some of theme (2 and 2' etc.) always lights up together -see schematic. LEDs are connected directly to tiny's outputs because it can't provide too much current, so it won't burn them (soon). Dice can be battery powered. Datasheet tells that 13V can be powered from 1,8V and "normal" 13 from 2,7V (with clock slower than 10MHz), but my "normal" works quite well on 1.8V with 9.6MHz internal oscillator (I should slow it down for energy saving).

And here's table of truth for outputs and LEDs:

PB0  PB1 PB2  LED1 LED2 LED3 LED4
0 0 0 0 0 0 0
1 0 0 1 0 0 0
0 1 0 0 1 1 0
1 1 0 0 0 1 0
0 0 1 0 0 0 1
1 0 1 1 0 0 1
0 1 1 0 1 0 0
1 1 1 0 0 0 0

For simplicity I used only yellowish states, they lights up only one LED group at once, but it might be more convenient to use gray ones for speed things up. Multiplexing in nutshell is way to display more than 1/2 dot at once. Two or more LED's groups have to be alternately switched on and off so rapidly that people can't see that.

Some further works may contain:
  • making tiny sleep when it's not used - reset button should work as throwing button,
  • adding 2 more dices: charlieplexing with 4 pins gives us the possibility of controlling 12 LEDs (12/4=3) or one 7segment display (but we need both cathodes and anodes!),
  • shaking trigger for making device mor natural,
  • some animation for "throwing",
  • some "free" energy source for example magnet generator etc. it could also be a trigger like in this project.
Last but not least: the code on github.
New version with sleep power down mode and using "gray" states, but it have slightly different connections. I also added some delays between multiplexing because LEDs were unevenly bright.

Comments