Electronic Die using PIC16F84 microcontroller




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.

bread board


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. 

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.

  • 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.

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




Leave a Comment

*
= 4 + 3

Read previous post:
Servo Motor Control using Microcontroller PIC16F877A

Servo motors are widely used in robotics and industries for motion control. They can be controlled by PWM signals where...

Close
Scroll to top