Introduction: Happiness on Demand

About: Always up for something new!

A friend was going through a tough period, so I made a box that displays a compliment or something cheerful whenever needed. In short it's a 9x9 grid of LEDs that can be individually lighted behind a plate with letters cut out. The whole project took me a few weeks of on-and-off working on it, but then again I had never used a lasercutter, an arduino, or a soldering iron before. The total cost is about 30 euro, most of which was the cost of the Arduino. Things you'll need:

- Standard 600x300x3mm MDF plate and somewhere to have it lasercut
- 81 White LEDs (20mA, 5mm)
- 9 Resistors of 200 Ohm
- 1 Resistor of 10 MegaOhm
- Lots of iron or copper wire, which you could strip from some old cable
- An Arduino Uno board
- Some aluminium foil from the kitchen
- A soldering iron, solder, strong tape and a few small screws (~2mm)
- Plain white paper
- A 9 volt battery + connector (optional)
- A switch (optional)
- Black spraypaint (optional)

Step 1: Designing the Front Panel

First things first: Write out the sentences you want the box to display when it's finished. Make sure to use short words with max 5-6 characters. This is important because first of all, long words block space for others, and more importantly the current is divided over the LEDs we'll use to display characters. This means that if you want to light too many simultaneously, they'll be dimmer (more on why that is in the last step - it's not an input current problem). If you really want a longer word, try to not place them diagonally. Dimming is not a problem on single rows/columns, only across rows/columns. The more you can reuse a word or syllable, the better.

Then make a long list of individual words and place them in a grid from top left to bottom right. You could use a word puzzle generator for this and then add some of the missing ones. Fill up with random vowels in the middle and consonants at the sides. Don't forget to note where your words are, save yourself the trouble of searching them back when you write the code in the last step...

Step 2: Lasercutting and Assembling the Base

Cut out all the necessary parts on a lasercutter, I used the one in our university's free-to-all FabLab. They also supplied 3mm MDF at 1 euro a plate, the heroes.

First, slide all the thin bars on the left of the drawing together into a 9x9 grid, then use wood glue to attach it to the front plate with the letters. We'll place a LED behind each letter and then activate some of them to form words, and the grid stops the light from bleeding through to other letters. Then glue the first base plate - with the horizontal guidelines and the 5mm holes - to the back of the grid. In both cases, make sure the holes/letters line up with the grid. Clamp together or put some books on top of the thing, and leave overnight to dry.

Step 3: Soldering the Anodes and Cathodes in Lines

Once the front is dry, place a LED in each of the holes and fold all the anodes (the long legs) in the same direction. Then solder each row of 9 LEDS to a piece of iron wire that is about twice the length of the lasercut darker guideline. Repeat 9 times, then cut off the anodes at the wire so there's no unnecessary parts sticking out.

Once this is done, add the next plate - with the 1mm holes - on top, placing each cathode (short leg) through a hole. Now solder the cathodes to a wire, again following the guideline. It's important that the connecting wires are in the opposite direction for the anodes and the cathodes. Cut off the ends again to avoid accidental connections.

You can now activate the LEDs one by one by attaching a battery to the wires of the LED's respective row and column. I advise you to quickly test all of them at this stage, but watch out - place a resistor in between, or you'll fry the LED and you'll have to start over.

Step 4: Add the Back Plate and the Resistors

Dry MDF works well as an insulator. Stick the 18 wires through and connect a resistor to each anode-connected wire. Make sure you calculate approximately what resistance is needed for the LEDs you have, making them as bright as possible without overloading them. More info here:

Screw the Arduino board to the back and connect each wire to one of the ports. I originally intended to embed them in the mdf and glue them in with clear glue, but the guidelines turned out too superficial and they didn't stay in place, it was a mess. So instead I just powertaped them to the plate, which worked like a charm, even if it does look a bit less nice. Any strong tape works insulating on the 5 volt charge an Arduino emits.

Step 5: The Control Switch

I added a button on top to control the Arduino: Every time it's pressed, a different sentence is displayed. I chose a capacitive sensor because it's the easiest type of button to DIY and conveniently also the fanciest. It works by detecting the time it takes to charge the circuit (the "capacitor") between two Arduino ports, which is very consistent. When you bring your hand closeby, the charging time changes and the Arduino can react on detecting the difference. The nice thing is that it can detect your hand through a non-conducting material, so you can make a top button out of anything or even simply draw it on the MDF instead of cutting it out. I opted for a small piece of white plasticard because it's just so easy to cut to size.

