electronic dice

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
Post Reply
jdboy3020
Posts: 16
Joined: Thu Sep 03, 2009 10:35 am
Contact:

electronic dice

Post by jdboy3020 »

I've always wanted to have electronic dice but can not find any that output in decimal numbers. How easy would it be to add a circuit to this kit to output to two seven segment LEDs? http://www.ramseyelectronics.com/cgi-bi ... &key=K3400 Lamar
sghioto
Posts: 326
Joined: Wed Dec 26, 2007 5:16 pm
Location: Colorado
Contact:

Re: electronic dice

Post by sghioto »

The schematic for this kit uses a 4022, a 1 of 8 decoder driving the transistors which control the LEDs. Using a CD4511 display and some isolation diodes will do the trick. The resistor values for the segments may need to be adjusted depending on the supply voltage used.

Steve G
Attachments
LED to Decimal Dice Display.JPG
jdboy3020
Posts: 16
Joined: Thu Sep 03, 2009 10:35 am
Contact:

Re: electronic dice

Post by jdboy3020 »

Thanks a lot. How complicated would it be to have the to numbers added together, for example instead of showing a 3 and 4 it would show 7? Lamar
sghioto
Posts: 326
Joined: Wed Dec 26, 2007 5:16 pm
Location: Colorado
Contact:

Re: electronic dice

Post by sghioto »

:eek: What? Add them together! Can't you just do that in your head. :mrgreen:
Yeah it's possible but I would use a microchip.

Steve G
User avatar
haklesup
Posts: 3136
Joined: Thu Aug 01, 2002 1:01 am
Location: San Jose CA
Contact:

Re: electronic dice

Post by haklesup »

The problem with that is results greater than 9 cannot be displayed on a single 7 seg display.

A binary adder might work since you are only using digits 1-6 (binary adders have base 16 count not base 10). I'm not 100% sure for that reason and would need to do a few test additions on paper to confirm it. Do an image search on binary adder for some logic diagrams implemented with various types of logic. The addition would happen before the 4511 and results greater than 9 may be displayed as A thru F (hex) and you may have to substitute the 4511 BIN to DEC with a BIN to HEX decoder (I did not look up the datasheet for the 4511, it may already be HEX)
jdboy3020
Posts: 16
Joined: Thu Sep 03, 2009 10:35 am
Contact:

Re: electronic dice

Post by jdboy3020 »

sghioto wrote: :eek: What? Add them together! Can't you just do that in your head. :mrgreen:
Yeah it's possible but I would use a microchip.

Steve G
I've always wanted to get started with micro-controllers, maybe this would be a good reason. Next I need to figure out which. I'm thinking I need a micro that would come up with a random number between 1 and 6 (or 1 and 12 depending on the position of a switch) and display it on a double 7 seg LED. Would a PIC be a good candidate? What books would you recommend for a newbie with 0 experience with micros?
LEM
sghioto
Posts: 326
Joined: Wed Dec 26, 2007 5:16 pm
Location: Colorado
Contact:

Re: electronic dice

Post by sghioto »

Would a PIC be a good candidate?
Pic is a good candidate, although I started out in and still use the PICAXE family of micros. These are Pic microchips pre-programmed with the PICAXE bootstrap code. I believe this is the easiest, least expensive and most simple way of getting into micro's. Check out the link.

Steve G

http://www.picaxe.com/Getting-Started/PICAXE-Manuals
User avatar
haklesup
Posts: 3136
Joined: Thu Aug 01, 2002 1:01 am
Location: San Jose CA
Contact:

Re: electronic dice

Post by haklesup »

Truely Random numbers are notoriously difficult to produce in software. You can produce pleudo random but true random is elusive. Alterantively, you can create a randomly oscillating analog circuit between 1 and 12V (or .1 and 1.2 if you like) then on command sample and hold the value and display its voltage rounded to 2 digits.

In software you can seed a fractal with a time code (say when the operator pushes a button) then sample it at another randomly selected time as determined by when the operator releases the button. Pseudo random code times random human timing input. There are other methods you can learn about by searching.

