Built using a PIC16F84, about 4 hours worth of code and a few bits on a breadboard. This was the first time Iβve worked with PICβs so it was a learning exercise. I started with the βHello Worldβ microcontroller equivalent i.e.Β Blinking LED, then tried the βKnight Riderβ sequencing LEDs, and then hacked this together. The code is written and assembled using the Microchip MPLAP IDE V5.70.Β I only did this as an exercise to familiarise myself with PIC assembler, but having got it working I decided I wanted it smaller and as I had just acquired some 12F675s I took the original 16F84 code and developed it further to work with the 12F675.
For those of you who donβt know, and to save you the trouble of sending me an email to point out yourΒ ignorance, dice is the plural of die see here.Β
LED die using PIC16F84 Die on bread board, and Programmer (the neat PCB to left) with Die breadboard foreground and my circa 1985 Computer PSU, modified to get supply for PIC programmer. The assembler code was written to work, not as an example Iβm afraid, so no apologies for the quality.Β IΒ havenβt done any further work with this since I decided the 8pin PIC12F675 was better suited for building a miniature die.Β Β You should also note that if you do build a die using the 16F84 code below it is flawed in that it throws with unequal probability.Β
- Source code (the 12F675 die source below is better documented and developed)
- Hexfile ready to program (right-click Save As)
- Circuit schematic
LED die using PIC12F675. Starting with the 16F84 code above Iβve modified and developed it further to run on an 8 pin 12F675 device.Β This device has an internal 4Mhz oscillator so it needs no external support components and results in this minimum part die. I got this PIC for Β£0.99p so I reckon you can build the whole thing for about Β£2.50.Β You donβt need a power switch since the PIC βsleepsβ between throws and uses just a few micro Amps in this state.
- Source code.
- Hex file ready to program (right-click Save As)
- Circuit schematic PNG , PDF
- PCB Artwork
Three months after I built these prototypes I finally got round to producing a PCB for the die.Β The artwork is available from the link below.Β Rather than using discrete resistors the PCB layout uses a 9 pin 270R SIL resistor pack (Actually only needs an 8 pin one, the PCB will accommodate either).Β When you fit the button cell battery holder, check to make sure it doesnβt short out any of the component leads behind it.Β You do need to use high efficiency LEDs with this otherwise they wonβt be bright enough and if you increase the current by reducing the value of the resistor pack it will impact on battery life.
- PCB Overlay (pdf)
- PCB Layout (pdf)
The artwork above is the second revision of the PCB.Β The photoβs below show the die built on the first PCB version I did. This is pretty much identical to the second, I just manually tweaked some of the auto routed tracks and removed the connector for an external power connector.
Top image. Bottom image
- Operation
When the die first starts after power is applied it initialise the device and then goes to sleep until the SW1 βrollβ button is pressed.Β While the button is pressed the display is blank. On releasing the button the LEDs βspinβ for about 5 seconds. The βthrowβ is then display for 20 seconds at the end of which the LEDs fade down and turn off over about 2 seconds.Β If the throw button is pressed during this time, the die throws again, otherwise after 22 seconds the die goes back to sleep.Β Iβve built four of these die, all running from CR2032 3V lithium cells.Β One of these which I keep on my desk is still working on the original battery after 15 months.
Hereβs an Ultra Small Die that Iβve built using a 12F675.Β This would be ideal for a surface mount design but I havenβt gone that far with it.Β This is built on an tiny bit of strip board, with some careful assembly and creative use of a baked bean can Iβve got down to the size of a 50 pence piece.Β
- Front View,
- Rear View before attaching battery holder
- Completed with battery holder attached (made from lid of Baked Bean can) attached.Β
- Third one with SM battery holder, PIC soldered directly into circuit.
For more detail: Electronic Die using PIC16F84 microcontroller