Tiny smd Picaxe 08M2 electric dice.
by, 17-03-2013 at 10:35 (17860 Views)
This is a small project i made to practice making compact pcb layouts in eagle. It turned out that it`s also good practice at smd soldering.
First I found a circuit-diagram of a descrete dice and found out that this would be even easier to do with a PicAxe. When the design was finished (Eagle-files at the bottom), I was allowed to borrow a PCB-CNC at the local university to make a actual board out of it. And here are the result.
Due to the restrictions on two attachments per post the rest of the files will be upploaded to Dropbox and shared.
Photo of the finished PCB can be found here:
The board measures are 26x14mm and are duoble-sided.
To display all six combinations of a dice (very easily) you need seven LED`s and four output pins. The Input only-pin(C.3) is used to trigger the "throw". The schematic shows how it is connected.
Component list:Code:; ******************************* ; ***** 08M2 Dice ***** ; ******************************* ; Filename:Terning_08m2.bas ; Date:15.03.2013 ; File Version:Final ; Written by:Bendik Henriksen ; Function:Throw a dice ; Last Revision:Current ; Target PICAXE:08M2 ; ******************************* ; _____________ ; | | ; | 1 2 | ; | X X | ; | | ; | | ; | 3 7 4 | ; | X X X | <-----THE DICE! ; | | ; | | ; | 5 6 | ; | X X | ; |_____________| ; #picaxe 08M2 symbol Delay=b3 symbol Diagonal_LtR=0 ;Led 1 & 6 symbol midtX2=1 ;Led 3 & 4 symbol Diagonal_RtL=2 ;Led 2 & 5 Symbol MidtX1=4 ;Led 7 symbol bryter=pin3 ;Switch to trigger throw. Delay=500 ;Delay to control animation of throw. setfreq m8 setint %00001000,%00001000 ;Set Interrupt on switch Main: For b1=1to 5 ;Here the picaxe counts from one to six ;several times a second while it waits for next b1 ;an interrupt to occur. It would seem from goto Main ;code that it is a litle greater chance to hit ;six but it`s not possible to detect in real life. Interrupt: if b1=1 then goto en ;Here we decide at what number the counter if b1=2 then goto _to ;was when the switch was pressed. if b1=3 then goto tre if b1=4 then goto fire if b1=5 then goto fem if b1=6 then goto seks en: Gosub roll ;Do cool stuff High MidtX1 ;before displaying the number goto Hold _to: Gosub roll ;Do cool stuff High MidtX2 ;before displaying the number goto Hold tre: Gosub roll ;Do cool stuff High MidtX1 ;before displaying the number High Diagonal_LtR goto Hold fire: Gosub roll ;Do cool stuff High Diagonal_LtR ;before displaying the number High Diagonal_RtL goto Hold fem: Gosub roll ;Do cool stuff High Diagonal_LtR ;before displaying the number High Diagonal_RtL High MidtX1 goto Hold seks: Gosub roll ;Do cool stuff High Diagonal_LtR ;before displaying the number High Diagonal_RtL High MidtX2 goto Hold Hold: setint %00001000,%00001000 ;Re-enable interrupt return ;Return from interrupt Roll: ;Some animations to make the throw interesting Low Diagonal_LtR Low Diagonal_RtL Low MidtX2 Low MidtX1 High MidtX1 for b2=1to 5 High Diagonal_LtR pause Delay Low Diagonal_LtR High Diagonal_RtL pause Delay Low Diagonal_RtL High MidtX2 Pause Delay low MidtX2 next b2 Low MidtX1 Low Diagonal_RtL Low Diagonal_LtR Low MidtX2 return ;Return to display the actual value of the throw.
- 1 PicAxe 08M2
- 7 Red 0805 LEDs
- 1 tactile switch
- 3 150r Resistor (R3,R4,R5)
- 1 1k Resistor (R6)
- 1 10k Resistor (R2)
- 1 22k Resistor (R1)
- Some wire
- Soldering equipment
- Battery (I used a 3,7V Lipo battery)
The Video of it working can be downloaded here:
(i you running firefox and have vlc installed you can watch it in the browser)
The Eagle board and schematic can be downloaded from here(.zip-file):