Its hard to beat the simplicity of real dice
User avatar
Lenp
Posts: 1529
Joined: Thu Oct 26, 2006 8:11 pm
Location: Maryland
Contact:

Re: electronic dice

Post by Lenp »

For a really random and totally unpredictable number, you will probably need a female to help you! :wink:
Len

“To invent, you need a good imagination and a big pile of junk.” (T. Edison)
"I must be on the way to success since I already have the junk". (Me)
User avatar
MicroRem
Posts: 208
Joined: Tue Dec 04, 2001 1:01 am
Location: Vancouver, WA USA
Contact:

Re: electronic dice

Post by MicroRem »

Lenp, I believe that if you were any more right you would be wrong.

Tom
User avatar
haklesup
Posts: 3136
Joined: Thu Aug 01, 2002 1:01 am
Location: San Jose CA
Contact:

Re: electronic dice

Post by haklesup »

come to think that the odds in dice are not random at all. My suggestion of a single variable 2 to 12 number would not produce dice like odds.

The odds of getting a 6 or 7 are much greater than getting a 2 or 12 for example because of the way 2 dice combine. To get true dice odds, you need to have 2 seperate number generators which you can then add together as a seperate step. My comments about randomness are valid but only if applied to one dice at a time before adding. the circuit in the second post is perfectly suitable starting point in that respect.

In response to adding, it could be confusing since 12 could accidently be interpreted as 1+2=3 not 6+6 Its technically possible but ill advised from an application standpoint
avionicsmaster1958
Posts: 11
Joined: Wed Apr 10, 2013 6:03 am
Contact:

Re: electronic dice

Post by avionicsmaster1958 »

I haven't been exposed to other PIC programming languages or their chips other than PicBASIC. I don't think it's any harder to learn than others but I have been told it's a bit more versatile than some companies IDE designed for PICs. Though there are a plethora of programs written for PICAXE and other lanugages all using PICs. I think PicBASIC is easier than PICAXE becasue it is the basic language where, to me, PICAXE is alot like C. Which in itself is bad and good. Bad to me as it's a bit harder to learn but I think PICAXE is more efficient and you can pack more bits into a chip. Those are my thoughts on languages. Please don't shoot the writer.

If you decide to use PicBASIC I'd recommend the 12F683 chip. It's got just enough pins for the project if you get creative with a RS bit. It has the most memory of its class and is only a few pennies, US, more than the next lower chip.

For random numbers, I knew of a guy who wrote a program that tracked all the displayed numbers. He then averaged the times each number came up and somehow increased the possibility the other numbers would show until the averages were more balanced. His client seemed to be happy with it but I don't know if I could ever replicate that approach. I've often been told there are not truly random numbers in computers. They are predictable unless you muddle them enough.

Good luck on your programming and remember, don't shoot the writer.
sghioto
Posts: 326
Joined: Wed Dec 26, 2007 5:16 pm
Location: Colorado
Contact:

Re: electronic dice

Post by sghioto »

avionicsmaster1958 said:

[quote][ I think PicBASIC is easier than PICAXE because it is the basic language where, to me, PICAXE is a lot like C. Which in itself is bad and good. Bad to me as it's a bit harder to learn but I think PICAXE is more efficient and you can pack more bits into a chip/quote]

Not shooting anybody here :mrgreen: but I think you may have these two mixed up. PIC is definitely more powerful and faster then PICAXE because PICAXE has firmware pre-programmed to allow for easier download of programs which does not require a compiler, but is programmed in Basic as well.

Steve G
User avatar
haklesup
Posts: 3136
Joined: Thu Aug 01, 2002 1:01 am
Location: San Jose CA
Contact:

Re: electronic dice

Post by haklesup »

"I've often been told there are not truly random numbers in computers. They are predictable unless you muddle them enough."

For example if you just used the RND function in basic, each time you restarted the hardware, you could get the exact same sequence of dice rolls as the last time it was powered on.
Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests