Modern Dice

Introduction: Modern Dice

About: I'm a mechanical engineer, and I like computer programming, mechanics, electronics and specially the robotics.
I like playing dice games like mensch, snakes & ladders, yahtzee, and …. Nowadays everything appears in modern form, so it must be very fun to have a modern dice, an electronic dice with LEDs and a microcontroller. If you want to make a modern dice follow this instructable.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: What You Need

To make this dice you need the following components and tools:
  • Printed circuit (find files in the next step)
  • Copper board
  • Sandpaper
  • Iron
  • Circuit board acid
  • 1mm drill
  • Soldering tools
  • 1x PIC12F675 microcontroller + socket
  • 7x 5mm LEDs
  • 7x 470ohm resistors (1/8 watt)
  • 1x 10k resistor
  • 1x Simple push button
  • 1x 3V coin battery + battery holder(I couldn't find a battery holder so I made it myself)

Step 2: Making the PCB

First you need to make a PCB. Here is a good instructable for making PCBs.
  1. Print the circuit on a glossy paper with a laser printer without scaling.
  2. Cut some copper board and clear it with sandpaper.
  3. Put the printed circuit on it.
  4. Press the hot iron on the board.
  5. Remove the papers.
  6. Soak boards in acid and wait till visible copper disappears.
  7. Wash the board.
  8. Drill the holes.
  9. Clear the board with sandpaper.
**The images are not for this project.

Step 3: Soldering Components

Now it's time to solder components on the board. Here is a good instructable for Soldering.
  1. Solder 470ohm resistors on the board (the resistor that is drawn on the IC is 10k not 470ohm).
  2. Solder microcontroller socket on the board in correct direction.
  3. Solder the LEDs on the board. Note that the cathode side is hatched.
  4. Solder the 10k resistor (the resistor on the IC) on its place on the back side of the board.
  5. Solder the button on the back side of the board to the terminals marked with letter B.
  6. At last solder two wires to the + and - terminals for the power supply.

Step 4: Attaching the Battery Holder

Put some insulator among button and the board and attach the button to the board with glue.
Solder the power supply wires to the battery holder.
Now attach the battery holder to the board on the button using some flexible material like paper and glue.
Note that at last you must be able to push the button by pushing the battery holder.

Step 5: Programming

Download the following file and program your PIC12F675 microcontroller. You can use any programmer to do this, I am using WinPic with a JDM programmer. After programming your microcontroller place it on its socket on the board.
Don't forget to:
  • Set oscillator to internal RC without CLKOUT (INTOSC no CLKOUT)
  • Disable power-up timer
  • Disable watchdog
  • Set MCLR to input pin
  • Disable brown-out reset
In other words: config word ($2007) = 0x31D4


Step 6: Make Your Dice Ready to Use

Make a cubic cover for your dice and put the board into it. I used a dark plastic sheet that LEDs light could pass through it.
Now put the battery into the dice, place it on the ground, and tap on its head to roll.
The dice will be turned off automatically after about a minute.

Step 7: Let's Take a Look at the Code

I wrote the program with OshonSoft PIC Simulator IDE basic.
Here's the code:

INTCON = %10001000 'Watch for port change interrupt
OPTION_REG = %11000111 'Enable timer0 with 1:256 prescalar
GPIO = 0 'Turn off all LEDs
TRISIO = %101000 'GP3 and GP5 are input other are output
IOC = %100000 'Watch for GP5 change
Dim number As Byte
Dim ledoff As Word
Dim gpioval As Byte
End 'Go to low power mode
On Interrupt
Save System
If INTCON.GPIF = %1 Then 'If button is pressed
If GP5 = %0 Then
GPIO = 0
number = TMR0 Mod 6 + 1 'make a random number according to timer0
If number = 1 Then gpioval = %000001
If number = 2 Then gpioval = %010000
If number = 3 Then gpioval = %010001
If number = 4 Then gpioval = %010100
If number = 5 Then gpioval = %010101
If number = 6 Then gpioval = %010110
ledoff = 0 'turn off all LEDs for a moment
If INTCON.T0IF = %1 Then 'timer0 interrupt
ledoff = ledoff + 1
If ledoff = 1000 Then 'turn off all LEDs after about a minute
GPIO = 0
ledoff = 0
If ledoff = 15 Then GPIO = gpioval 'display the number


Microcontroller Contest

Participated in the
Microcontroller Contest

Toy Challenge

Participated in the
Toy Challenge

LED Contest

Participated in the
LED Contest

Be the First to Share


    • Indoor Plants Challenge

      Indoor Plants Challenge
    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Sculpting Challenge

      Sculpting Challenge

    8 Discussions


    8 years ago on Introduction

    Cool job! I especially like the DIY coincell holder on the bottom, I am SO gonna copy that for my own projects.


    8 years ago on Introduction

    Man! very beautiful! Get a mac style casing designed and market it! The circuit is perfect!


    8 years ago on Introduction

    looks kool, how about encasing it in resin, but somehow leave a hole for battery access and roll button?


    Reply 8 years ago on Introduction

    Yes, and at last the dice looks nicer.


    8 years ago on Introduction

    You could try switching to smt parts and get it closer to dice size.