SpikenzieLabs Dice Kit - Mods Information Page

The dice kit is available directly from the manufacturer at spikenzielabs.com, and from resellers like sparkfun.com.

This kit is indeed a clever design, but could still be improved. This page contains information about possible hardware modifications, alternative firmware, and source code that you can modify.


Hardware Modifications

Dim LED Fix

To make the LEDs brighter, replace the 470 Ohm resistors with lower values. For maximum brightness, you could try 10 Ohm resistors for R1-R3 and 100 Ohm for R4 (R4 needs to be a larger value or the center LED will be brighter than the others because the center LED is driven by one CMOS driver instead of two). This modification may shorten the battery life, but it won't harm any of the kit components.

Tap Sensitivity Fix

If you find that the sensor circuit is overly sensitive (mine seems to go off whenever it feels like it), try these changes: The PIC12F675 PIC input pins are able to clamp up to 20 mA, so the 10K series resistor will provide plenty of protection (more than the original design) from over/under voltage spikes from the piezo sensor.

click here to see the modified schematic diagram

Software Modifications

OEM Dice Code

The original source code is written in assembler for Microchip 12f675.

Theory of Operation

It's may seem counter-intuitive, but using the A/D input from the piezo sensor for a random number source is problematic because such analog signals are often surprisingly repeatable. Generating a random number well, especially when using a relatively simple PIC processor, can be challenging. This is because microprocessors are designed to be deterministic rather than random devices.

The code presented here uses an overly complicated randomization method that's based on a pseudo-random number generator plus two environmental inputs (the time of the dice roll and the ambient light level). The result is pretty much truly random dice throws with no repeating sequences.

User Interface Improvements

Implementation and Source Code

To implement the new firmware, you will need a PIC chip programmer such as the Microchip PicKit. There are a couple of ways that you could program the firmware into the PIC chip:
  1. Install an 8 pin socket on the dice kit and use a demo board to program the PIC chip separately (the Microchip PicKit 2 Starter Kit includes both a programmer and a demo board that would work for this).
  2. Wire a 6-pin header to the installed dice kit PIC to plug into the PIC programmer (refer to the schematic diagram for the wiring hookup). The PIC can be programmed in-circuit using the programmer powered mode (remove the battery).

Use the chip programmer’s software to load the firmware hex file and program the PIC chip. If you are using the MPLAB software and a PicKit programmer, this can be done directly from the MPLAB IDE.

To modify the software, use the Microchip MPLAB software (available for free from microchip.com). There's still plenty of ROM and RAM space left in the PIC, so go ahead and invent the greatest (or weirdest if you prefer) electronic dice in the world.

click here to see the OEM source code
click here to see the modified source code
click here to download the source code project file folder
click here for the standard dice firmware (single roll, 6-sided)
click here for the extended dice firmware (double/super modes selectable)
click here for the original dice kit firmware

Enjoy!

2010.11.17 ~ RSP