Basically, you connect one port to a 10 MegaOhm resistor (the orange wire), then split the wire before the resistor and
A) Directly connect the resistor to another port on the Arduino
B) Run the other side to where you want the button to be. I folded some aluminium foil around this end (not in the picture, I'm afraid) to act as a capacitor that decreases how much unrelated closeby currents influence the charging time. Here's the instructable that I drew inspiration from:

Optional step (video):
I wanted to allow for it to be used without being plugged into a wall socket, so I added a simple 9 volt battery as well. The yellow and black wires run to it and it just powers the Arduino. Because a 9v battery only has a few hours of power in it, I also added a simple switch that I found on ebay to interrupt the circuit. Usually though it's better to just plug it into a wall with a cellphone charger.

Step 6: Casing

You're pretty much done! Optionally spray the outside case in some color. Now just slap on some screws, generously add some glue, and put it all together. Place some white (or any color) paper in front of the letters to diffuse the light, and close with glass to protect the whole thing from damage. I found the glass first in some old frames and sized the rest to it, but you could also have glass cut to size in a lasercutter or maybe a local hobbystore.

Step 7: Code

Now to the essential part: Coding!

First, redefine the name of all the ports you connected to to make coding easier later as such:

const int r1 = 0; // row 1 = port 0
const int c1 = 9 // column 1 = port 9


Don't forget that the column lines are mirrored when you see it from the backside, so the wire on the left is line 9.

Now you can light up individual LEDs by coding the following sequence:

digitalWrite(r1, HIGH);
digitalWrite(c1, LOW);

This code will essentially put 5V on the first row of leds, and decrease the voltage on the first column to 0V, therefore making LED(1,1) the only LED with a power differential. Then inverse high and low to turn it back off. Once you played around with that you'll notice it's quite inconvenient to type this out every time (and it takes up lots of memory). A better way of coding is to define an Activate sequence "A" once:

void A(int row,int column) {
digitalWrite(row, HIGH);
digitalWrite(column, LOW); }

Where int stands for "integer", as you'll be refering an Arduino port number to it. Then call sequence "A" with the right row and column as follows:
void ActivateFirstLED() {A(r1,c1);}

You can then call several of these in one function to form words. You'll notice that if you light up leds on a diagonal, they light up in squares instead of individual leds (which makes sense - you're "activating" 2x2 lines). To solve this, you activate the LEDs one by one instead, and switch between them every 4 microseconds. This blinking is not visible to the human eye, so you'll only see the two LEDs you wanted light up. You can, however, see it when you record it on camera! This process is called multiplexing and it's the reason the LEDs appear dimmer of you light up too many. The Arduino can supply enough current to brightly light all 81 LEDs simultaneously, but longer pauzes in between cause them to dim. Some code for this:

void A_2(int row1,int col1, int row2, int col2)
int var = 0; while (var < (Time/8))
{A(row1,col1);delay(4);Off(); A(row2,col2);delay(4);Off();

In the above example, "Off()" is a different function I defined that turns all the rows to LOW and all columns to HIGH. "Time" is a constant that you can predefine as how long you want the word to be displayed. Add a "delay(#microseconds)" to define the pause between words. You'll find the code for those in the file, as well as for 3, 4 and 5 letter words.

Call function A_2 as follows: void ActivateFirstAndSecondLED() {A_2(r1,c1,r2,c2);}

The rest of the code is fairly self explanatory and can be viewed in the file (although most of the sentences are in Dutch, so you'll have to replace the actual words). You'll also need to define a loop sequence that plays one of the sentences randomly once the button is touched and include some code from the CapSense library for the button to work. In the Instructable regarding Capacitive sensors I mentioned before, you'll find a detailed explanation on how to write the code for the sensor. Don't worry if this doesn't work in the start, take it step by step - start with one word, then two, then a sentence, then the sensor, then play two sentences in a sequence, then randomize them, add more sentences, ...

Good luck!

Invention Challenge 2017

Participated in the
Invention Challenge 2017