New at posting here, but always love to see new projects come up, especially ones I can potentially do. So when I decided to make something special for my girlfriend; I knew my inner nerd would shine. I love using LEDs in projects because they are quick and easy to use, and applicable to so many projects. This is a LED heart and Initials project controlled by Arduino, which through the use of switches allows for 4 settings, including a flashing setting which alternates. I hope you all enjoy, and let me know if you make something like this for your special person in the comments below.
Step 1: Figure Out Your Initials
This may seem obvious, but it is a necessary step to make a LED heart design around it. When I started planning, I knew I wanted both mine and my girlfriend's initials inside the heart. Additionally, when I thought about it, a plus sign in the middle just seemed to complete the togetherness feeling that this project aims for.
Step 2: Get Your Materials
Honestly, the amount of LEDs needed depends heavily on the initials used. This is the main reason that this is the second step. To be conservative and overestimate the amount of LEDs necessary, I recommend getting a large pack (as shown below) so that you don't run out right as you are about to finish.
5mm LEDs - Pack of 100 I chose white, but any color works.
330 Ohm Resistors - 2 I always like to keep these around, so get a pack like this so you never run out.
2 Position Panel Mount Slide Switch - 2 I bought a pack because I always seem to be running out of them.
Push Button Switch - 1 You can probably find a pack cheaper online, but I was lazy and bought mine from Radioshack.
Arduino Uno - 1 This is used to control the light show. The provided link likely is not the best price; I always source mine from Microcenter.
Perfboard - 1 Solder everything together here to give it a nice clean look. I don't have a link, but a 2 pack of 4" X 10" ran me about $8 on Amazon.
9V Battery - 1 This is used to power the project.
Soldering Iron and Solder These are used to make connections.
Step 3: Start Working!
NOTE: Make sure that when placing the LEDs, the anodes all face either outward or inward for each part. This will be more important later.
Having the design of a heart with initials and a plus sign in mind, I just started to work. I did it by placing the LEDs where I thought looked nice as a heart design and then added the initials and plus sign after. The way I did the heart bottom diagonals was placing each LED three holes over and two up from the previous one. Approaching the sides, the LED layout should become less holes over and the same amount up, or more. I mirrored this on the top part, but made it a steeper curve by adding more LEDs in the space, in a downward curve for both sides.
Creation of the Letters:
Simply place LEDs in the form of your initials, leaving space in between for a plus sign.
Using 5 LEDs, make a plus sign, by having an origin LED and then branching off in the four cardinal directions with one LED each. These should be placed roughly 2-3 holes away from the origin.
Step 4: Soldering Time!
This is always a fun time for me, cuz who doesn't like to hold super hot items in their hand that can potentially severely burn you!
So I decided that the best way to have the layers (Heart and Initials+Plus Sign) to be controlled from the arduino would be to have two different common anodes and cathodes. In this manner, all the LEDs for one layer would be put in series, all having a common anode, and a common cathode. So to put it basically, all the anodes for the LEDs that make up the heart are soldered together. Then, all the cathodes of the LEDs that make up the heart are soldered together. Then, the same is done for the initials and plus sign. This is why it was important for all of them to face one way earlier.
Because I am lazy, I merely bent the anodes/cathodes using a pair of pliers and then soldered one onto the next until coming full circle. This made it slightly tricky when dealing with the initials and plus sign, but is able to be done.
Once the anodes and cathodes for each layer are soldered together respectfully, one jumper cable should be soldered onto each section. There should be 4 jumpers soldered, detailed as follows: heart anode layer, heart cathode layer, initials and plus sign anode layer, initials and plus sign cathode layer.
That is more or less all the soldering that is necessary unless you wish to attach the switches by soldering as well.
Step 5: Now to Be Logical
So while I may not be the smartest person in the world, I do have ideas and can figure out means to fabricate them into existence. To truly visualize what I was doing, and if it would work, I used 123D's circuit widget, which allowed me to simulate the switches placement BEFORE I fried my Arduino in real life. My very basic circuit diagram is attached above, which shows essentially how one LED would work with a switch, which is essentially what is happening by creating the common anodes and cathodes. I learned this when making a 4X4X4 LED cube earlier in life, something I would strongly recommend doing if you have patience and like awesome projects.
Now onto how we use this diagram:
First: We are going to solder 1 of the resistors onto the anode jumper cable for the heart layer. This resistor will then connect to pin #8.
Second: We are going to solder another of the resistors onto the anode jumper cable for the initials and plus layer. This resistor will then connect to pin #6.
Third: Connect the cathode jumper cable for the initials and plus sign layer to a ground pinout (GND).
Fourth: This is probably not the best way to do it, but it works. Taking a small piece of perfboard, solder a jumper onto one of the holes. The other side attach to the 5V pinout on the Arduino. Then, leaving 2-3 holes between, solder another jumper to the board. This jumper then will attach to a ground pin on the Arduino (GND).
Fifth: Solder the cathode jumper cable for the heart layer to the perfboard, connecting it with the jumper cable that attaches to the ground. At this point, you'll have two lines starting on the perfboard, a ground line (GND) and a 5V line, which I will call them from now on.
Sixth: Now we will start to actually put together the switches. As shown we have switches with 3 connections. For our first switch, we are going to connect a jumper from the 5V line to one of the end connectors of the switch. On the other end of the switch, attach a jumper and connect it to the ground line. Now, we have only one connection left to make, the middle one. Attach a jumper to this middle connector, and connect the other end to pin #5 on the Arduino. We do this so that we have a read signal coming from the switch, which will be utilized in the code later on.
Seven: Repeat step six with the other switch, but have the middle jumper attach to the Arduino at pin #6.
Step 6: Final Touches
Now that we have all the switches hooked up, it is time to give the board power. I did this by using a 9V battery. I attached a 9V to jumpers connector so that I was able to put a push switch into the circuit, allowing for an easy on off mechanism. To do this, attach the positive terminal of the battery (usually the red cord in the connector) one connector on the switch; this can be done by soldering or just crimping the wire into place. The negative terminal of the battery (usually the black cord in the connector) will be attached to one of the Arduino board's ground (GND) pins. Now attach a jumper wire to the other connector of the button switch. The opposite end of the jumper cable should then be attached to the Voltage in (Vin) pin on the board. This will provide power to the board when the button is toggled on, and turn it off when toggled the other way (creates a short in the circuit, no electricity flows from the battery to the board).
Step 7: Script
Oh I suppose you probably want to know how to make this work too. Well, that requires writing a little code in order to program the Arduino to do what you want. I wanted there to be 4 different options for how the lights turned on. The options would be controlled by the switches with these being the options:
1. Both layers on (All LEDs on)
2. Heart layer on, Initials and Plus off
3. Initials and Plus on, Heart off
4. Alternating on and off for heart layer and initials and plus layer
I managed to do this through the code attached below, which essentially initializes which pins correlate with what, and then compares the input of the switches, and then based on that changes which LED layers light up.
Step 8: Putting Everything Together
Now that your LEDs are lighting up, and the script is how you want it, it is time to put everything together. I used an old chocolate tin that I had and put all the components in, arranging it so the Arduino and perfboard were flat, and the switches were all accessible. While I know that this probably isn't the best type of container to hold electronics, I had it lying around so I decided to use it because it was able to hold all the parts together in a convenient package, while looking better than cardboard on the outside. Once you are satisfied, put the lid on the tin and wrap it in some ribbon to make it look like the amazing present it is. I added a pack of Reese's on as well because that's another way to get my girl to smile. Those can be left off or replaced with whatever candy you like if you wanna make it extra special.