Animation Coffee Table
There are many very good instructables on how to make interactive coffee tables with LED matrices, and I took inspiration and hints from some of them. This one is simple, cheap and most of all it is meant to stimulate creativity: with just two buttons, you can create animations on it!
We had an IKEA LACK table with a dent, bought a new one, leaving the old one up for reuse in a project. The top is 55x55x5cm, and it is hollow, with just a thin board on the top and bottom that is easy to cut through with a box cutter. The sides are more sturdy, made of ~1cm hardboard. It is filled with cardboard in a honeycomb structure, which is easily removed.
The local hardware store has 50x50cm plexiglass in various thicknesses, colors and transparency. The 4mm white-opaque is transparent enough, and the price reasonable (4.50EUR - still the biggest expense of the project!).
Instead of individually addressable LEDs, I use the readily available MAX7219 chip. The maximum output current according to the datasheet is 320mA total, so 5mA per LED. A bit below the nominal 20mA for 5mm white LEDs, but bright enough for this purpose.
Using only 2 buttons the user can make or modify animations. The Arduino has 1kB of EPROM memory, so that fits 128 images of 8x8 bits. Enough space to store 15 animations of 1-15 frames each.
Required Materials
Ikea Lack table
50x50cm opaque plexiglass, 4mm thick
~0.5 square meter of cardboard. The sturdy 3-layer board used for furniture packaging is the best.
White paint
An Arduino Nano without pin headers
A USB-A male connector
Small USB power bank
MAX7219 IC
A 24-pin IC socket (or 3 8-pin sockets)
A 20kOhm trimmer potentiometer
64 white 5mm LEDs. Ideally diffused, but clear is also fine.
~10m of enameled wire (or other isolating wire)
2 momentary push-buttons, 16mm panel-mount
1 big electrolytic capacitor (~1000muF)
1 ceramic capacitor (~1muF)
2 ceramic capacitors (~0.1muF)
1 rectangular on/off switch (10x15mm boat rocker)
A 5x7cm prototype board
4 corner pieces to restrain the movement of the LED panel
2 40-pin single-row headers: 1 male and one female
2m of stranded hookup wire
3 JST connector male-female pairs with 10cm leads
4 small wood screws
Build the LED Panel
Draw a grid of 8x8 squares of 5x5 cm on the cardboard. Also draw the diagonals, so that the center is easy to find. Cut it out but leave an extra space of 1cm around the borders. My cardboard was not large enough so I built it up from two halves and used cellotape to connect them
Punch holes in the center of each square and stick a 5mm LED through it. Bend the LED pins with a 90degree angle between the cathodes and anodes. Connect all the cathodes of a row together and all the anodes of a column. I used enameled wire and just burned off the coating with the soldering iron.
Cut a 16-pin piece off the female pin header and glue it to the center of one of the sides. Solder all 16 wires to the pins: anodes on one side, cathodes to the other side. Test that all LEDs light up when powering a combination of a cathode and an anode with 5V in series with a 1kOhm resistor.
Cut 9 strips of 30x40.5cm cardboard Cut more 3cm wide strips that are then cut into 72 rectangles of 4.5x3cm. With hot glue, mount the strips and then the rectangles to form a little ‘box’ around each LED. Paint the inside of each ‘box’ white for better light reflection.
Build the Control Board
The components of the control board easily fit on half a 5x7cm prototype board. Solder it together according to the schematics and the picture shown. Note that the order of the columns (digits) and rows (segments) on the MAX7219 are not in order, but that’s easily fixed in software.
The capacitors are for filtering power, the pot to regulate the intensity. There is a 5-pin male header with bent pins to connect with the Arduino.
Modify the Table
Cut a square hole of 48x48cm out of the top of the table. The material is soft enough that it can be cut with a box cutter using moderate force. Remove the honeycomb filling. Drill or punch two holes through one side of the table for the two pushbuttons. Make a rectangular hole for the on/off button on the bottom side. Glue corner pieces to restrain the movement of the LED panel. I keep a box with random packaging materials and there happened to be plastic furniture angle protection pieces that only needed a little trim. You can also make these out of cardboard.
Prepare and Mount the Switches
Solder a 0.1muF ceramic capacitor over the contacts of each pushbutton. Together with the intrinsic pull-up 20-50kOhm resistor of the Arduino, this will provide anti-bouncing with a time constant of tau=RC=2-5ms. Solder the female JST connectors to the pushbuttons and the on/off switch. Mount the switches on the table.
Prepare the Arduino Nano
Solder 5 stranded wires, the male JST connectors and the USB male connector to the Arduino according to the schematics and the picture. Solder a female 5-pin pin header to the stranded wires (or solder it directly to the control board).
Upload run the SetEEPROM.ino sketch to the Arduino Nano. This puts 15 animations into the EEPROM. When they are uploaded (takes ~2s), LED 13 will light up. Now upload the AnimationTable.ino sketch.
NB: somehow the .ino files refused to upload. I renamed them with .txt and it was OK. So after download, change the extension back to .ino
Put Everything Together
Connect the Arduino to the control board, the switches and the power bank. Some Velcro on the powerbank is ideal to keep it in place. Connect the panel to the control board and put it inside the table. Switch on to see it light up: before starting any animation, all LEDs come up and go out. Then it shows the first animation, which is actually a static picture of a chess board. Cover with the plexiglass and check if the illumination inside each pixel is homogeneous. If not, cover the LED with a small piece of tissue. Punch holes in the four corners of the plexiglass and screw it to the table.
How to Produce Animations
The sketch allows to create and replay animations using only two buttons: ‘edit’ and ‘play’.
At startup, it shows he first animation, which is not really an animation since it consists of a single frame (a chess board). If you push 'play', it will go to the next animation. There are 16 in total: 15 actual animations of 1-15 frames, plus 1 that plays all of them in a sequence.
If you push 'edit', the frame will freeze and a cursor moves over the screen. Whenever you push 'edit' again, the pixel at the cursor position will invert. Press 'play' again to see the result and move to another frame. The changes are stored in real time in EEPROM, so they will be remain in memory even when switched off.
Bonus: a Prototype Version to Check the Software
If you just want to try out the animation maker on a small scale or in a different project, you can do it with a prototype shield, an 8x8 LED matrix with MAX7219 module attached and two pushbuttons, just as in the picture. The decoding of the rows and columns is no longer needed, so comment out line 64-65 and uncomment line 68-69.