Introduction: Like - Box

When I went to the Maker Faire Hannover last august, I met Herman Kopinga who showed me his like-jar and I love it. Half a month later, I needed a project, for our booth at the Maker Faire Kerkrade and Groningen, that would allow the visitors to interact with it. The only restrictions where that I only had 2 days to build it and that I only had the parts that where lying around on my workbench. At that moment I remembered the like-jar and came up with its bigger brother: the like-box.

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.

I found my 7 segment display in a junkshop around the corner. They had a whole bunch of 'broken' displays that where originally used in slot machines and I bought about 6 of them for €5. Once home, I discoverd that they weren't broken at all, but they had a manufacturing error: the vcc and GND pads were soldered together in one place. So by separating these pad I had a nice bunch of displays to play with.

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.

The 7segment display has only 12 pins. Eight anodes for each segment (and the dots) and one cathode for each digit. This means that I could use an attiny2312 to drive the display. The only problem is that the outputs of an attiny give 5V instead of 9V. A few transistors could have solved this problem, but I didn't have enough of them in my parts bins. What I did have was loads of L293D motor drivers and these could work too.

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.

The like button itself is one of these big red industrial emergency buttons. It is connected with the INT0 pin of the attiny2313 and the other side to GND. There is no pull-up resistor needed as we use the internal one of the attiny.

Step 4: Bringing All the Electronics Together.

So here is the final schematic:

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.

As usual, my code is written in BascomAvr. I add it here as-is in different formats. It should allow you to transcribe it for Arduino or whatever language you like.



$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
Enable Int0
On Int0 button

portd = 255                  'blanks the display
portb = 0

do

   for i = 1 to 4        'multiplexing the 4 digits and showing the correct values

      portb = displ(i)
      portd.ex(i) = 0
      waitms 1
      portd.ex(i) = 1

   next

loop
end

button:                   'on interrupt
                               'blank display
portd = 255

While pind.2 = 0    'debounce
wend

incr digit(2)            'increase the value by 1
if digit(1) > 9 then

    incr digit(2)
    digit(1) = 0

end if

if digit(2) > 9 then

    incr digit(3)
    digit(2) = 0

end if

if digit(3) > 9 then

    incr digit(4)
    digit(3) = 0

end if

if digit(4) > 9 then

    digit(4) = 0

end if

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
wend

return

Dta:                     'values for portb to display 0 to 9

data 123, 9, 227, 203, 153, 218, 250, 11, 251, 219

Step 6: The Box.

The box itself is a plywood case that I found. I used an X-Acto knife to cut out the rectangular hole for the display. The rest of the holes were simply drilled with the right diameter drill bits.

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.

Comments

About This Instructable

3,081views

28favorites

License:

Bio: I'm mainly interested in music, food and electronics but I like to read and learn about a lot more than that.
More by janw:Pickled ChilliesExtra hot sriracha sauce (Mme Jeanette)Build a Nest Box for Bumblebees
Add instructable to: