# overly complicated dice roller

Discussion in 'The Projects Forum' started by PhilBrink, Oct 12, 2011.

1. ### PhilBrink Thread Starter New Member

Oct 12, 2011
7
1
I am attempting a circuit which will give a random (well, a fast timer type random) number. I added in multiple dice counts for some games I play. So it should roll to 3,4,6,8,10,12, or 20 depending on the jumper location.

The schematic below is what i came up with. From the searching around the net i have done, this should work. I want the displays to be off until c3 is toggled cutting off the timer source from the binary counter and the lights to turn on to display the selected number. I am using the power from the timer to send over to the 7447's to turn the displays on. They flicker slightly with slower timings.

Seperatly, each section of the circuit works fine. The timer, and gates and binary counter will work together, the timer, 7447 and displays work together, but connecting the two is causing strange problems.

The numbers no longer increment and change without input between 1,5,7, and 9. The numbers on the display flash on and off without any signal from the timer. Its also eating a lot of mA (250+).

Any ideas?

Phil

2. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
Unfortunately, the 7447's will only decode BCD (binary coded decimal), and you're giving them a binary input.

Valid input is 0 decimal (0000 binary) through 9 decimal (1001 binary). 10 (A hex, 1010 bin) thru 15 (F hex, 1111 binary) cannot be decoded by these IC's.

3. ### MrChips Moderator

Oct 2, 2009
12,624
3,451
For starters, I would remove R1 and R2 and put seven 220 ohm resistors on the outputs of IC2 to the seven-segment display and the same for IC5.

Put 100uF cap between Vcc and GND. Put 0.1uF caps between VCC and GND at IC1, IC2, IC3, IC4, and IC5.

It is not quite clear from your circuit diagram from where your ICs and displays are getting their power.

4. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
MrChips,
Our OP appears to be using Cadsoft's Eagle. Eagle doesn't show many of the library parts power/ground pins unless the INVOKE command is used. A symbol needs to be placed on the schematic with the same name (node name) of the supply pins in order for the board module to link them with "air wires".

5. ### PhilBrink Thread Starter New Member

Oct 12, 2011
7
1
Correct, the resets on the 74393 occur at 10 using the output from the and gate.

Im a bit confused by the use of capacitors in those locations. What are they for?

6. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
Those are called "bypass capacitors". Without them, you can have big problems. One 0.1uF capacitor across the power/ground pin of each IC on your board is a minimum requirement; many ICs require more.

To the left of IC3A ('393 bin ctr) the wire that goes to the junction of IC1C (74LS08) pin 6 and the IC3b clk input needs a diode, cathode towards the CLR input between those junctions. The CLR input needs a pull-down resistor; 1k should work.

As things are now, you wind up shorting a HIGH output through D1 to a LOW output from IC1C pin 6. That is not good. You must never allow two outputs to be connected together without some kind of current limiting.

7. ### MrChips Moderator

Oct 2, 2009
12,624
3,451
Filter capacitors on the power supply lines is basic electronic engineering practice that everyone must learn.

The 100uF (10uF - 1000 uF, varies with the circuit requirements) is to supply current when large current pulses are demanded. In your case, the display segments will be turning on and off and these will put huge spikes on your supply line.

The small caps, 0.1uF at each IC is the accepted engineering practice. These are to suppress the high frequency spikes when digital circuits switch on and off.
Standard non-CMOS 555 ICs are notorious for putting noise on the supply lines. I would but a 10uF cap across the 555 IC. I would also connect pin 4 of the 555 to VCC. It is incorrect to believe that 100uF + 0.1uF = 100.1uF. The capacitors have different frequency characteristics and they are there for different reasons.

You can get away without all of the about but ignore it at your peril.

(As always, Wookie can type faster than me.)

8. ### PhilBrink Thread Starter New Member

Oct 12, 2011
7
1
Thanks for the help. Theres a couple mistakes in the and gates I had to fix, but its working very well.

I was probably being a bit overzealous with my first circuit beyond a flashing led. The first and only electronics class i had was 15 years ago, so remembering anything was a suprise.

9. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
Glad you got it working, PhilBrink .

Eagle has sort of a long learning curve unless you go through a tutorial a few times. Ask me how I know this.

SparkFun's Eagle tutorial is pretty good; not too long, yet covers most of what you need to get up and running quickly:
http://www.sparkfun.com/tutorials/108

Even though you seem to more-or-less have "the hang of it", it will help you to go through it; I promise that it will be time well spent.

For future reference, you're much better off exporting images in the .png format. .png images are compact, require no other software to view, and are not "lossy" like the .jpg format you used. Schematics exported to .jpg images look "fuzzy". Use 120 to 150 DPI resolution.

The first thing you want to do when starting a schematic is to drop a frame into the schematic, with the lower left corner on the crosshair. All of the frames are in frames.lbr - I like to start with an A-size landscape drawing. If you don't start out with a frame and try to print a schematic, you will likely find that it goes to multiple pages. Having a frame in there helps you to figure out how your schematic will fit on a page of paper.

Use the Erc function early, and use it often! Erc is on the menu bar on the left side near the bottom. If you don't keep Erc happy, you will have a very hard time when you try to make a board from the schematic. I have wound up throwing away many hours worth of work because I didn't keep Erc happy.

Mar 24, 2008
20,772
2,540