I dug through all my parts bins and found everything to make a working like-box ( Yay!). Some things could have been done in an easier way if I had the time to source parts somewhere. But I had only these parts, so this is the result.
Lots of people have asked me how it works and how it connects to the internet. Well, it doesn't connect to anything. It is basically a button connected to a display that shows how many people pressed the button. It's no more or no less pointless as the like buttons on facebook :)
Step 1: The 7 Segment Display.
The four digit display that I used was rated for 15V. But I wanted it to run on a lower voltage, because that was more convenient to me. So I desoldered the onboard resistors and swapped them for 10Ohm resistors. This lowered the voltage to 9V. Still to high to drive it directly with a microcontroller, but now I could at least power it with a power supply that I had lying around.
Step 2: Driving the 7 Segment Display.
L291D motor driver ICs are designed to allow small current and low voltage level signals to drive motors that use far bigger currents and higher voltage levels. This suits our needs as we want to drive 9V segments with 5V signals. They also can switch fairly fast at 5kHz, thus they are suited for multiplexing the 4 digits.
Step 3: The Button.
Step 4: Bringing All the Electronics Together.
PortB of the attiny is used to drive the segments and decimal point. PortD.3 to PortD.6 are used to switch between the different digits. They are all hooked up to an input of the L293D's and the respective outputs are hooked up to the corresponding pin of the display. All enable and vcc1 pins of the L293D's are simply connected to 5V, the vcc2 pins to 9V and the GND pins to GND.
PortD.3 (INT0) of the attiny is hooked up to one side of the button and the other half of the button is connected to GND. Vcc is hooked up to 5V and GND to GND.
An 7805 is used to provide the 5V for the microcontroller.
Step 5: The Code.
$regfile = "attiny2313.dat"
$crystal = 8000000
config portb = output 'sets PortB to output
config portd = output 'sets PortD to output
pind.2 = 1 'enables the internal pull-up resistor
dim i as byte
dim digit(4) as byte
dim displ(4) as byte
dim storage(4) as eram byte
dim ex(4) as byte
ex(1) = 3 'sets pins 3 to 6 of PortD to drive the digits
ex(2) = 4
ex(3) = 5
ex(4) = 6
digit(1) = storage(1) 'recals the last value from the eeprom
digit(2) = storage(2)
digit(3) = storage(3)
digit(4) = storage(4)
Enable Interrupts 'enables the interrupts and defines the label for the routine
On Int0 button
portd = 255 'blanks the display
portb = 0
for i = 1 to 4 'multiplexing the 4 digits and showing the correct values
portb = displ(i)
portd.ex(i) = 0
portd.ex(i) = 1
button: 'on interrupt
portd = 255
While pind.2 = 0 'debounce
incr digit(2) 'increase the value by 1
if digit(1) > 9 then
digit(1) = 0
if digit(2) > 9 then
digit(2) = 0
if digit(3) > 9 then
digit(3) = 0
if digit(4) > 9 then
digit(4) = 0
storage(1) = digit(1) 'store in eeprom
storage(2) = digit(2)
storage(3) = digit(3)
storage(4) = digit(4)
displ(1) = lookup(digit(1), Dta) 'Lookup the right value for portb in the data table
displ(2) = lookup(digit(2), Dta)
displ(3) = lookup(digit(3), Dta)
displ(4) = lookup(digit(4), Dta)
waitms 250 'debounce
While pind.2 = 0
Dta: 'values for portb to display 0 to 9
data 123, 9, 227, 203, 153, 218, 250, 11, 251, 219
Step 6: The Box.
To make the text and logo's, just google for the pictures that you like and print them. Then laminate them and cut them out with an X-Acto knife. When done, you can glue them to the box. I used cyanoacrilate glue aka super glue.