[Bluewraith] built himself an electronic dice using a 555 timer and 4017 counter. This is a classic project and he enjoyed doing it but wondered about making a 20-sided dice. So he grabbed his Arduino and got to work. A switch on the final project selects between 20 or 100 sides. He used a MAX7219 to control the 7-segment displays, and a standalone AVR chip for the rest of it.
If you missed it back in October you should also look in on this 6-sided dice. It also uses an AVR running the Arduino bootloader but a mercury switch allows the player to shake the box in order to start a roll.
One last note, we made a conscious decision to use the word ‘Dice’ instead of the grammatically correct ‘Die’ which is its singular version. We think ‘Die’ can be a bit too confusing and we’re not the only ones.
Drats! Just as I was about to release my 88 sided dice!
100 sides would mean 3, 7 segment displays. I only see 2. So I assume that this ‘Dice’ includes the number 0? Which to me doesn’t really make sense since this is meant to be a digital representation of a real ‘Dice’ is it not, which can never roll a 0?
BoKu, 100 is probably represented by 00. Try to think outside the box, man ;-)
I actually had a 100-sided die back when I played D&D. Oh the memories!
+1 to Mike, I thought the same thing when I saw the two 7-segments.
Funny, I was just looking up different things to do with a 555 timer earlier this morning.
10 sided dice are numbered 0-9 and a 100 is always denoted by two 0’s. It’s the only way to make rolling two dice work for getting a value 0-100. He has obviously kept the convention here. Anyone who needs to roll 01-100 probably is familiar with that particular convention.
:p fair enough
Or could think even more outside the box and go HEX.
Or be logical since a dice does not have to start counting from zero, that is it only has to have 100 discrete states (sides) so zero can be a prety valid state, no?
ps:cs computer student here ;-)
A simple trick for random number generation is to start a counter running when the circuit is powered up (a simple variable running between 1 and 100 on a polled loop) and then read the value when the button is pressed. Since the button press timing is ‘random’ so will be the result.
Nice project btw :)
i like how you went with the use of the word “work” instead of “word”
Using an MCU for this project seems like a huge overkill, but I suppose the price of the few extra logic IC’s might justify the use of the atmel processor alone. I don’t think you can justify the use of an “arduino”, at least not from the cost perspective. Makes it easy for other people to duplicate the project, I guess.
Overkill? The MAX7219 isn’t really needed. As well as the XTAL (AVR can run on internal oscilator with easy for a project like this) and the AVR can be smaller (ATTiny2313?)
I still have a 4x7segment display… guess I’ll be proving my point a bit later. Let’s see if I can get on HAD with real fancy dice then.
@Jake and Daid: I also thought that if the goal is the most efficient use of hardware, this is overkill. But I believe this is a project idea developed with the intention of learning how to use THIS hardware. So that makes it a success in my mind.
Darn, 7segment display has broken areas :'( no dice for me.
@Daid
I’m not sure what you mean, you have a broken 7 seg. or you don’t like the fact that they have spaces between numbers?
Pretty cool di(c)e. Next up a nixie tube version?
I have a broken 7seg (or a 4x7seg) one of the anode lines is broken internally making 1 segment not working for all numbers. A real shame.
I would have made a version with just that display a tiny2313, a button. Packed in a tight space, as the tiny2313 could be behind the 7segments. For software I guess I could fit a selectable number of die and different types, like ‘throw 4d6’ as you can show a d on a 7seg.
Overkill? Hell yeah it was.. but really, I needed to get rid of some of the parts that I have. I’ve gotten a half dozen MAX7219s from free samples, and the AVR is always removable.
As far as the random generation, its the built in Arduino random function. I have it seeded to an open analog pin reading, otherwise it will always be the same “random” when you power it on.
So citing a Wiktionary (not even a Wikipedia) entry gives a writer authority to ignore standard English grammar? Try citing an authoritative source that changes the singular usage, die, into the plural, dice. A more careful examination of the entry on Wiktionary reveals that its justification, “that some authoritative sources state that ‘In modern standard English, the singular die (rather than dice) is uncommon. Dice is used for both the singular and the plural’,” is an uncited quotation, and a look at the citations page reveals that every cited usage of the plural form for the singular comes from a British (except for one Canadian newspaper) publisher. Thus, in the most optimistic view, you are trying to substitute standard British grammar for standard American grammar, rather than simply being a lazy writer.
Do me a favour: can you get my fags from the boot of my lorry? (OK, I took a little poetic license with giving a lorry a boot, but that’s what my license is for!)