Binary Dice

Github | Hackaday

Overview

Binary Dice is a simple pcb based on the ATtiny85. It generates a random number and then displays it on leds in binary. It is my first attempt and making a pcb, and was a very fun and educational experience.

Front of the Board
Back of the Board
Board being Used

Hardware

Binary Dice uses a custom PCB designed in KiCad powered by an ATtiny85. Because it was my first PCB, my goal was to keep it cheap and simple, so I tried to design it arround parts I had lying arround from various kits.

Bill of Materials

I have made a digikey list containing all of these parts: Digi-Key BOM

The boards were ordered from OSHPark for a total of $15.20 for 3 boards (approx $5.06/board), making the total cost $9.90 per board.

PCB layout
Schematic

Software

To program and flash the microcontroller I used the Arduino IDE, and followed this guide.

The code uses a 16 bit linear feedback shift registor to generate pseudo random numbers after each button click. It generates numbers between 0 and 15 then displays them on the leds using binary.

Because the LFSR is deterministic, I made the program read the previous eeprom seed and increment it after each boot to make sure the same sequence doesnt get repeated. Finally, I tried to implement software debouncing for the button, however it leaves a lot to be desired so I plan to come back to that in the future.

Program definitions
Helper Functions
Setup & loop