3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Animated LED Heart

Animated LED Heart
This is a battery-powered LED heart with several different animated flashing sequences, selectable with a push button. I designed and built it for my girlfriend this Christmas. While waiting for the parts to arrive, I went through several redesigns, particularly because I couldn't find a good tradeoff between a good LED layout and low complexity.

I finally settled on a layout that uses 14 LEDs, two 8-bit shift registers and an ATtiny85V(though even a lowly ATtiny25 would probably work if I simplified the code, I wasn't sure how much program space I'd need and the cost difference is negligible). I've used a socket for the microcontroller so I could test different patterns and animation speeds. After running for 50 straight hours(with a somewhat above average "load" animation), my generic AA alkalines(fresh when the test started) were measured at 1.71 volts. It was still working, albeit with very low light coming from the LEDs.

So here is my first Instructable, for your enjoyment and/or education. See a video of it in action here(it doesn't actually "fade"; that's just my camera being slow) and showing off newer patterns here(sorry for the color balance). Hopefully my girlfriend likes it, and I hope you do, too! Please let me know if anything is too confusing or if you have any questions. If you decide to make one yourself, or if you're inspired to build something similar, I'd enjoy seeing your results!
 
Remove these adsRemove these ads by Signing Up
 

Step 1Parts

Parts
«
  • parts1.jpg
  • parts2.jpg
  • parts3.jpg
The following is the parts I've used in my design. You may wish to use a different shape with more or less LEDs, and most parts can be substituted. Prices are all before any taxes.

* Grid PC Board; I got mine at a local independent electronics shop, but it's very similar to RadioShack's #276-158. You can probably find one on Digi-Key, but they are needlessly expensive($10+ for a board this size), as they only carry boards designed for repeated resoldering. I'd avoid a stripboard unless you know what you're doing and are familiar with them. RadioShack's is $3.19.
Note that you could prototype this project on a solderless breadboard(and I did all of my microcontroller programming/testing on one), but the "heart" or other shape aspect will be mostly lost, obviously.

* AAx2 battery holder; I also got this from my local retailer, but you could also use RadioShack #270-408 for $1.99.
You could instead choose a low voltage(<5.5 volt for most AVR microcontrollers) power adapter instead, or a higher voltage(maybe a 9V battery, but you wouldn't have much run time) supply with a regulator.

* 3mm red LEDs - 14 pcs.; Mine are low current(2mA, but they handle up to ~30mA) from Digi-Key(754-1245-ND), and cost just under six cents each in a bag of 100. I should warn you that this exact part is actually red-orange when lit up. RadioShack part 276-026 is very comparable, and they're truly red, but cost $1.69 per pack of 2. Ouch. Converted cost for this project is $0.83($1.26 if you don't go for the 100 pack)for the Digi-Key LEDs and $11.83 for the Shack's LEDs.
Color is up to preference, but other colors have different voltage drops. More information below.

* 330 ohm resistors - 14 pcs.; Power rating and resistive element type don't make a difference, but carbon film are cheapest. RadioShack sells these in packs of five(#271-012) for $1.19 each. Digi-Key CF14JT330RCT-ND are eight cents each, individually, but if you're working with a lot of LEDs, you might wanna buy a 100 pack for $2.19 total. Amazing deal, if you ask me. RadioShack, $3.57(with one lonely resistor left over); Digi-Key, $2.19(with 86 resistors partying in your spare parts container afterward).
I calculated this resistance to provide between 2-5mA to the LEDs over the life of two alkaline AA batteries(3.2 volts fully charged, ~2 volts nearly dead). If you'll be using a different power supply and/or different LEDs, you should use an online calculator to find the value you need. Assuming you're still using batteries, find the charged and depleted voltages to ensure your LEDs look good over the life of the batteries. Here is a good calculator, but be sure to change the "how many connected" field from 2 to 1, unless you want to run multiples(do so at your own risk and with experience). Keep in mind that shift register pins don't like to supply more than about 25mA each.

* 47k ohm pull-up resistor; This lets us use the button reliably. It doesn't have to be as high as 47k, but I chose it to draw as little current as possible, as I'm running from batteries. You only need one, but RadioShack #271-1342 will get you five for $1.19 and Digi-Key S47KQCT-ND will run you $0.08 apiece.
If you already have a resistor greater than 10k, you could use it, but try not to go too far above 47k, or your microcontroller may not get enough current to be held high. Experiment on a breadboard if you have any doubt!

* 74HC595 shift register - 2 pcs.; These are each capable of driving 8 outputs, although one output on each is awkwardly on the other side of the chip. Since I'm using 14 LEDs, I just left those "odd" outputs unconnected and wrote my code to match. I used 2 296-1600-5-ND from Digi-Key at $0.63 each. RadioShack doesn't seem to sell shift registers, so my recommended Digi-Key alternative is SparkFun(COM-00733) who will charge a modest $1.50 each. Totals are $1.26 for Digi-Key's or $3 at SparkFun.

* DIP-8 IC socket; I highly recommend one for making adjustments to the code after assembly. Even if you don't intend to write or modify your own code, if there's some problem, you'll want to be able to diagnose it. I used a Swiss-milled gold-plated socket I had lying around, but it really doesn't make a difference for this. Digi-Key A100204-ND is $0.14 and RadioShack #276-1995 is $0.59.
You don't necessarily need one, if you're confident with your assembly and soldering skills. An alternative, if you'd still like programming access afterward, is to use pin headers to connect an ICSP(in circuit serial programmer). Heck, maybe you wanna use both.

