Heart in Your Hands LED Box

Introduction: Heart in Your Hands LED Box

About: Jack of All Trades, Master of One: Being Me!
I typically try to think outside of the box when it comes to gifts for my wife. Valentine's Days is one of those holidays that we have sort of been forced into buying things out of obligation, but rather than buy her more of what she already has, I decided to make something instead. A few nights before V-Day, I way laying in bed, and the idea for this project came to mind. The only problem is that I wouldn't have time or be alone to make in until the night before Valentine's Day...  

So while I think this project has some potential to go somewhere, a lot of what I did could definitely be improved with more planning and preparation. The basic concept is a small, clear box (3 in3) that has painted designs on the inside of the box (to prevent them from getting scratched) with a small circuit that alters the brightness of a few red and while LEDs which illuminate the box from the inside. The trick to the box is that a small push button on the bottom of the box disconnects power to the circuit when it is resting on a table, but when the box is picked up, it begins to glow: hence, a "heart in the hands" box.

I have attached the programming files as well as a schematic for use in Eagle.

This is a short video showing the box in action. It also demonstrates a bit of what I mentioned earlier about improvement. The aesthetic quality of the box could be drastically improved with a better design painted on the box and more care in cutting the plexiglass casing. Note that the pulsing of the LEDs is only visible to the digital camera, but not to the naked eye. The color of the box does change over time as the different LEDs dim or get brighter.

Step 1: Materials and Such

When I started working on this project, I didn't entirely know where it was headed. This is a list of what I ended up using, but as usual, you might find something else works a bit better.

Sheet of Plexiglass - I used 9in3
Paint - Red, Black, White, etc
Paint brushes
Drill with various drill bits
Dremel with Cutoff wheel(s)
Electric Tape
Hot Glue

Circuit Components
Small Prototype board for circuit
9V Battery
Small push button
Various amounts of wire
ATtiny25 microcontroller
8 pin Dip Socket
0.1uF capacitor
3.3V regulator 
2 x 1uF capacitors
100k resistor
9V battery connector
10k resistor
1 x MOSFET with Vgs <= 9V
Various logic level MOSFETs
Various Red and White LEDs
Various sized current limiting resistors for LEDs

Step 2: The Button Hole

The only thing separating this from a somewhat cool gift to another random LED box on the counter is the automatic operation. A small push button on the bottom of the box will disconnect the power when pressed. We need to make a hole in the bottom plate for the button to poke through. 

For this, I placed the button on the outside edge of the circuit board and placed it on the piece of plexiglasss. After a quick mark, I was able to drill a hole big enough for the button to fit through. Drill plexiglass can be tricky... you will need to make a pilot hole and be careful with your speed and force. Once wrong move will put a crack in the plate or break it into multiple pieces.

Step 3: Create a Design

To prevent the designs from getting messed up, I decided to paint the inside of the box instead of the outside. That is part of the reason my design didn't come out like I imagined... You have to keep in mind that the first thing you paint will be the top layer you see, so you will need to add any small top later detail stuff first - the opposite of normal painting. 

The bottom plate can be totally black. I tried to make some of the lines/swirls line up as they went around the box. Plexiglass normally comes with protective films over each side. Only remove one side before you paint it. Keep the other side on until the project is done.

Step 4: Build the Box

Once the paint is dry, the box can be put together starting with the sides. I used hot glue, starting with a small line down one edge. Once two pieces were somewhat joined, I added a third side and finally the fourth. With all four sides connected, more glue can be added to the inside corners to secure the box.

Finally, the top can be put on by adding a small amount of glue all the way around the edge of the top and setting it in on the box. If your top is directional (like a hear shaped design) make sure you pick out your favorite side of the box to serve as the front. Once it is somewhat secure, flip the box over and add more glue around edges of each piece to thoroughly connect them all together.

Step 5: Add the Bottom Plate

One of the things I didn't really think about until it was time to do it was adding the bottom of the box. I entertained a few ideas until I decided upon using a few pieces of electric tape to hole the bottom in place. This allows the bottom piece to still swing open to easily change the battery. The piece can then be latched in place with a small piece of electric tape.

Step 6: Build the Circuit

