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


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.