//26 February 2015

Gambling with electronics… literally

Finally, I am done with my exams and there is time for some fun.

No, I didn’t spend a fortune in a casino. But I wanted to try some of the “games” that could be assembled with my Conrad kit which includes a breadboard and some basic elements. The binary die caught my eye (woah, a rhyme!) Most tabletop games require a die or two. It’s usually a plain old six-sided guy, although if you’ve played Dungeons & Dragons, you know there are some bizarre looking cousins of this die. The most famous being the d20, or a regular icosahedron if you prefer the geometric term. So there I was, dreaming of how spectacular it would be if I appeared at our next D&D session with a light show on a breadboard which is actually a 20-sided die.

However, I had to make the boring 6-sided one first. The idea is to use 3 LEDs of different colour, assigning the numbers 1, 2 and 4 to each colour. Then, while a button is pushed, the LEDs will change their condition quickly and make it impossible to recognise any number. After the button is released, the LEDs remain in a stable condition and the rolled number can be read. It is the sum of the LEDs that remain lit.

Conrad scheme

The circuit used, with NAND gate, binary counter, resistors, capacitor and the three LEDs

In theory this is great. The cycle for switching through the conditions is achieved with the NAND-gate. The resistor R1 and the capacitor C1 determine the cycle speed. The cycle is only applied to the binary counter (IC2) when the button is pushed. If the button is not pushed, the cycle input (CPU) is connected to ground across the pull-down resistor R2. So far so good… here’s the messy part:

From the Conrad manual

The inputs D0 to D3 specify that the counter is to start at 1. For this, only the input D0 (pin 15) is connected to high. The inputs D1 to D3 are connected to ground (low level). The counter reading is always reset to 1 when the pin PL (11) is pulled to low level. This should be done after the number 6, since the number 7 is not permitted. Resetting to 1 takes place with the number 7; then all outputs (Q0 to Q3) have a high level. The three NAND-gates are switched to result in a NAND gate with three inputs. For three high levels at the inputs, a low level results at the output of IC1D (pin 11). The low level thus resets the counter reading to 1. Resetting is so fast that the counter reading 7 (all at high level) is not visible.

Alright, so I hooked up everything, I checked the circuit and here’s what happened:

Breadboard for electronic dice

The circuit, ready to rock

Red LED shining

Pressing the button and...

Red and only red. Checked everything again – no change. Is red my lucky number, or I just messed up big time? Then I noticed the button was pretty wobbly, it actually jumped away from the board when I tried to push it harder and let it go. So… My plan for troubleshooting is: set it up without a button (I’ll use wires instead); check for other errors; check for errors in the circuit itself and find alternative ways for building dice.

This post and project is indeed a failure. For now. My hope is that, with some holidays coming, I’ll have the time for a follow-up and a fix. Meanwhile, if anyone who stumbles upon this has something to say, please do. Surely tabletop games will be perfectly fine without my clumsy circuit dice, but I still want to do this. Maybe other gambling tools in the future, too. The ways of achieving randomness via electronics fascinate me.

This post was originally published at Photons hit Electrons, a collaborative geek blog mostly run by Deyan Levski.