Datasheet

Electronic Dice Essentials
www.kitronik.co.uk/2109
How the Electronic Dice Works
At the heart of the electronic circuit is a PIC microcontroller. A microcontroller is, in effect, a small computer. The
circuit uses a push switch to detect when it should start generating the next number to be displayed. When the
button is pressed the PIC very rapidly cycles through number 1 to 6, upon release of the button the number is
displayed. The PIC then determines which of the LEDs should be lit up and sets pins 2, 5, 6 and 7 as required.
The relationship between the number that is to be displayed on the dice, the
LEDs that need to be lit up, and the PIC pins that controls them, are shown in
the table below.
No. on dice
LEDs that are on
PIC Pins
1
5
5
2
1+2
2
3
1+2+5
2+5
4
1+2+3+4
2+6
5
1+2+3+4+5
2+5+6
6
1+2+3+4+6+7
2+6+7
So, for example, if the number 3 (shown right) was to be displayed on the dice, this would require LEDs 1, 2 and 5 to
be lit. These are controlled by PIC pins 2 and 5 (pin 2 controls LEDs 1 and 2). As the cathode of the LEDs are
permanently connected to V+, the LEDs are turned on by taking their associated PIC pin low. This creates a voltage
across the LED(s) and turns it/them on.
The value of resistors R1-R7 is 330. These resistors limit the current that can flow through the LEDs. This protects
the LEDs and controls their brightness.
Using your dice
When the button is pressed a number is shown on the dice.
Pressing the button again will display a new number.
After a number has been displayed for 30 seconds the LEDs go out and the microcontroller goes to sleep. In
this state is takes virtually no power so the batteries can be left connected when the dice is not in use. Next
time the button is pressed the dice wakes up and functions as normal.