This is a very simple circuit to understand: just a microcontroller and a few LED strings. The only interesting part is the power supply which uses a MOSFET as a switch to connect the circuit to ground. When the box is setting down, the button is pressed connecting the MOSFET gate to battery ground, thus opening the MOSFET switch. When the box is picked up, the button is depressed, and MOSFET gate is pulled up by the 100k resistor, turning on the MOSFET switch. This connects the circuit and LEDs to ground.

The only downside to the design is that while the button is pressed, current is flowing through the 100k resistor, but this only creates about .09mA *give or take due to fluctuations in battery voltage) so it isn't that bad. In fact, that is why such a week pull up resistor is used for this job.

The only important part placement is the push button which needs to be soldered to the bottom of the circuit board so it can go through the hole on the bottom plate.

Step 7: Program the MCU

The program is pretty simple. Once the MCU is initialized  it enters the main loop where the brightness of each LED is either increased or decreased. A 100ns interrupt serves as the timing for the LEDs. Every 10ms (100hz) the LEDs are turned on. Each LED is then turned off whenever a counter gets to the appropriate brightness level. 

The following is an example of one of the LED brightness controls in the main program loop. First, the "direction" is checed. A 1 means increasing brightness; a 0 means decreasing brightness. Next, the level is increased/decreased at a rate based on its current level. To keep the LED at a dimmer state longer (it is plenty bright during most of it;s operation) its level changes slowly at first. Once it gets to brighter states, the level will change more rapidly. If you want the LEDs to behave differently, this is the place to make the changes.
if(stat_flag & DIRECTION0){      // If LED 0 should increase in brightness

   if(brightness0 < 25) brightness0++;   // Increase slowly during dim states
   else if(brightness0 < 40) brightness0 += 5; // Increase slightly faster
   else if(brightness0 < 100) brightness0 +=10; // Increase rapidly
   else CLEAR_BIT(stat_flag, DIRECTION0);  // Time to change direction
else{           // If LED 0 should decrease in brightness
   if(brightness0 > 40) brightness0 -= 10;  // Decrease rapidly
   else if(brightness0 > 25) brightness0 -= 5; // Decrease slightly slower
   else if(brightness0 > 1) brightness0--;  // Decrease slowly during dim states
   else SET_BIT(stat_flag, DIRECTION0);   // Time to change direction
The next example is the part of the 100ns interrupt that turns the LEDs on and off. A counter for each LED counts to 100, at which time it turns the LED on and resets the counter. If the counter is not at 100, it is checked to see if it has reached the current brightness level. At this time, the LED is turned off and remains off until the counter reaches 100. This is called PWM (pulse width modulation) and it effectively controls the brightness of the LED.

if(++cnt0 == 100){    // 100 * 100ns = 10ms (100Hz)
LED_ON(0);             // Turn on LED 0
cnt0 = 0;                    // Reset Counter
 else if (cnt0 == brightness0) LED_OFF(0); // If reached desired brightness level, Turn off LED 0

I have attached the main file (valentine.c) as well as the necessary makefile for use with WinAVR. The Hex file is also available if you just want to program the chip and not alter it at all. Also included in this zip file is the schematic for use in Cadsoft Eagle.

Step 8: Attach the Circuit

Hopefully your solder joints are not too big, because the button needs to go through the hole enough for proper operation. I added a bit of hot glue to the bottom corners of the circuit, lined the button up with the hole, and pushed the circuit down while the glue dried to ensure the button was definitely embedded in the bottom plate.

Step 9: Power It Up

The last thing to add is the battery. Hopefully, you left enough room next to the circuit to fit the battery inside of the box!. I put a small piece of electric tape rolled up on the bottom of the battery to hold it in place on the bottom plate. The circuit should turn on immediately once the battery is connected unless the button is being pushed.

The bottom plate can be closed and latched with a small bit of tape, and finally the protective film can be removed from the outside of the plexiglass pieces.

Hopefully you (and/or your loved one) enjoys this box! My wife really likes it, even though she said it looks like it was made by a small child. Remember, women of the world, guys have feelings too. Words can hurt. But enough about that... 

If you decide to make this or something similar, I'd advise you to improve some of my design and creation process. And definitely don't try to do it all the night before you need it!

Valentine's Day Contest

Participated in the
Valentine's Day Contest

Be the First to Share


    • Pocket-Sized Speed Challenge

      Pocket-Sized Speed Challenge
    • Super-Size Speed Challenge

      Super-Size Speed Challenge
    • Audio Challenge 2020

      Audio Challenge 2020