A Digital die
When pressing the push-button the fast scrolling of 1 to 6 — just like a regular D6 die — stops to give a 'random' number. It's not based on randomness in the circuit, but on the random timing of the press by the human.
This project is based on "Dicing with LEDs" by Elektor, which appeared on December 2006's issue. They have kindly allowed us to use it for this project.
Assembly and usage
The project includes the following components
- x1 14-bit ripple counter IC, TI CD4060BE
- x1 IC DIP socket, TruConnect DS1009-16
- x7 Red 5mm LEDs, CREE C503B-RBS-CW0Z0AA1
- x5 1N4148 diode, Diotec 1N4148
- x1 PNP transistor, Diotec BC557B
- x1 100nF ceramic capacitor, Suntan TS170R1H104MSBFB0R
- x5 15KΩ resistors, Multicomp MCF 0.25W 15K
- x4 470KΩ resistors, Multicomp MCF 0.25W 470K
- x1 SPST-NO tactile switch, TE Connectivity FSM4JRT
- x1 Battery contact positive, 9V-3 positive
- x1 Battery contact negative, 9V-3 negative
- x1 Lovely PCB!
Brief theory of operation
The heard of the circuit is the CD4060B, which is a 14-bit 'ripple-counter' integrated circuit with a built-in oscillator. This is convenient since we won't be needing to have a separate clock source.
The clock needs to be fast enough so our eyes cannot distinguish the die's state since then we could cheat by pressing the button just at the right time. The components connected to φI, φO and φO-bar (pins 11, 9, 10): RS, CX, and RX control the frequency of the counter. According to the datasheet, this is governed by the following two formulas:
f = 1 / (2.2 x RX x CX) (2 x RX) < RS < (10 x RX)
In our case we'll have
RX = 470KΩ || 470KΩ = 235KΩ // recall that R = [R1*R2]/[R1+R2] CX = 220pF RS = 470KΩ f = 1 / (2.2 x 235000 x 220E-12) = 8.8KHz
That's fast enough! If you actually measure the frequency it might be different than the ideal calculation above due to tolerances of the components, and manufacturing variability.
You'll notice a switch to ground. The switch that we supplied is a single-pole-single-throw normally-open kind, abbreviated as SPST-NO. This means that it is normally an open circuit and closes the circuit when the button is pressed. In out case shorting the φI input to ground. This halts the counting as long as the button is pressed. That's how we get our 'roll'.
A 'normally connected' switch, SPST-NC, would operate the circuit the other way round. That is, run only when the button is pressed. SPST-NC push-buttons are uncommon, and when we do find them, they are a bit pricey. If you'd like to fit an SPST-NC we designed the footprint to accept one! Get the KSR223GNCLFG from C&K Components.
Now we have a clock running. We need to scroll through the six states of a normal D6 die. We'll use the counter to go through the states and control the LEDs. The clever people at Elektor figured out that the best way to do that is to use the first six states of the counter for the six states of the die and a seventh state for reset. Their cleverness is in that they scrambled the states to make the circuit more efficient. See the table in the infographic.
We'll leave figuring out how the control circuitry works to you ;)
Please follow the guidelines in the infographic. Please heed to the note about not connecting the battery while the contacts are hot from soldering. Also pay attention to not connect the battery contacts and the battery itself the wrong way. If you touch the contacts with the battery and the LEDs don't turn on, something wrong. With any trouble recruit the cavalry on Slack.
PIPS is an open source design, as is most of our work. You can find the design files for the hardware and packaging at our GitHub repository. You can edit the design files using our own PCB design open source software, PCBmodE.
This PCBs were manufactured by Eurocircuits.
Finally, community contributions for this project are on our community site.