* ATtiny85V; This little 8 pin microcontroller has 8K of program space, which is lovely for prototyping. I've found I don't need that much, and could get away with an ATtiny45 or possibly even a 25. I chose the "V" version because it reliably runs on voltages as low as 1.8 volts, so it's ideal for battery use. RadioShack doesn't sell microcontrollers alone, but SparkFun has the standard(not low-voltage) version COM-09378 for $2.84 and Digi-Key sells the ATtiny85V(ATTINY85V-10PU-ND) for $2.26.
Just about any microcontroller can be used here, as we only need 3 pins for shift register control and one pin for button input. If you want to forgo the shift register wiring(and coding, if you don't use my code), you should go with a controller that has enough pins to drive all of your LEDs. You can greatly increase the number of LEDs a chip can drive with charlieplexing, but that's a topic for another Instructable. Also be sure to get a different socket size if your microcontroller uses more pins!

* Power switch; I won't recommend a specific switch here, because there are thousands of valid options, and what you pick depends on what case you put this in, if you use a case at all. SPST or SPDT will work, but SPDT may be easier to find. Spec the voltage rating for your power supply, and calculate your worst-case scenario for current. Most switches will provide more than enough, but for the record, my design here will consume no more than 60mA. I paid about $4 for mine, a panel-mount paddle switch.

* Push button; This will be used to switch to the next pattern animation. Like above, there are far too many options to recommend one. I prototyped with a standard, breadboard-compatible button, but my final design uses a panel-mount button. A four pack cost $3.69.

* Enclosure; If the button/switch had a lot of options, this is just crazy. You could put this in a cardboard box, or mounted to a piece of wood or plexiglass, or even leave it exposed. Put it in a custom wooden case or hang it on the wall. Just be sure that nothing shorts out on the bottom of the circuit board. If you mount on metal, use standoffs or a lot of electrical tape. I used a tin that has a clear, plastic window in its lid. My mom had this lying around, so it cost me nothing.
« Previous StepDownload PDFView All StepsNext Step »
20 comments
Apr 28, 2012. 10:34 PMslayer04 says:
Hey!!! I finally got it working !! This instructible is great, amazing idea!

I did everything the same except I swapped out red LED's for blue and machined a special aluminum enclosure for everything.

What you see on the right hand side of the one picture is a custom battery holder that I machined to hold 3 coin batteries which will attach to the back of the case to make it lightweight and easy to carry compared to AA's

Also, if people have trouble programming their ATiny (this was my first time) should pm me because it took me a long time (and very frustrating) to get working correctly.
May 3, 2012. 12:32 PMslayer04 says:
well it turns out with Arduino 0.22 I couldn't get the boot loader to upload correctly to 8 MHz which is what caused the program to act funny. Then with Arduino 1.0 the default ISP sketch is not compatible with the ATiny series so after lots of searching on the internet, I found a guy on a forum that had made an updated version which corrected the problem and then after downloading and using that new sketch. I finally had a working ATiny.
Mar 16, 2012. 3:51 PMslayer04 says:
Hello, me again, looks like I have everything working :) except the ATiny :( do you have any ideas as to why I might get this erorr when other sketches upload and run just fine on the ATiny except the animatedheart file. I have tried both the original and v2, both have the same result.

Binary sketch size: 2318 bytes (of a 8192 byte maximum)
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85

Thanks for all the help
Mar 16, 2012. 6:26 PMslayer04 says:
ops I should included this earlier but yes, I did try that and this is how the circuit behaves.

Connect power supply, nothing happens.
press button and all led's light up,
let go of button, all led's go out,

It won't cycle through any of the programmed functions with the button and the led's only light up while the button is pressed. I also noticed that the ATiny heats up quite a bit while the power is connected. I'm not sure if this is normal for it but I checked the circuit about 5 times for shorts and incorrect wiring but couldn't find anything.
Mar 16, 2012. 8:58 PMslayer04 says:
I followed your instructible to the letter, except I did swap out the leds, resistors, and applied voltage. I instead used blue led's from which I calculated the resistors that I would need to properly power the led's with a 4.5v power supply so I bought 226 OHM 1/4W 1% METAL FILM .

The configuration of the button as it sits now is, one lead goes to ground, the other to pin3 of the ATiny, also connected to pin3 is the 47k ohm resistor from which the other lead goes to V+.
Feb 6, 2012. 7:15 PMslayer04 says:
(removed by author or community request)
Feb 8, 2012. 6:37 PMslayer04 says:
is there anyway to test the shift registers to make sure they are not damaged ? Because I know all the led wiring works and I didn't have any errors when I programmed the ATtiny so I doubt that is the problem.
Feb 9, 2012. 12:04 PMslayer04 says:
With the shift registers, all the pins should be internally connected to the ground correct?

because I tested the pins directly and when I kept one probe on ground/Vcc and touched any of the other pins, it would test positive for only one of the shift registers, the other only tested positive with th Vcc but there was no connection between ground and the other pins on it.

On another note, I have led's lighting up or should I say only most of the led's from 1 shift register but they don't really do anything.... they remain off unless I press the button, then they light up but only while the button is pressed. As soon as I let go they go out again. Also should the ATtiny get really warm/hot when current is run through it?

Now I'm really confused because I followed your wiring diagram for the shift registers and grounded pin 13 but when I looked up the schematic for mine (I bought the ones from the link you provided). It says that pin 8 is ground and 13 is OE. So if I grounded it improperly, I don't know why any of them are lighting up
Jan 12, 2012. 12:30 PMabedjudo says:
how can i use the z 80
Dec 13, 2011. 3:01 AMzhengchangjian says:
nice
Dec 11, 2011. 5:36 AMsswanton says:
This is Amazing, Think I'm going to adapt this to make a nerdy christmas card for my girlfriend!..
Dec 10, 2011. 6:47 PMmatt.e.jenkins says:
This is a great instructable. It's well documented. Thanks and keep up the good work.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
4
Followers
1
Author:LexanPanda