Introduction: Binary Counter/Dice
Hello world,
This is a dead simple counter and dice, which shows numbers (0-15) in binary.
I use it with Munchkin board game, it reminds me my level.
First of all, the hardware tha you'll need:
- 1x AVR microcontroller with at least 6 I/O pins (I used an ATTiny85 and disabled reset pin)
- 4x LEDs (I recommend 3mm, for the battery to last) of favored color
- 2x Tactile pushbuttons (I do not recommend Chinese from ebay, mine are VERY faulty... :/ )
- 1x 3V battery. Anything with more than 200mAh will do (2x AA will run the device for weeks, if not months)
- 1x Battery holder (depends on the battery used, I currently do not have one)
- 1x Switch (not showing in photo)
And the tools:
- Soldering iron
- Solder
- Hot glue gun
- Hot glue
- Ricepaper
- (Optional) Hacksaw (I could not find it and I used the one in the picture) to cut the board
You do not need any fancy soldering skills, also depends on your implementation.
The device, will increment when you press button 1 and decrement when you press button 2.
Also, when you press and hold both buttons, it will light up all led for 2 seconds and then show you a random number from 1 to 6.
The code is available here: https://git.dzervas.gr/munchkin
Gather the materials and lets start! :)
Step 1: The Schematic
The schematic is very simple, so i did not built any digitally.
Just connect LEDs to PORTB from 0 to 3 (1st led to PORTB0 etc.) and connect them to ground.
Then, connect the buttons to ground and the other end to PORTB4 and 5 accordingly.
And power (2.8-5V) and GND of course.
Finally, download and burn the code (https://git.dzervas.gr/munchkin) to your little AVR (I let that as a homework for you, on how to do it...)
Test them on a breadboard and then go to the next step
NOTE: For my Attiny I used these fuse bits: (E:FF, H:5F, L:62). This disables the reset pin and makes it a regular I/O, which means that you can't reprogram the mc without a high voltage programmer.
Step 2: Soldering
Now, just solder the schematic to a board.
I have no fancy hardware (PCB tools), so I just took some board an wire and soldered them.
My soldering technique is not good at all, but keeps the size pretty small.
Step 3: Finallizing
Optionally, you can put on some hot glue and managing it with ricepaper, so that you have a flat surface to glue your battery holder and be sure that there will be no short circuits.
In my case, that step, is necessary, as the last led would short circuit all the time.
TODO: I have not yet found a battery holder, so I'll post pictures when I find one.
This is my first instructable, so be polite (and patient :P ).
Have fun playing munchkin (AWESOME card game)
Thank you!